MLUG: [MLUG] Quick programming question on style
[MLUG] Quick programming question on style
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Had to drop an email and ask about this.

If you, as a programmer, see something like the following - is it bad, good, "spaghetti", ignore it, or what?


----------

if (mydate.save())
{
}else {
}
-----------

and I do mean the above literally.  NOTHING inside of the if statement, just the if statement running a method.  Thoughts on this?
And, here's another style question:  the { on a newline after a statement or the end of the previous line.  For example:

if (testcase == 1) {

or

if (testcase == 1)
{

which is better.  I learned on the second example, and I find it clearer to understand.  However, Java for example uses the first example HEAVILY.  Thoughts/opinions?  Mostly I guess, is the first example an entirely Java thing, or did C ever use style like that?

Jason

/--------------------------------------|---------------------------\

| Jason McIntosh                       | CELL: 573-424-7612        |

| Webmaster, thinker, Programmer, etc. | WORK: 573-884-3865        |

| http://poetshome.com/                |                           |

|------------------------------------------------------------------|

|"How should I know if it works?  That's what beta testers are     |

|for.  I only coded it."                                           |

|(Attributed to Linus Torvalds, somewhere in a posting)            |

\--------------------------------------|---------------------------/

GnuPG Key:  http://poetshome.com/about/jmcintosh_mlug.missouri.edu.gpgkey


_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members