[TYPO3-core] RFC #16586: Refactor conditions in t3lib_extFileFunc

Andreas Wolf typo3ml at andreaswolf.info
Tue Nov 30 15:40:21 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jigal,

Am 30.11.10 14:35, schrieb Jigal van Hemert:
> On 30-11-2010 13:41, Andreas Wolf wrote:
>> Argh. Yes. The example is wrong. It should have been:
>>
>> after:
>> if (!condition) {
>>     $this->writeLog(...);
>>     return FALSE;
>> }
>> foo();
>> bar();
> 
> In these kind of case the Coding Guidelines [1] mention: "In general
> there should be a single return statement in the function (see the
> preceding example). However a function can return during parameter
> validation before it starts its main logic."

well, what is done in these statements is mainly validation of
parameters. So I don't see a problem in adding return statements - and
additionally there are log statements before each of these, which eases
debugging.


> In the original code are already far too many return statements and your
> version adds many more :-(

I'd really like to use exceptions - this would be a lot cleaner, but
change the existing semantics. This would break existing code in many
places, so this is no real option.


> Hopefully you're still motivated to contribute, but changes to monster
> functions are best done by splitting things up in parts which are easy
> to understand.

I did not want to do such a large refactoring for now – this would
require some coding and extensive testing and I don't have time for
either of that ;-) And I think my patch still improves readability of
the code, though it is not a big step.


Regards

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

iEYEARECAAYFAkz1DNQACgkQHWtXp155bP89tACeLiDBJLqhYH0RLbuvF7MKwrGL
hpcAn3CJMLBzpgtZC3ITjMYwM1GuPLNU
=e2fH
-----END PGP SIGNATURE-----


More information about the TYPO3-team-core mailing list