Thursday, October 21, 2010

Sequence tables in SQL Server 2005

Interesting post by Paul White about Sequence Tables in SQL Server.

Tuesday, October 19, 2010

Mistake in Wikipedia article on the Builder pattern

The following article on the Builder Design Pattern on Wikipedia, is sort of OK, except that the Java example provided is inaccurate.

The abstract PizzaBuilder class uses abstract functions. That's not really recommended - if you subclass this then it means that you have to implement all the functions. But really, the pattern is meant to be more flexible than that - if you don't want to use the function then you shouldn't have to use it. Therefore, as the Gang of Four say in their book on page 101, the build methods should be left intentionally empty and not declared as abstract functions, "letting clients override only the operations they are interested in".

Monday, October 18, 2010

ICloneable: Microsoft's big mistake

So here's the deal: if you implement ICloneable in a public API, you are a making a big mistake. Why? Because there's no way of knowing if the Clone() function will do a deep or shallow copy.

As it turns out, even Microsoft know that they have made a mistake with this interface. Oopsy!