On Tue, 2003-12-09 at 08:14, Bogdan Stancescu wrote: > > Robert, I know your grief, been there, I know how it feels. I started my > childhood with BASIC, which was /the/ "GOTO" programming language, > learned Turbo Pascal when I was a teenager, and continued to use GOTO's > (Pascal discourages but doesn't disallow GOTO's, so I was still able to > "cheat" when "there was a need for it"). Well, later on when I started > finding out how major projects are being developed, what structured > programming really means and so on, I felt the way you feel now: > cheated. "Why in God's name is GOTO bad? It's SO useful! They're mad!" > Well, it simply isn't true -- the problem is that you have to change > your mindset about programming, try to really structure the way you see > a program, break it into efficient stand-alone functions, group those in > classes, etc, and you'll see that there *is* no need for GOTO, ever. You > do need to break out of loops, you do need to "short" a loop when a > condition is met, you do need to break out of switches, if branches and > the lot - but those tools you have in PHP. GOTO is not needed and > harmful. Even simply learning to program without GOTO will coerce you > into saner code. > > Sorry if my message sounded melodramatic or something, I remembered the > frustration feeling so strongly from your message that I wanted to > reinforce the other people's messages with a personal "testimonial" if > you wish.
Ummmm, I rarely use the goto statement, and I do not advocate it for regular everyday coding. I do know the difference between well structured code and otherwise. What I did say, is that goto <label> has it's uses, and sometimes it IS the best solution. Just because someone tells you something is bad, doesn't mean to say it is always bad. It's like someone saying salt is bad for you, and so you never take salt again and die from salt deficiency. People really need to change their mindset about being sheeple (yes sheep people) and blindly following preached dogma. I don't mind your message sounding melodramatic, but it doesn't explain in any way why goto shouldn't be used. It just asserts that you found out how major projects are done, which IMHO doesn't lend support to why one shouldn't use the goto statement. In actual fact it makes me think you are missing a few points. For instance properly structured programming is often about the functions, objects, and methods, not about the code within a function that performs the logic. For this reason the use of goto statements within a given function that facilitates faster cleaner code is sometimes the best solution not to mention its contents can be considered a black box by the user of the function. Also your response seems to indicate that you think I am a newbie coder, well that would be a bit of an oversight. I've been coding for over 10 years (some hobby, some academic, and some professional) using many different styles (functional, procedural, and OOP) and so I am plenty aware of design paradigms, re-usability, and clarity. I also have extensive experience refactoring old spaghetti code. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php