About GOTO (was RE: fixed windows)

new topic     » topic index » view thread      » older message » newer message

Well.....

   I like to add a bit more perspective to the "goto" discussion
   and specifically why I said that planning in software design
   makes it unneeded.

   First of all, in Lineair languages (that execute their code
   in a straight top-down manner), goto is the only way to have
   conditional code. But in that case there is no problem with
   using goto because it is only used to step over unused conditions.

jbrown105 at speedymail.org wrote:
 
> The idea of not having goto support, is to replace it with better 
> controlled
> and restricted "goto"s which prevent the unreadablility. Whether or not 
> this
> is a good thing depends on the skill of the programmer, the level of 
> difficulty
> of the language overall (i.e. if its asm code then a goto or jmp isnt 
> gonna
> make it that much more unreadable), and personal opinion.

   jbrown does a fair job of explaining here and I like to add some
   more information:

   The problem with goto is that it does not force you to think about
   what you are going to do next, that is after you have used that
   goto. The goto statement is known for encouraging quick and dirty
   programming and is almost always used in ad hoc programming.
   Besides that, goto goes against any form of structured
   modularization of code. This is one of the main reasons why
   N. Wirth omitted goto in Pascal and many languages have followed
   that omission.

   The point that I was trying to make is that a little planning
   before you actual start coding goes a long way in building
   understandable and maintainable code. The first program I wrote
   myself was a CAD-program. It had grids with locking, a full
   windowed interface with mouse control and pulldown menus, symbol
   libraries, mathematic functions and much more. It was written on 
   a MSX2 machine and crammed into 24 Kb basic. The only way to
   develop such a program in so little space was to plan and develop
   it largely before any coding took place. Obviously I didn't use
   any goto statements.

   I'm not saying that goto is evil (although every informatics
   teacher will tell you) but the availability of a goto command
   generally does more bad than good, so there is a reason why many
   languages don't implement it.

   On a side note: if anyone is interested in stuff like Cleanroom
   Software Engineering, Software Quality Assurance, the Capability
   Maturity Model, etc. let me know blink

Hans Peter Willems

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu