[TYPO3-dev] RFC: CGL change regarding return statements

Sebastian Fischer sf at marketing-factory.de
Thu Mar 10 16:01:01 CET 2011


On 09.03.2011 18:51, Andreas Wolf wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Hi Ernesto,
>
> Am 09.03.2011 18:31, schrieb Ernesto Baschny [cron IT]:
>> I see no conflict with your proposal and what we already say in the CGL.
>
> I personally don't see that either, but as there have been complaints
> about my RFC for refactoring t3lib_extFileFunc and also for the
> mentioned review request, I wanted to put this on the agenda.
>
>
>> There is no limitation of "only one return" in the validation part as we
>> have it written down already: there can be several, which makes exactly
>> what you are trying to do more readable.
>>
>> What are the "parameters" to validate is of course depending on the on
>> the method, I would say a parameter can be everything that might
>> influence the outcome of the method. On a good designed system those
>> would only be the input parameters, but I doubt it that it will be
>> possible in our legacy code. ;)
>
> If we can agree on an extended definition of "parameters", I would like
> to have that inside the CGL; if not now, we should at least have it on
> schedule for the next CGL review session and also try it out from now on.
>
> I would also add a sentence about using exceptions instead of return
> statements with arbitrary values. This should at least be done for all
> new code...
>
> Regards
> Andreas
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEAREIAAYFAk13vh8ACgkQHWtXp155bP9tgQCeKb3oQBVOHZiNTHD6+12v/677
> yrIAnjl41xukaDmMCn7Ew/8uDeswPqto
> =FCpC
> -----END PGP SIGNATURE-----

Dont take it personal, but if the code is cluttered it should get a 
cleanup. And by taking about cleaning and clean code there should <- yes 
should be only one return.
If there is a should, then there is a could. In a perfect world 
(somewhere outside of old typo3 classes) this would never happen, but it 
could happen that you need more than one return.

So from my point of view the CGL is fine as is and shouldnt be changed.

Greetings
Sebastian




More information about the TYPO3-dev mailing list