Are design patterns really language weaknesses?

Some canonized design patterns — Adapter, Factory, Command, Visitor, etc — are approximations of features which are baked into other languages. Off the top of my head: Event-handlers in C# are baked-in versions of the observer pattern. Think about how you’d wire up events in C# if you had to roll your own observer each … Read more

Why do C++ templates use the angle bracket syntax?

Templates were introduced in the 1988 USENIX paper Parameterized Types for C++ by Bjarne Stroustrup, later incorporated into The Annotated C++ Reference Manual published in 1990 (the version before standardized C++). According to the paper, The <…> brackets are used in preference to the parentheses (…) partly to emphasize the different nature of template arguments … Read more

Why are many languages case sensitive?

I don’t think you’ll get a better answer than “because the author(s) of that language thought it was better that way”. Personally, I think they’re right. I’d hate to find these lines anywhere in the same source file (and refer to the same object+method)… SomeObject.SomeMethod(); … SOMEOBJECT.SOMEMETHOD(); … someObject.someMethod(); … sOmEoBjEcT.sOmEmEtHoD(); I don’t think anyone … Read more

C# static member “inheritance” – why does this exist at all?

So, the “inheritance” of static members merely looks like namespace pollution That’s right, except that one guy’s pollution is another guy’s added spicy flavouring. I think Martin Fowler, in his work on DSLs, has suggested using inheritance in this way to allow convenient access to static methods, allowing those methods to be used without class … Read more