Many programmers have a hard time writing good unit-tests for code that involves time. For example, how do you test time-outs, or periodic clean-up jobs? I have seen many tests that create elaborate set-ups with lots of dependencies, or introduce real time gaps, just to be able to test those parts. However, if you structure the code the right way, much of the complexity disappears. Here is an example of a technique that lets you test time-related code with ease. Continue reading
When there is a problem with your software, the first thing you usually ask for is a log showing what happened (provided you write debuggable code), and the version of the software that was running. But it is easy to have the revision of the software automatically added to the log. Continue reading
A lot of code I come across consists of relatively few, but long, methods. The code does what it is supposed to do. However, it could be improved a lot. Refactoring to use more methods can produce better structured programs that are easier to understand, easier to modify, easier to test and easier to debug. Below are 7 reasons why using more methods can be a good idea.
I have read a couple of blog posts about LinkedIn recently. “Is LinkedIn Cheating Employers and Job Seekers Alike?” is criticizing LinkedIn for charging job seekers to appear “at the top of the list” when applying for a job. “LinkedIn Spam (?) and Recruiters: A Guide for Geeks” has some good advice on how to interact with recruiters on LinkedIn. These among others made me ponder the question: Is LinkedIn good or bad? (and Betteridge’s law notwithstanding, the answer is not “No”). Here is my take: Continue reading
All programs need some form of logging built in to them, so we can observe what it is doing. This is especially important when things go wrong. One of the differences between a great programmer and a bad programmer is that a great programmer adds logging and tools that make it easy to debug the program when things fail.
When the program works as expected, there is often no difference in the quality of the logging. However, as soon as the program fails, or you get the wrong result, you can almost immediately tell the good programmers from the bad. Continue reading
I recently got an e-mail from Michael Sherman, a teacher in New York. He had developed a variation of the card game Set called Complementary Pairs. This is how he described it:
“We have Set competitions at the school where I teach, both as individual time trials and as head-to-head matches. When many students at my school became capable of finding sets very quickly, I developed what I called C.P. Set (Complementary Pairs) to slow them down a bit and reduce the number of simultaneous calls in the head-to-head matches. The idea is to find two pairs of cards that both require the same 3rd card to complete a Set. The completing card does not need to be on the board; only the four cards forming the complementary pairs are picked up.” Continue reading
In my previous post on what programmers want, I ranked working from home low on the list. Several commenters value working from home higher, and K (not his real name) added a link to a great TED talk given by Jason Fried (of 37signals) on why it is hard to get any work done at work. Jason starts with the observation that programmers need long stretches of uninterrupted time in order to get stuff done, and goes on to recommend avoiding meetings, and minimizing interruptions by using chat and e-mail instead of direct communication. While I agree with the meetings part, I think there is more to consider regarding interruptions. I also value face to face interactions more than he does. Continue reading