Subject: Re: [stella] OT: Programming, CS theory From: Greg Miller <gmiller@xxxxxxxxxxxxxxxxx> Date: Thu, 25 Oct 2001 17:55:37 -0500 |
I have a CS degree, and I have found a great deal of difference between what works "in theory", and what works in practice:
THEORY: Recursion is great! PRACTICE: Recursion wastes memory and assumes that the compiler's garbage collector is 100% flawless, which is rarely the case
THEORY: Avoid the use of global variables, only use local variables! PRACTICE: Using locals results in having to pass parameters by reference, and uses more stack space, and results in more variable declarations, thus increasing possibilities of incorrectly declared variables. In fact, most game programming books tell you to use globals and avoid locals!
THEORY: Never use GOTO statements! PRACTICE: Avoiding GOTOs sometimes results in nested IF statements that are 200 lines long, which are a pain to debug
THEORY: Inheritance is great, make one change, and it cascades down to its child members! PRACTICE: Sometimes the child becomes so specialized its better off on its own, and trying to "divorce" a child from its parents most often results in the entire child object having to be re-created from scratch...and in actual developmental practice, Inheritance is only marginally better than copy-and-paste
THEORY: You can combine several statements together, like for(++i;i<lseek(fp)) {i+=lseek(fp+i)};
PRACTICE: This makes it impossible for other programmers to decipher your
work, and causes the compiler to generate code which is not easily
digestible by the CPU's execution units. Most game programming books tell
you to program in a RISC-like manner to maximize the CPU instruction
execution pipelines
-- http://www.classic-games.com/ http://www.indie-games.com/ There is no peaceful solution to organized terrorist networks.
- 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, Ben Larson |
RE: [stella] 6507 opcode cycle tabl, Nicolás Olhaberry | Date | Re: [stella] Stelladoc v2 status re, TwoHeaded Software |
Month |