Best and Worst Coding Standards?
An anonymous reader writes "If you've been hired by a serious software development house, chances are one of your early familiarization tasks was to read company guidelines on coding standards and practices. You've probably been given some basic guidelines, such as gotos being off limits except in specific circumstances, or that code should be indented with tabs rather than spaces, or vice versa. Perhaps you've had some more exotic or less intuitive practices as well; maybe continue or multiple return statements were off-limits. What standards have you found worked well in practice, increasing code readability and maintainability? Which only looked good on paper?"
Sound an awful lot like coding in C... no bad coding practice needed...
Seven Days with Ubuntu Unity
First off, I'd suggest printing out a copy of the /. comments, and NOT read it. Burn them, it's a great symbolic gesture.
Why don't you just give them all giant Q-tips and play the Star Trek fight music every time they meet?
Surely that would be at least as productive as asking them to all agree on coding standards.
True - but at least it keeps thousands of otherwise dangerous PHP developers safely occupied.
Make it "cut and paste" friendly, and as small as possible.
Cut and paste causes code cloning, which is among the most difficult maintenance problems. Code should be designed, when possible, in small chunks (methods, functions, etc.).
Wait.. are you trying to say that copying the same lines of code over and over again must be avoided? So tell me genius, how else would you implement such a function without copying?
You just got troll'd!
I love abbreviations, not being native English speaker I used to think POS was "piece of shit" since its usually being used when talking about software (failed software).
(Or the always common "IANAL", well good for you buddy, but we are talking about legal issues here - the arse pounding is for when you get behind bars)
Yes I totally
agree,
It is
so much better to
put
a lot of vertical
space
between lines.
- These characters were randomly selected.
Duh, you so need to learn about this little thing called structured programming, which can totally help cut down on code duplication like that crap.
Here's a hint:
See? Much easier to understand than your spaghetti code, and much more maintainable too.
Messrs Kernighan and Ritchie and their no-necked associates would like to have a word with you out back.
I'm sorry, but that code goes against our coding standard by having non-const parameters and a goto. I suggest the following before submitting your changes:
-1, Dense
Try multiplying it by -1 and see if your stack is large enough.
Nah me neither... maybe it's a US thing? It's generally assumed that if you're a half decent programmer you'll follow what is already there and write clear concise code as much as possible.
One place I was in did try to come up with a coding standard, but it was abandoned as nobody could actually agree on much other than 'don't fuck it up'.
For one thing, they is grammatically plural.
--MarkusQ
When you copy code you also copy whatever bugs exist in that code. If something needs to be reused several times then it should be made into a function.
Crap, you're right! Fortunately there's an easy way to fix this :
:%s/x+=b/x = addition(x, b)/
You just got troll'd!
How about just x = a * b;
How about just WHOOOOOOSH!!
You just got troll'd!
YOU FORTH LOVE IF HONK THEN
Personally I write stuff like
if
(
a > b
)
{
doSomething();
}
else
{
zomg();
}
Then I charge the client 5 * the number of lines in a all source and header files.
"Ubuntu" -- an African word, meaning "Slackware is too hard for me". - stolen from Dan C alt.os.linux.slackware