FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » terminate a PHP script
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: terminate a PHP script [message #172574 is a reply to message #172544] Tue, 22 February 2011 01:06 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
sheldonlg wrote:
> On 2/21/2011 1:04 PM, Tim Streater wrote:
>> In article <iju7sd$9fc$1(at)news(dot)eternal-september(dot)org>,
>> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>>
>>> goto is NEVER needed, and SELDOM a good thing to use. It completely
>>> violates structured programming practices and causes more problems
>>> than it solves.
>>
>> By and large this is true. With one exception, I haven't used one since
>> 1978 when I stopped using FORTRAN.
>>
>> The exception was when doing some Pascal under RSX-11M. There was no
>> "return" statement, so I had to fake one up by putting a 999: label at
>> the end of any procedure where I wanted an early return, and then goto
>> 999.
>
> Again, why not if-then-else?
>
Because the nesting rapidly gets out of hand, and the 'what to do if its
NOT this' gets relegated to a bracket 5 pages further on completely
disconnected from the actual logical test that causes its invocation.


i.e.

if (condition == what we want)
{



15 pages of code all nested
}
else // condition wasn't what we wanted in this instance
{
do some other crap
}
// now bugger off back to momma


is about as unreadable as it gets.

MUCH better is

if(condition==borked)
return(borked flavour one);
...15 pages of code with no nesting that takes it of the right hand side
of the screen, or paper.

reversing the condition logic to simply make the 15 pages an else clause
dosent get rid of the nesting.

When the aeroplane is on fire, you don't want to have to reverse your
way out of the cockpit drill and flight plan. You just want to hit the
eject button and abort the mission.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Extralight browser-webserver communication via cookies (+)
Next Topic: Storing multiple character set types (or a representation of em) in a table column
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Jul 05 18:58:50 GMT 2024

Total time taken to generate the page: 0.04887 seconds