Re: [stella] OT: Programming, CS theory

Subject: Re: [stella] OT: Programming, CS theory
From: Greg Miller <gmiller@xxxxxxxxxxxxxxxxx>
Date: Thu, 25 Oct 2001 18:50:13 -0500
Glenn Saunders wrote:


for(++i;i<lseek(fp)) {i+=lseek(fp+i)};
<<

I hate this crap.

When I code I always go vertical.

if (a)
{
 b = 1;
}
else
{
 b = 2;
}

I always use the brackets. I never used any sort of compacted syntax. I find it much more readable the long way.


Some people mistakenly assume that fewer lines of source code somehow result in smaller, faster programs. Such people tend to use "?" in preference to "if" for reasons of superstition.


I also have a style in my CF that I don't know whether it's good or bad practice in general CS theory, but I make a lot of use of true/false variables which allows me to help spread out code instead of nesting conditionals. Oftentimes when you heavily nest conditionals you'll have to duplicate code blocks (including more conditional logic with them) depending on the program flow. So by not duplicating the code as much the sourcecode gets smaller and it's easier to maintain.


This is a frequent source of stylistic argument, because there simply isn't a universal optimal way of handling it. Nested ifs, booleans, goto statements, exceptions, multiple returns, and separate functions are all apropriate in different cases. The graduate students teaching introductory CS classes tend to go for booleans or nested ifs in most cases.
--
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