Skip to main content

On DSLs and design patterns

Through an article on InfoQ I have come across a number of blog posts about DSLs (domain specific languages). It all starts with Joel (by now famous for his opinions on Ruby performance ;) ) who explains the rationale behind creating Wasabi, a DSL for his company's bug tracker. This software apparently has to run on VB and PHP.

InfoQ also refers to the blog "discipline and punish" (what a name) in which the author argues that DSLs are flawed due to their (or rather their creator's) inability to adapt to change - well, that's what I gather from it at least.

Personally, I am currently working for a company that has created its own DSL for describing user interfaces on mobile devices (we're not talking about simple XML, but rather a real language). These UIs need to run cross-platform (Symbian, MS Mobile, Java, etc) so the DSL really has to abstract the platform differences. So in essence, I really buy into Joel's argument that DSLs are about abstraction (I do NOT buy into his argument that Wasabi is a good idea for the reasons he describes or that creating a DSL would be not a lot of effort).

One thing that had not been covered on the DSL discussion as mentioned by InfoQ is the tools issue. If you create a DSL you either have to develop without tools (-> inefficient) or create your own tools (-> effort). For me, this is one of the reasons why I do think twice about creating a DSL and then think about it again.

And now to something completely different.

In this blog entry Mark Dominus argues that design patterns are a sign for a weakness in the language. Thought about it. Found it a brilliant observation. Agree. (and I'm sure Erich Gamma will not be happy ; )

Maybe there will always be design patterns because the mainstream general purpose languages changes so slowly (i.e. our change from one to the other). So we stick with them for a while (like a decade) until we learned enough to convert to a new general purpose language (think C, C++, Java).

Along these lines I remembered that the decorator pattern can be implemented really easily in Ruby. But still, it has to be implemented. So, maybe Ruby is not the great next thing after Java (it's just nice - which is good enough for me ;) ).

Comments

Popular posts from this blog

Python script to set genre in iTunes with Last.fm tags

Now that I have started to seriously use iTunes I figured it might be nice to have the genre tag set in a meaningful way. Since I have a reasonably large collection of mp3s doing that manually was out of question - I wrote me a Python script to do that. There seems to be a large demand for such a functionality (at least I found a lot of questions on how to automatically set the genre tag) so maybe someone else finds the script useful. It is pasted below. General Strategy The basic idea is to use Last.fm's tags for genre tagging. In iTunes the genre tag is IMO best used when it only contains one single genre, i.e. something like "Electronica", not something like "Electronica / Dance". On the other hand dropping all but one tag would lose a lot of information, so I decided to use the groupings tag for additional information that is contained in the list of tags that an artist has on Last.fm. In the example above that would be something like "Electronica, Dan...

The misuse of the term "RESTful" in the Rails community

Today I went to a talk at the local Ruby on Rails group. The speaker was quite clueful. He had even implemented his own DSL to describe his business problem. Obviously, the guy was not a noobie in Ruby. However, what really turned me off was his usage of the word "RESTful". For him, it seemed to be a way to describe the inner workings of his application, like, say, "separation of concerns". RoR guys are generally not the most clueless people, but nobody in the audience challenged him about this. It seemed to be the generally accepted usage of the term in the Rails community. This made me think that DHH and Rails have done two things to REST: First, they greatly help to evangelize the term "RESTful" Second, they hijacked the meaning of the term and changed it from "architectural style" to "application architecture" As it happens I listened to a podcast from the Pragmatic Programmers on my way home. It was about the .Net Ruby implementati...

What is Multi-Tenancy? A closer look

Lately, I had a lot of conversations about multi-tenancy (MT). So I finally wrote up my thoughts on that term. In this post I will argue that MT is a value that depends on a continuous variable. Therefore, any statement about a system being “MT” can only be made in the context of the given requirements. It is not a property of the system itself . I will also show that perfect multi-tenancy is indistinguishable from single-tenancy (ST). MT is a value that depends on a continuous variable Imagine a step-function "ST-MT" (values are either 0 or 1) that determines if a given system is MT (1) or ST (0). That function will look like this: ST-MT = function (system, business requirements) Look at  the function’s arguments: the first one is obvious – the result will depend on the system itself. The second one is more interesting: it is the cumulative set of business requirements . Typically, these requirements will include: Resource sharing: systems typically declare...