Subject: Re: [stella] OT: Programming, CS theory From: Thomas Jentzsch <tjentzsch@xxxxxx> Date: Fri, 26 Oct 2001 19:39:30 +0100 |
Richard Kennehan wrote: > That assignment pointlessly emphasized the importance of recursion, to the > point of teaching us that it should be used more often that it actually > should be. A MUCH better assignment would have been this: > An evil computer programmer has used recursion in order to make his code so > hard to read and understand, that only he can understand it, thus preventing > him from ever getting fired. However, the company decided to fire him when > another programmer discovered his evil plan. As a newly hired programmer, > it is your job to CONVERT his recursive mess into an iterative solution that > is easy for other programmers to understand and maintain. > This would teach students how recursion works, AND how to convert it to an > iterative solution, AND teach good coding style, AND teach a lesson about > how trying to engineer your own job security makes life harder for the > person who will eventually replace you. STOP!!! Please! I've been quiet until now, since I think, there is no wrong or right coding style. It also depends on the individual preferences. Humans are different, they don't fit into a strict schema. But now you are starting to tell us, that *you* know what's right or wrong. And everybody that doesn't follow your preferences is coding bad (or an evil programmer). That's pure arrogance! I know this is harsh, but I had to say it that way. *I* can think in recursions very easy. For *me* i.E. the Quicksort algorithm is much easier to understand in it's recursive form than the iterative one. Traversing through a tree is much easier done with recursion too. *I* like it, and it works for me. So don't call it bad, only because *you* have problems thinking in recursions. For me it's often the much more natural solution. And I like to use ? too. It makes the code compact and *easier* to read for *me*. I can concentrate on the main thing and don't have to scroll up and down over those (sometimes annoying) { and } lines. And I learned, that a function with more than 100 lines of code (not counting {} here) is bad coding style and should be broken into smaller pieces. And I agree 100%. I have never used GOTO again after I went from C64-Basic to Pascal and later C++. It's simply unnecessary and may (and often will!) lead to spaghetti code. I won't answer all your "Like what? Example please!" questions, because I'm afraid this is getting into a flame war. BTW: Aren't there any better groups to discuss this topic? Have fun! Thomas _______________________________________________________ Thomas Jentzsch | *** Every bit is sacred ! *** tjentzsch at web dot de | - Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] OT: Programming, CS th, Kennehan, Richard | Thread | Re: [stella] OT: Programming, CS th, Julian Squires |
Re: [stella] OT: Programming, CS th, Kennehan, Richard | Date | Re: [stella] OT: Programming, CS th, Julian Squires |
Month |