Re: Re: Long Live GOTO
| From: | Marco Behnke | Date: | Tue, 07 Feb 2012 00:03:36 +0000 |
| Subject: | Re: Re: Long Live GOTO | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316512@lists.php.net to get a copy of this message | ||
Am 06.02.12 21:55, schrieb Adam Richardson:
> On Mon, Feb 6, 2012 at 3:44 PM, Marco Behnke <marco@behnke.biz> wrote:
>
>> Am 06.02.12 17:23, schrieb Alain Williams:
>>
>> many places to see if things should be done. That is just as bad as
>> lots of GOTO -- often when having to write something like that I will
>> have a GOTO (in
>> Good code uses Exceptions and try catch for that kind of scenarios.
>>
> Marco,
>
> Do you know of any research (Human Factors, Bug Analysis, etc.) that
> supports this? I'm certainly not saying that your assertion is incorrect.
> However, I'm starting to compile relevant research related to this topic.
No, this actually a personal experience developed over several years.
Bad documentated @throws is a pain too, I admit that.
From time to time I stumble into that if/else/return scenario where a
method should return a boolean for example depending on the given
parameters. PHP does not offer type checking so what if you submit
garbage that makes no sense for our method.
What will I return? I use exceptions for these unexpected exits. The
caller can now check on true or false and offer an additional try/catch
around it to handle exception.
This is only one artificial example, but imho and if I read the
conversion up to know correct, offers a cleaner approach.
Sadly most IDE offer no support for @throws annotations, I don't know a
single one, and PHP does not support it too.
I haven't used GOTO since C64 days and haven't missed - well during
study days I used GOTO in Assembler :-)
Well, this is just my opinion on the topic and I think that this is in
favor of GOTO.
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: marco@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc