You obviously haven't worked on big projects with 20-50 programmers
working for 1-3 years. Or had to go back and make a change to a program
with 10K+ LOC that isn't well structured. It can be a huge problem.
> Structured programming
>> does not make code less readable, if it's done properly. And it does
>> make the code more maintainable. You don't have to, for instance, try
>> to analyze a bunch of code to determine why your change did not take
>> effect - because you had already exited the code earlier.
>
> That totally depends on the place where the exit() is used.
> I often have a bunch of these to process different kinds of situations:
>
> if (whatever){
> dostuff();
> header("location: ....");
> exit;
> }
>
> if (whatever2){
> dostuff2();
> header("location: ....");
> exit;
> }
>
> If you would read through that code, you would surely find the exits
> right away, I am sure.
>
> But, of course, when the exit() is hidden somewhere horribly deep away,
> in a totally idiotic place, then yes, that would be a problem.
>
> In my opinion that is matter of programming hygiene.
>
Yup, and along the same lines:
if (whatever) {
dostuff();
header("location: ....");
} elseif (whatever2) {
dostuff();
header("location: ....");
}
Clear, concise, and no exit() required
>
>>
>> I've just seen too many problems in other languages such as C/C++ caused
>> by people not wanting to structure their code properly with if-then-else
>> statements - and the problems it can cause.
>>
>
> Well, yes.
> C/C++ is really a different beast.
> I use PHP for a reason: ease of programming in a forgiving environment
> (type juggling, no memory allocation, strong array structure/functions,
> etc).
>
It's a different beast - but it's still the same structured programming
concepts. PHP obviously took much of its syntax from C. And structured
programming has nothing to do with type juggling, memory allocation, etc.
> It is, of course, possible to screw up royally in any language.
>
> I think I heard that line first from you when I entered usenet, a
> hundred years ago. :-)
>
> Regards,
> Erwin Moller
>
Could be. I've seen a lot of screw-ups in my decades of programming.
And not all were from newbies. Some were from people who should know
better.