Saturday, May 16, 2009

Do you really need to test that?

We all know Kent Beck. The co-creator of JUnit, one of the founding fathers of the Agile Manifesto, author of several eXtreme Programming books, just to highlight a few. Now that Kent has spent a decade telling us all to test everything... now he says, it is ok to skip testing.

I'll let that sink in a bit.

What he is basically saying is that it is ok for the kids to play in the street, if they feel that it is safe. Of course Kent is a big kid, so he will use his experience to determine if it is ok for him to play in the street. But what about the kids that don't know better? You know who they are. They are the kids that climb the tree without thinking about how they are going to get down. They are the kids that lock themselves in the closet without thinking about how they are going to get out.

Kids will be kids. They will make poor decisions if you give them the chance. That is why there are parents. Our job is to make sure that they don't make stupid decisions. Or perhaps we let them make bad decisions to teach them a lesson, just as long as we can control the environment to ensure that nobody gets seriously hurt.

So now is the time to decide if you are a the parent or a the kid. And if you think that you are the parent, half of you are probably wrong. That is the nature of the child, to think they know everything.

One way to measure if you are the parent or the kid is to use the Dreyfus Model of Skill Acquisition. If you follow Andy Hunt, you may have seen him speak and write about this. The model is basically a set of five stages that you progress through from novice to master. It helps explain why novices need lots of rules, and why experts don't think they apply to them.

On the Dreyful Model I often rank myself at a 4 1/2, depending on the subject matter of course. It can be an interesting exercise to rank yourself on the scale, then let your friends rank you to see if you meet your expectations of greatness. Likely you won't, but that is ok, it is in our nature to be overly self-confident.

Now back to testing. Is it really ok to skip testing? Kent thinks so, but I wonder if the followers of the TDD "faith" think the same. In many shops there is no ambiguity, there are only absolutes. You must test they say, but do you? Kent Beck thinks it is a judgment call.

Now I don't have the right answer other than there is no black and white, instead it is all gray. You should acknowledge that, and not immediately attack someone who says that they didn't write a test. Instead ask them their reasoning. Perhaps it is a good reason, perhaps not, but don't come to conclusions.

Wednesday, May 13, 2009

Software Craftsmanship

It has been a while since I sat down to write something, but that is because I have been caught up in learning. In March I presented at ETE in Philadelphia, and during my stay there I met a programming hippy Corey Haines. Corey was just like all of us, writing code for his day job, and like some of us enjoyed it. In December he lost his job, and with some money in the bank and a lot of free time decided to invest in himself. He began what became to be an adventure in pair programming, He now spends his days travelling the country, pair programming with anyone that will give him a place to stay and some code to work on. His journey is inspiring.

Now, this isn't a story about Corey, it is about software. In particular it is about good software. Corey, like many of us cares about the quality of his code. In his case he cares so much that he decided to pair with perfect strangers in order to increase his knowledge. While many of us can't afford to travel the country like Corey, or just find staying with strangers frightening, we find other ways to increase our knowledge.

So this is a story about writing good software. It is about craftsmanship. In December a manifesto was drafted. It was drafted by professional programmers that felt the Agile Manifesto didn't go far enough. They stated that working software was good, but well crafted software was better. That responding to change, while a virtue, isn't as good as steadily adding value. Out of this congress came the Software Craftsmanship Manifesto. It is a declaration of professionalism and quality, and I have put my name to it, along with thousands of others.

So what? So some coders put together a web page, called it a manifesto, and a bunch of other coders bought into it. I think it is more than that. I think our craft is changing, for the better. The best I have seen it described is in a presentation by Uncle Bob Martin. I recommend that you take a look, it is well worth the 60 minutes spend watching the video.

References:
http://www.infoq.com/presentations/craftmanship-ethics
http://www.infoq.com/news/2009/03/software_craftsmanship
http://manifesto.softwarecraftsmanship.org/
http://www.phillyemergingtech.com/
http://agilemanifesto.org/
http://www.coreyhaines.com/
http://en.wikipedia.org/wiki/Pair_programming