To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 21661
21660  |  21662
Subject: 
Re: Are there GOTO statements in NQC?
Newsgroups: 
lugnet.robotics
Date: 
Fri, 21 Nov 2003 01:00:23 GMT
Viewed: 
888 times
  
As a computer science software engineer i work since 1984.

My university studies before (Hamburg, Germany) taught me, that science had
proved: any program using a goto statement can easily be transformed into a
structured program. Remember, that this is scientifical proved!

What is the paradigm of a structured program? A structured program is a list of
commands, using no goto. Having one point of comands to go into and only one
poit to go out off.  We usualy call that an algorithm. It is about formulating a
problem in a structured computer language: if you reduce your vocabulary to the
possibilities of your high level computer language, you formulate your problem
as its own solution. This is not possible, if you use goto.

You need very experience to do so. So with this in mind, you should allways try
to find the correct structured solution without goto.

Let me tell you a little bit more about structured programming. The purpose of
structured programming is, to avoid eccessive use of goto, which makes the code
quite unreadable. Of course, a single goto might be ok. But if you want to reach
the high scills a programmer could get, you should demontrate the world, you
dont need a goto.

And it can easily be done. Any construction using a goto can similary be repaced
by a construction using a flag. With this in mind, you can do it.

So structured programs consist of commands, sequences of commands, blocks of
sequences of commands and of 5 structured commands: if, case, for, while, repeat
(in a pascal sense). All other c code is not so good, while - of couse - c
offers the same opportunities.

If you want to write a structured program, you need to understand algorithms in
a pascal sense.

It means, reducing your possibilities to express the problem by reducing
yourself to the vocabulary and expressions of a structured language.

I hope, you all are on the best way to be a good programmer!

It remains a fatal error abort condition goto in mind. If the language is able
to handle this across subroutines or methods of an object, this is the only
legal purpose to use a goto.

The creator of pascal, Nicolaus Wirth, stated: a goto is only nessesary to exit
a program (from its subroutines in the middle) to perform a fatal abort.

So today programming languages implement error exceptions to do this.

greetings
Ralph



Message has 1 Reply:
  Re: Are there GOTO statements in NQC?
 
(...) I've been coding since about '81, too. Big deal. (...) Well, yes, by transforming it into a while loop with a state variable representing what would otherwise be the execution counter. While this is a provable transformation, it doesn't (...) (21 years ago, 21-Nov-03, to lugnet.robotics)

3 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR