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 #172600 is a reply to message #172590] Tue, 22 February 2011 03:16 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 8:15 PM, The Natural Philosopher wrote:
>> Peter H. Coffin wrote:
>>> On Mon, 21 Feb 2011 18:50:39 +0000, Tim Streater wrote:
>>>> Because of the incredible convolution and depth of nested
>>>> if/then/else you can get to. If I have (as it might be) a function
>>>> that's scanning a string looking for and obtaining options and their
>>>> values for some command previously scanned off the string, and I
>>>> detect an error, I want to set an error code and exit right there. I
>>>> don't want any subsequent maintainer to have to intuit that, in fact,
>>>> from this point on nested 15-deep in else clauses, no more code is
>>>> executed for that path through the function.
>>>>
>>>> That way I rarely get more than 3-deep in if/then/else. To me, it's
>>>> all about readbility.
>>>
>>> *grin* for me, it's all about comprehesibility. If you don't like how
>>> deep you're nesting, maybe you need to break something out into a
>>> function instead....
>>>
>> Yes, but how much stack do you have? Can you afford the overhead of a
>> call/return? How much does splitting a whole block of code to four pages
>> away make the comprehensibility problem worse, not better?
>
> If you have fifteen pages of code within a success bracket, then you are
> at least 8-10 times too big in the routine. It should be broken into
> smaller segments.

'Should' and 'can' are often not the same thing.
And a lot depends on the size of your page: remember when 80x25 was all
you had?

four pages is ONLY 100 lines.

Or if you were lucky in your fan fold, 320 lines or so. IIRC, Which I
probably don't.


I know that that when I have a piece of code that is
> getting lengthy, I either put some of it in functions, or I make a more
> liberal use of include files and put blocks of code in include files. It
> makes it MUCH more readable and maintainable that way.
>

I think that people today have habits derived from a lot of tools and
large screens that didn't exist when I learnt to program.


> -
> Shelly
[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:31:22 GMT 2024

Total time taken to generate the page: 0.05245 seconds