Re: Re: Long Live GOTO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 Feb 2012, at 20:44, Marco Behnke wrote:

> Am 06.02.12 17:23, schrieb Alain Williams:
>> However: a few GOTOs can make things clearer. Think of a function that
>> can fail in several different places (eg data validation, ...). But it
>> is reading a file which needs to be closed before the function
>> returns. I have seen code where some $IsError variable is tested in
>> 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.

"Good" code can use any combination of language features. "Bad" code can also use exceptions. Choice of language features rarely has a significant bearing on whether the code you write is good or bad. This sort of thinking is what resulted in goto gaining a tarnished reputation because people abused the feature.

Language features don't write bad code... programmers do!

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux