tags:

views:

606

answers:

12

Inspired by What’s your favorite “abandoned rule”? What is the number 1 "rule" you know you should follow, but don't?

+4  A: 

Document your code.

Jeff Hillman
+4  A: 

See my original answer.

Write tests early and often.

jjnguy
A: 

Plan and document before you start coding.

AdamB
+14  A: 

Go to bed before midnight, not siting behind monitor for "15 more minutes".

dimarzionist
Damn Crackoverflow ensures you never go to bed before midnight.
derobert
A: 

don't duplicate questions which already exist.

shoosh
Not duplicated, this a different question (albeit, only slightly). The original was rules that shouldn't be followed, this one is rules that should be followed, but aren't for any of a cariety of reasons.
Matthew Scharley
A: 

My professor preached functions with single entry point and single exit points.. this saved my life a lot of times. But every now and then I slip in return statements in the middle of the function definition rather than refactoring the code around it.

Sridhar Iyer
IMHO this is fine for short functions. For me it works out this way more often in Java than in C. A method can be 5 lines long, or double that if you refactor it to avoid having multiple return statements.
slim
+2  A: 

When I consider the code on my project, including some of my code...

Code as if the person who ends up maintaining your code is a dangerous psychopath who knows where you live

VonC
From http://stackoverflow.com/questions/58640/great-programming-quotes#61375 (Damian Conway from the book Perl Best Practices)
VonC
+1  A: 

The most common ones which i break all the time :

  • Do not use "Select * from " on the database

  • Get a code review done before committing to the SVN (naughty!)

+2  A: 

Don't take prototype / proof-of-concept code into production. (Now that I think about, Jeff Atwood had a blog entry on this: The Prototype Pitfall). That said, a ground up rewrite v2 frequently happens if the code is important enough.

Stu Thompson
+1  A: 

Keep the original estimation and compare it with the actual schedule after the project is done.

grigy
+2  A: 
MrValdez
With coding, frequently I think procrastination is a virtue, not a fault! I do better if I have time to mull a project over a while than if I have to jump straight into it...
Stu Thompson
+4  A: 

Back up everything, and often.

metao