Archive for October, 2009

Using Singletons is evil

Friday, October 16th, 2009

BalrogThis week I joined on a new project. When I wanted to change some class, I encountered a singleton that kept me from writing good test cases without jumping through some hoops.

This annoyed me, but then I wondered…”Why have I never used a singleton?” I am aware of the GoF patterns and value their use. Sometime I use them as a solution and sometimes they emerge while refactoring. In my opinion their greatest value is they provide a means of communication.

After some research my conclusion is that of many others: If you are tempted to use a singleton: DON’T. When you cannot come up with a different solution: Google for it or discuss your problem with some colleagues. When the best solution still is a singleton:  Let me know.

The problems with the singleton are summed very well in This post from Scott Denssmore:

  1. They are mostly used as a global static.
    (We agreed these are bad right?)
  2. They allow you to limit the creation of your objects
    (This is not the responsibility of the class)
  3. They promote tight coupling
    (While we strive for low coupling, tight cohesion)
  4. They carry state the entire lifetime of the program.
    (Object state is the source of very annoying bugs)

The singleton I encountered suffers from problem 1,3,4. Time allowing I will gradually factor out this beast that is littered throughout the entire application. But this will require some negotiation with the rest of the team.

To provide some perspective I suggest also reading the comments and the following response from Matt Berther: Singletons are not evil. I have to agree with him. The singletons pattern is not evil, it is just a pattern. But I do think using singletons is, thus my conclusion is that ’a good singleton’ is an oxymoron.

The quest for better presentations

Thursday, October 8th, 2009

Boring presentation

Did you ever get bored or distracted during yet another presentation? Maybe you even fell asleep? I know I have. What’s even worse: people are so used to bad bullet-point infested slide shows this has become some kind of  standard.

The problem with these presentations is that the words get lost between the bullet points. With a lot of good intentions someone is delivering a message, but no one remembers it. In terms of lean manufacturing, such a presentation can be classified as waste. Waste for the presenter, because his message did not arrive. And obviously it was a waste of time for the audience

But there is hope. I’m not the only one getting tired of the same old presentations. Actually, the war against bad presentations already started a long time ago. A lot of people are trying to get rid of bad presentations. But the person who inspired me most, was Garr Reynolds.

Presentation ZenReading this blog, I accidently stumbled across Garr’s book  presentation zen. Because I was in the process of creating one, I ordered the book and it opened my eyes. It showed me what is wrong with most presentations today and how to improve this. As far as I’m concerned Garr succeeded in the goal he mentiones in the introduction of his book:

… if I could begin to help others look at preparation, design and delivery of so-called “powerpoint presentations” in a different way, perhaps I could do my small part to help others communicate far more effectively.

After reading the book and having learned from it, I decided to join the quest of helping others to communicate better.

knight_swordMy first act was putting my newly found knowledge to practice by doing a presentation at work on presentation zen. From the audience of 25 people I am positive I convinced at least two listeners to buy the book. And everyone in the room will think differently the next time they are listening to some talk or creating one.

My second act is writing this post, in the hope to reach a few more people. As you might have guessed I highly recommend buying presentation zen and learn from it. Besides the book, there is also a wealth of information to be found on the blog and website. If you value the information as much as I do, I urge you to spread the word. Only by doing this, presentations will become more fun to give and more interesting to watch.