1. [OFFTOPIC] CompSci class question
- Posted by budmeister1 at JUNO.COM Nov 14, 2000
- 491 views
Hi all, This semester at college, I'm in a CS210 class that teaches C. My prof is of the opinion that using break and continue in code is evil. However, I've been in situations where using break and continue is the cleanest way to code it. What do ya'll think? Btw, apologies for the offtopic post ;) ----->Buddy budmeister1 at juno.com http://tenbux.iwarp.com/
2. Re: [OFFTOPIC] CompSci class question
- Posted by Ken Roger <kennethroger at PRODIGY.NET> Nov 14, 2000
- 418 views
Buddy writes (with apologies)-- "My prof is of the opinion that using break and continue in code is evil. However, I've been in situations where using break and continue is the cleanest way to code it. What do ya'll think?" I think your prof is evil. I'd like to see her make a cpu that doesn't need a jump instruction. --Ken (with apologies)
3. Re: [OFFTOPIC] CompSci class question
- Posted by Kat <gertie at PELL.NET> Nov 14, 2000
- 424 views
On 14 Nov 2000, at 14:53, Ken Roger wrote: > Buddy writes (with apologies)-- > "My prof is of the opinion that using break and continue in code is evil. > However, I've been in situations where using break and continue is the > cleanest way to code it. What do ya'll think?" > > I think your prof is evil. I'd like to see her make a cpu that doesn't need a > jump instruction. if ( acc == 12 ) then load address register 34123 Kat
4. Re: [OFFTOPIC] CompSci class question
- Posted by simulat <simulat at INTERGATE.CA> Nov 14, 2000
- 414 views
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 >
5. Re: [OFFTOPIC] CompSci class question
- Posted by Kat <gertie at PELL.NET> Nov 14, 2000
- 438 views
- Last edited Nov 15, 2000
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
6. Re: [OFFTOPIC] CompSci class question
- Posted by Irv <irv at ELLIJAY.COM> Nov 14, 2000
- 433 views
- Last edited Nov 15, 2000
From: <budmeister1 at JUNO.COM> > Hi all, > > This semester at college, I'm in a CS210 class that teaches C. My > prof is of the opinion that using break and continue in code is > evil. However, I've been in situations where using break and continue > is the cleanest way to code it. What do ya'll think? > > Btw, apologies for the offtopic post ;) Seeing that C is itself the greater evil, casting out break and continue would be like criticizing Satan's table manners. Irv
7. Re: [OFFTOPIC] CompSci class question
- Posted by George Henry <ghenryca at HOTMAIL.COM> Nov 15, 2000
- 429 views
In the absence of better exception-handling facilities, I used to use setjmp/longjmp in C for that purpose *all the time*, in fact at my shop we had a "structured" error-handling facility that was programmed using those functions. So the argument could be made (in the absence of better exception-handling), for the "non-local goto" of the setjmp/longjmp variety. There are those who argue that it's hard to read / follow / understand code using setjmp/longjmp. I found them no more "scary" or "obfuscating" than (for example) recursion. I am not arguing FOR goto. In general, I prefer to program without goto or its "evil cousins", but there are cases where I find something like "exit" preferable to the alternatives. And I appreciate built-in exception handling. There are often cases where I want to do something in between continuing to execute local code and terminating my program. George ----Original Message Follows---- From: Kat <gertie at PELL.NET> Granted, the goto in Eu should be restricted to the scope of the procedure, function, or the main that it is used in. Kat _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.
8. Re: [OFFTOPIC] CompSci class question
- Posted by mic _ <stabmaster_ at HOTMAIL.COM> Nov 15, 2000
- 409 views
In the Ada-class I'm taking, they try to convince us that using "exit" is sloppy coding.. My_loop: while (condition) loop if time_to_split then exit My_loop; end if; end loop; sloppy, eh? damn those proffessors, think they're smart or something :) _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.