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

Andreas Wolf typo3ml at andreaswolf.info
Fri Mar 11 11:35:15 CET 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Am 10.03.2011 17:55, schrieb Oliver Klee:
> Hi,
> 
> Am 09.03.2011 18:21, schrieb Andreas Wolf:
>> So what I propose is to drop the limitation to one return statement for
>> all validation logic at the start of a method. It should be clear where
>> this part ends and when the business logic starts. There, only one
>> return statement is allowed.
> 
> I fully agree (assuming that I've understood you correctly, of which I'm
> not quite sure yet). Just to be safe, let me paraphrase what I've
> understood:
> 
> 1. (optional, and possibly several) guard clauses at the beginning of
> the function for error cases and special cases (those might contain
> either an exception or returns)
> 
> 2. after that, only exactly one (or no) return at the end of the function
> 
> 
> Is this what you mean?

Yes, exactly.
I sometimes miss a real background in CS to know all these terms like
guard clause ;)

Regards

Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEAREIAAYFAk15+uMACgkQHWtXp155bP/fkwCeJaE2ZrrNplPJiCbfMudLiFdb
bTQAn0BUQPTOdjohlt39Ji4+eu1kugAi
=HqYP
-----END PGP SIGNATURE-----




More information about the TYPO3-dev mailing list