Re: [OFFTOPIC] CompSci class question
- Posted by Kat <gertie at PELL.NET> Nov 14, 2000
- 438 views
On 14 Nov 2000, at 18:13, simulat wrote: > Here's my 2 cents worth > Assuming that a break and continue is like a goto - I'd say it's really > handy sometimes, but a bad habit in general. It's not that jumps like that are > a bad way to get something done, it's that it's a bad way to think about your > problem. It tempts you to define what you're doing from the wrong perspective. > > Maybe using jumps is related to the problem of using flow charts. It makes you > think of the program as a bunch of parts that are assembled to make a machine > that does something. The advance with structural programming was to start > thinking of a program as a logical structure - more like a statement than a > machine. I think that probably "structured programming", with its modularity > leading all the way to OOP was found to be a far more powerful way of writing > code than the older languages. It did mean that you basically had to forget > about jumps though. Bye Martin > > Tht's fine if you already have an object, and the machine code under it. But what if you need milk, and go to the store and they are out of milk? Do you goto another store(), or redefine milk()? No matter what you call it, "calling a procedure", "executing a method", or "instanicating an object", the machine code does a goto or a gosub. There is not a good reason, imho, for not propagating the command up into the higher level language. We have the equivalent of all the other basic machine code commands in the higher level languages. A goto command can eliminate the need to "break", "continue", "next", "case", etc, and repeated tests on flag variables. Granted, the goto in Eu should be restricted to the scope of the procedure, function, or the main that it is used in. Kat