View source for Rules for Good Code

1. Use Problem-driven Development

  Identify the next single smallest problem you want to fix. Write the simplest plausible solution, and test it. Your commit message states the problem, and then your solution. If there is a single change you make to how you code, please, this one. Don't make features. Solve problems.

2. Make it Open Source

  Not eventually. Not when it's working. Not if you get management approval. Now, today, before it's finished. Before you even decide what you're making. Before your first commit, even. Open source means people, and that means voices to guide you to solving the right problems.

3. Always Be Making APIs

  Write every piece of code as the body of an API. Be generous with new repositories. Layer your projects like you're making lasagna. Document your APIs, use them, publish them.

4. Don't Document the Code

  Documenting code is like writing "Tasty!" on the side of a coffee cup. If the code isn't readable on a grey Monday morning before coffee, chuck it out and start again. What you document are APIs, so that can mean methods and classes. That is fine. Explaining what this funky loop does is not fine.

5. Style for Readability

  You do need a style guide. And it must be strict. All that matters is readability. Collect patterns that work in your language. Document them, improve them, and make sure the entire codebase conforms. Do not use automatic reformatters, as they hide mischief. A good style is worth applying by hand.

6. Better is the Enemy of the Good

  We already know this yet it's worth repeating. Do not optimize your code. Aim for "OK" and then stop. If you are following rule #1 then slow performance will pop up as a juicy problem somewhere down the line. It will always, always, be in a place you never thought of.

7. Use Your Own Work

  It's shocking how many programmers don't use their own work. Then they have the arrogance to lecture users about "what they really need." Look, if I brew beer and make pizza, then I'm damn well going to sit at my table. Good Code is so delicious you can't resist it.

--
source: http://hintjens.com/blog:96