Design Patterns and Languages

The original authority on Design Patterns is the Gang of Four book. The Gang of Four includes my Software Engineering professor, Dr. Ralph Johnson. Design Patterns is still a good book and all; however, it focuses a lot more of implementing it using C++. Thus, I bought the Head First Design Patterns book. Except for its startling front cover, Head First Design Patterns is an excellent book. I read through 5 chapters of it last night after the book arrived. The exercises in there are fun, with the exception of the crossword puzzles. Why are there crossword puzzles?

Anyway, from what I have read -- and this is still very preliminary -- most of the design patterns seem to be used for delaying initialization to runtime. That is, all functionality should be freely dynamic and can be added and changed at runtime. Thus, design patterns seem more like little hacks (pardon me for a lack of a better word) to get the static type-based languages to be more dynamic.

I do not think that I am the only one to think this. Peter Norvig has some slides that show how to use design patterns in dynamic languages. In fact, he says that 16 of the 23 patterns discussed in Design Patterns are more easily implemented using Lisp than C++. Needless to say, this is something that I am really interested in finding out more on. And as a side note, this brings me back to what Paul Graham thinks: there is indeed the dream language. It would not do justice to his excellent essay on how he goes on to describe why some languages are indeed better. If you excuse him for his bigotry toward other languages beside Lisp, you might come to agree with him that there is indeed an evolution of languages. New languages tend to be more dynamic and not as type-based. Also, new languages tend to be flexible enough that you are able to define new constructs for the languages so that it models your software better.

Maybe, I am just language-addicted. Dave Thomas, one of the Pragmatic Programmers, mentions in a recent Ruby on Rails podcast that he is interested in languages too. And that he always strives to spend 3 minutes on each new language that he encounters, devoting more time to it if he finds it interesting.

In short, what I would really want to find out: Are Design Patterns modeled after the limitations of the language? Or do their usefulness transcend between languages?


comments powered by Disqus