Re: Long Live GOTO
| From: | Jim Giner | Date: | Mon, 06 Feb 2012 16:12:53 +0000 |
| Subject: | Re: Long Live GOTO | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316474@lists.php.net to get a copy of this message | ||
NO "GO"!
As one who started back in the 70's with old style coding that utilized GoTo
in Cobol, Fortran, etc. and had to deal with "spaghetti code" written by
even earlier developers who never considered that someone else would have to
maintain their code, I feel strongly that GoTo is not to be used.
There are many ways of avoiding the perceived need for a GoTo statement.
The 'Break' is one in PHP as is the 'Continue'. Better instruction in
programming since the 70's has taught beginning coders the value of
well-structured code using function calls and distinct paragraphs (if you
will) of code that help to structure the entire process into manageable
chunks to facilitate understanding and maintenance. Random GoTos
interspersed into code because a designer just hasn't taken the time to
write it well is just not smart. Think of a well-written article in a
journal or newspaper. Do you think that the author just threw it together
and the points to be made just fell out of it? No - that writer probably
spent a good amount of time re-working his first draft into second and third
drafts before getting his thoughts and words in the right order to
facilitate the presentation of the ideas he was trying to communicate. The
same process can and should be brought into play when writing code and in
that way produce a quality product that will stand the test of time and lend
itself easily to necessary improvements when needed.
My $.02.
"Adam Richardson" <simpleshot@gmail.com> wrote in message
news:CAC6CJqYLdqSih0+v=X78LnB_wuN7sqMctKxDC0790Th7c-Cd6g@mail.gmail.com...
> Hi,
>
> While not purely focused on PHP, I toss this out to the group because I
> believe there are some novel, interesting points regarding the potential
> benefits of using the goto construct as implemented in PHP:
>
>