Blogs and programming websites


Writing maintainable code

  • Write it for other people to read. This means a combination of good names, good comments, and simple statements. Once upon a time memory was scarce and cycles times were slow; programmers were encouraged to write complex single lines of code that did many things. Today memory is plentiful and cycle times are fast. You should write 5 lines of simple code people can follow instead of one line they cannot understand.
  • There is a tendency to write code thinking that the computer is your audience. Strictly speaking, that’s true since the code does have to work. But if you write with your human audience in mind, just that mindset helps to produce more readable code. If you’re worried that that will produce slow code, keep in mind that the most programs almost all of their time in very small portions of code. Start out writing for readability, then use a profiler to identify the right sections to optimize.
  • Separation of Concerns (each method does one thing). The key to maintainability is being able to quickly figure out what the code is doing and how to make changes in order to accomplish a task. Having the code separated out so that each task is handled by a method dedicated to it makes this a snap. It’s always better to have many methods and many classes, rather one big method in one class.

Programming principles

  • DRY = Don’t Repeat Yourself
  • KISS = Keep It Simple, Stupid
  • YAGNI = You Aren’t Gonna Need It
  • SSCCE = Short, Self Contained, Correct (Compilable), Example

15 ways to be a better programmer

  1. Read other developers’ code
  2. Get other developers to read your code
  3. Fix existing bugs before writing new code
  4. Fix, don’t just “work around”
  5. Test your code properly
  6. Don’t be afraid to break things
  7. Keep things simple
  8. Spend more time in analyzing the problem
  9. Help others to solve their problems
  10. Review the basics of computer science and your programming language specific concepts
  11. Keep up with current technologies
  12. Blog about your work
  13. Participate in open source projects
  14. Use a tenkeyless mechanical keyboard
  15. Learn touch typing

Favorite quotes from favorite computer scientists

  • Edsger W. Dijkstra
    • Testing shows the presence, not the absence of bugs
    • If you want more effective programmers, you will discover that they should not waste their time debugging, they should not introduce the bugs to start with
    • Besides a mathematical inclination, an exceptionally good mastery of one’s native tongue is the most vital asset of a competent programmer
    • Simplicity is prerequisite for reliability
  • The programmers of tomorrow are the wizards of the future: