Prevent Errors

Prevent Errors Error messages are the most critical interactions between the user and the rest of the system. They happen when communication between the user and the system is near breaking point. It is easy to think of an error as being caused by a wrong input from the user. But people make mistakes in predictable, systematic ways. So it is possible to ‘debug’ the communication between the user and the rest of the system just as you would between other system components.

Put Everything Under Version Control

Put Everything Under Version Control Put everything in all your projects under version control. The resources you need are there: free tools, like Subversion, Git, Mercurial, and CVS; plentiful disk space; cheap and powerful servers; ubiquitous networking; and even project-hosting services. After you’ve installed the version control software all you need in order to put your work in its repository is to issue the appropriate command in a clean directory containing your code.

Put the Mouse Down and Step Away from the Keyboard

Put the Mouse Down and Step Away from the Keyboard You’ve been focused for hours on some gnarly problem and there’s no solution in sight. So you get up to stretch your legs, or to hit the vending machines, and on the way back the answer suddenly becomes obvious. Does this scenario sound familiar? Ever wonder why it happens? The trick is that while you’re coding, the logical part of your brain is active and the creative side is shut out.

Read Code

Read Code We programmers are weird creatures. We love writing code. But when it comes to reading it we usually shy away. After all, writing code is so much more fun, and reading code is hard — sometimes almost impossible. Reading other people’s code is particularly hard. Not necessarily because other people’s code is bad, but because they probably think and solve problems in a different way to you. But did you ever consider that reading someone else’s code could improve your own?

Read the Humanities

Read the Humanities In all but the smallest development project people work with people. In all but the most abstracted field of research people write software for people to support them in some goal of theirs. People write software with people for people. It’s a people business. Unfortunately what is taught to programmers too often equips them very poorly to deal with people they work for and with. Luckily there is an entire field of study that can help.

Reinvent the Wheel Often

Reinvent the Wheel Often “Just use something that exists — it’s silly to reinvent the wheel…” Have you ever heard this or some variation thereof? Sure you have! Every developer and student probably hears comments like this frequently. Why though? Why is reinventing the wheel so frowned upon? Because, more often than not, existing code is working code. It has already gone through some sort of quality control, rigorous testing, and is being used successfully.

Resist the Temptation of the Singleton Pattern

Resist the Temptation of the Singleton Pattern The Singleton pattern solves many of your problems. You know that you only need a single instance. You have a guarantee that this instance is initialized before it’s used. It keeps your design simple by having a global access point. It’s all good. What’s not to like about this classic design pattern? Quite a lot, it turns out. Tempting they may be, but experience shows that most singletons really do more harm than good.

Simplicity Comes from Reduction

Simplicity Comes from Reduction “Do it again…,” my boss told me as his finger pressed hard on the delete key. I watched the computer screen with an all too familiar sinking feeling, as my code — line after line — disappeared into oblivion. My boss, Stefan, wasn’t always the most vocal of people, but he knew bad code when he saw it. And he knew exactly what to do with it.

Start from Yes

Start from Yes Recently I was at a grocery store searching high and low for “edamame” (which I only vaguely knew was some kind of a vegetable). I wasn’t sure whether this was something I’d find in the vegetable section, the frozen section, or in a can. I gave up and tracked down an employee to help me out. She didn’t know either! The employee could have responded in many different ways.

Step Back and Automate, Automate, Automate

Step Back and Automate, Automate, Automate I worked with programmers who, when asked to produce a count of the lines of code in a module, pasted the files into a word processor and used its “line count” feature. And they did it again next week. And the week after. It was bad. I worked on a project that had a cumbersome deployment process, involving code signing and moving the result to a server, requiring many mouse clicks.