Archive for January, 2010

A Week in Nowhere for Better Code?

Posted in Uncategorized on January 14th, 2010 by Aviv Ben-Yosef – 1 Comment

I finished my army service (in the Israel Defence Force) 6 months ago. Before anyone gets carried away, let me assure you my service had no Rambo-like scenes involved, but simply required me to do what I always do – code.

But, it being an army and everything, everyone is required to do some “army” stuff every once in a while. One of those is at the heart of this post. About once a year, you’d get positioned in some far, remote and tiny base/settlement. During those weeks you are required to guard different posts, or patrol around the perimiter of the area.

Let me paint you the picture a little clearer. How would you like having to leave your life, in order to spend a week (or two) in a place that can be only regarded as ‘nowhere’, and spend 10 hours a day doing nothing but looking at some desert mountains? Now, imagine you know no one of the other few that are with you, the room is a dump, and you don’t even want to hear about the showers? Oh, it gets better. At night the temprature can drop so much, that checking your weapon before going to sleep is just painful, and requires you to jiggle your fingers for 5 minutes before you get enough dexterity to actually do it?

The view from nowhere

The view from nowhere

The real deal, though, is that I find myself missing those weeks, a bit at least. Why would a geek think about a week with no keyboard, and actually just about zero contact with the outside world given that cell reception is scarse, and miss it? Well, that’s just the point!

First of all, as any good geek, I stack a lot of books on my To Read List. Those weeks were where I did my most productive reading. I averaged a book a day, which required me to get an extra bag just for those. Can a week be really bad if you go to read all of The Hitchhiker’s Guide to the Galaxy series, The Return of the King and more?

But that’s just a bonus, I read a lot either way. The main thing is that you just get time off that you don’t consider to be your free time / vacation. I’ll explain. When you use your few vacation days, you use them wisely. You take your spouse abroad and enjoy the world’s wonders. Any part of a day off I just lay around feels like a waste to me, which doesn’t let me just use the days off to relax.

The problem is, that coders need time to zoom-out sometimes, in order to get new ideas. It was said before that if you’re stuck with a problem, you might get the insight by simply leaving your desk for a few minutes. But those insights are short-sighted. As you sling code, week after week, you get coder’s myopia. Every time I was sent away, I came back with a few ideas to make things better, or do things in a more productive way. It’s just amazing how simply stepping back for a week can help you realize problems you haven’t been able to grasp for months.

Now, unsurprisingly, the vacation days you use never seem to have the same effect. Don’t get me wrong, I’m not suggesting you find your solitude in some desert with no cell reception (unless that’s your cup of tea). I think employers will gain by making sure they’re employees have 4 weeks of vacation a year, so that spending 2 days playing video games won’t feel like a waste. I think sending teams together on a trip for a few days won’t be as good as sending them to a conference where they will see new people and new opinions and ideas. The key here is not just the change of scenery, but also simply experiencing something different.

Try to find a chance to zoom out and unwind, I bet it will do good to you and your team.

You should follow me on twitter.

Every Coder Should Read TDD By Example

Posted in Programming on January 12th, 2010 by Aviv Ben-Yosef – 3 Comments

I’ve just finished reading Kent Beck’s TDD by Example, and man, what a great reading that was. It was so good, I’m gonna put it in my top 10 books list (accompanied by other classics, like The Pragmatic Programmer and Beck’s probably most known book, Extreme Programming Explained).

I’ve been doing TDD (to an extent, say at least half of my production code) for the past 4 years or so. I was pretty sure I knew what the deal is, and there’s no doubt it’s paying off. I didn’t think there’s a lot more for me to learn. I thought to myself, “how much better can it get?”

Lately, a lot of anti-TDD posts have been popping up on the interweb, which made me ponder a bit more about it. Furthermore, I’ve been exposed to more casts and the likes regarding TDD that made me think I just might be able to squeeze some more fun from my TDD.

That’s when I realized my work place has a copy of the “TDD by Example” book. I’m a sucker for books, and having liked Kent’s writing so far, decided to add it to my book queue, and actually pushed it all the way to the top.

It’s a very light and fun reading. The style is a lot to my taste, and easy to follow (even for someone whose mother tongue isn’t English). But other than the pure writing style, there are just so many gold nuggets in that book. Just about every page has something golden.

Most coders will never have access to such a super-star-coder, that literally changed the way we work. This book is a great way to rub off some of that genius. The simplicity in which design decisions are explained is astonishing. I myself typed along all the code in the book as I read it. Sometimes I tried writing ahead, comparing my results to Kent’s, and every time I was surprised. The cleanliness he shows, the delicate thinking, truly amazing stuff.

Other than that, given all the critisicm that’s been direct at TDD lately, the book explains in great detail what are TDD’s objectives, how it can be used productively, and what should you expect of it.

And now, the really good stuff. The major pay-off I’m seeing currently, is that I found out a few ways to make TDD even better for me. Yes, the bug count is already low, but you can get it even lower. Not just that, picking up a few tips from Beck makes me think about the design of my code better, and simply make you a better coder.

Actually, most of my TDD ”education” is informal. Someone once explained the concept to me, and with time I refined my ways a bit using experience gained and knowledge found on the web. Reading the book on TDD, you find there are names for things you’ve already been doing, but never given much thought to. Moreover, there’s just that thing about naming things – sometimes it simply makes you understand them better.

I think I’ll stop writing any further, before this will make me look like I’m stalking Beck. But really, you should read this book. It’s so good, I’m going to order my own copy simply to have it around. Yes, that good.

You should follow me on twitter here.