Insights: You don’t need your DSL to be English-like
There is a widespread opinion that a good DSL has to be English-like. Dave Thomas advocates against such approach asserting that DSL are not about getting as close as possible to natural languages and that having this as a guiding principle of DSL design can be rather detrimental. He also highlights what he believes is important in DSL design and provides some examples of successful DSL.
March 9, 2008
Obsev:: Mutability is addictive like drugs, Mutation can become a cancer!
This is really crazy!
The first time I got introduced to mutation, I had a bad feeling. How can x:=x+1 be logical at all?
It felt so unnatural, scary, or maybe like a hack. Then, because of society constrains, I got to forget the bad feeling about that. Well, my mind started to tolerate with counter-logic logic. And that is how I became an enterprise developer. I am not sure how proud I am with this title anyway. I feel that tolerating and accepting the counter-logic logic is one, and most important one, of the prerequisite to this title.
September 29, 2007
Design Driven Testing: Using tests as specifications of system’s invariants and contracts design
I just got back from JAOO2007. One session of the conference was James Coplien’s “Scrum Architecture”. After this session, a discussion took place about Coplien’s statement that “TDD harms your architecture”! This discussion continued afterwards as an Open Spaces debate. I had the chance then, with the help of Floyd Marinescu, to organize a filmed debate at InfoQ’s studio between Bob Martin and James Coplien on the same topic. I really enjoyed this debate which really showed a high quality spirit of discussion from both sides. Both had their arguments. I will not tell my opinion but rather let you judge yourself once the video is out on www.InfoQ.com .
Recently, I posted about the fact that I always write tests before code, but I don’t do Test Driven Development where I discussed the way I view testing. Yet I don’t guess I’ve been clear enough, so I decided to write few lines trying to better reflect the way I view a testing approach.
When I have a domain problem at hand, first what I think about is partitioning and abstraction, which means dividing the domain into sub-domains. This partitioning procedure is not driven by any tests, but rather by domain knowledge acquired from domain experts. This is extremely important; the architecture/design should reflect the domain/sub-domain problem it is trying to solve. This helps the software be flexible adopting business changes, as it was designed from a business perspective. A book that explains very well this approach is Eric Evans’s Domain Driven Design.
This Up-Front analysis is not defining the full up-front architecture, far from it, rather defining good bases for an architecture that maps to business. It shouldn’t take much time, just enough to help going forward with an iterative approach. This should define, either in code or in a tinny UML sketch, an object structure that forms the basic sub-domain’s components.
After defining the main structure of the sub-domain’s solution, I follow an iterative process as follows:
1: Driven by the business knowledge crunching, I define a component’s contract with its invariants and conditions
2: I write a test that forms the specification of this contract and its invariants
3: I start the implementation to satisfy the specifications I defined in the test
A very important note here is that the contract specifications should be readable, very clear and explicit. This explicitness helps to have a better vision of the whole system while reading the contracts-invariants of its defined components. This also helps spot bugs without the painful debugging: this approach of Design by Contract reflects developers understanding of the business domain in a more explicit way, so it makes it easier to spot misjudgments developers might have done in their implementation. This intention revealing method of development highlights important business rules, rather than letting them hidden behind an abstraction. Abstractions should not hide any important business concern as an implementation details. Explicit contracts and invariants allow business experts to have a look on what is going on inside the software. For an example of bugs that result from developer’s misjudgment see Reganwald’s recent post .
Of course unit tests are not the best tools for this approach. They work fine if we emphasize on methods and class naming for readability and visibility of invariants and rules. Still I prefer tools like BDD or Eiffel/Spec# Design by Contract. Hope we will have some more support for such tools in the industry soon.
A metaphor James Coplien used to illustrate the problem in Test Driven Development approach, which made sense to me, is a test driven course in a school. It’s about a teacher that finds that most of his students fail in the final test. So to make things work better, he decided to ask the students to write themselves their tests by the beginning of the semester, and then to let them pass these tests by the end of that semester! Hence, they might get better grades, but that doesn’t mean they got better knowledge at all.
September 24, 2007
Charles Simonyi reveals production use of Intentional Software @ JAOO
Floyd Marinescu did a good summary of Simonyi’s presentation on JAOO and posted it on IinfoQ
http://www.infoq.com/news/2007/09/intentional-at-jaoo
It seems that guys at Intentional software are having something that works seriously, in real world business.
September 22, 2007
I always write tests before code, but I don’t do Test Driven Development
I am not driven by tests, my code neither. Actually my code is rather driven by design. I do use a test first approach, but I use for a contract first discipline in order to test that my decoupling works. Yes, I think about decoupling first, and then I write tests. I design, and then I write tests. Of course I don’t take a lot of time in my design reflection. But I am not driven by any force other than my experience and the context at hand. I do abstractions and I validate them with tests. Actually, I use test first approach to specify my design. I don’t write any piece of code without a failed test waiting for it, but still I prefer to call that a test-first approach than the confusing “test-driven development”!
More about this approach to testing in my newer post Design Driven Testing: Using tests as specifications of system’s invariants and contracts design…
September 19, 2007
Domain Specific Languages are technology-agnostic, a more mature representation of their specific domain

One of the most important properties of Domain Specific Languages is that it is an abstraction which is technology-agnostic. We know how often technology changes, adopting new frameworks, discarding old used ones. DSLs keep evolving to be a more and more mature abstraction of the domain. And integration of the new technologies and frameworks becomes nothing more than implementation details behind this abstraction. It forms a kind of specification of the sub domains.
August 7, 2007
DSLs bringing the end of single language development?
My second contribution in InfoQ. An interesting news post about DSLs, and language oriented programming.
July 31, 2007
Obsev :: Welcoming user’s input
Today coming back from work, I passed to a neighbouring fast food place to grasp a sandwich. I ordered a sandwich, I knew that it has chicken with some vegetables and some sauce, and a rather interesting name that I don’t remember. The guy asked about what sauce would I prefer. My instant answer was a question about what sauces they got, just kind of thing to skip answering the question right away. He showed me a a bar with 10 different kind of sauces. “You can even mix several” he added!
I really couldn’t answer, and I still can’t. That were too much choices for me. Actually how the hell can I know which sauce can fit this particular sandwich. By the end I will try one once, and I will be either disappointed, or - which rather less probable due the quantity of possible choices- happy with my meal!
The same happens with hairdressers. How exactly you want me to do your hairs for you? Well, wait a minute, aint he supposed to be the styler? I know he should get some input, but wouldn’t the input be better as different smaller questions?
July 29, 2007
OBSEV :: Java or C# do not fit as a host language for DSLs, Lua is a better alternative to use as an IL in a Meta programming System
Recently, I’ve been playing a lot with Meta programming System of JetBrains. I feel that it has a lot in common with my idea of Paradigm Oriented Programming. In the way that it defines the language by links, adjectives and things (i.e. dimensions) that form together an abstraction as a language for a certain domain.
The package comes with Java already implemented, that can be quite handy, as it makes it easy for us to embed languages and concepts inside Java. But there is something that bothers me here; does Java (or even C#) work as an IL, a basic flexible language that other designed DSL will be interpreted to? Actually I strongly doubt that. First of all Java syntax comes already with a lot of constrains, static typing, curly brackets and a lot of other imitations.
Another thing is that Java itself is already an implementation of an abstraction. That is OOP. And fitting everything into OOP will force our DSL to respect that style of programming and to be constrained by it. Java is so static, and neither flexible not dynamic enough to have DSLs built on it.
Fortunately JetBrains’s MPS is not exclusive for java. It rather can be used with any other programming language. Because what it does is to build a coherent structure of text with its grammar in a syntax tree. Then it allows text to be generated out of properties of the syntax.
I thought a lot about a language that can be flexible enough, so that we can build abstractions that can be easily interpreted and implemented into that language’s syntax. I guess Lua is a good candidate. I believe that the way it is built permits a lot of dynamism for implementing meta-systems and making them co-exist in a paradigm oriented programming (See OOP implementation in Lua).
I still see some improvements still can be added to it. But for now I see it a perfect fit as an intermediate language for my POP.
July 4, 2007
Figure and Ground: N-Dimensioned Programming Language or a Paradigm Oriented Programming Language
Looking at paintings, they are often composed of a figure and a ground. The figure is usually what is more visible for the eye. Often the ground is less important as recognizing the shape is thought to be satisfied by recognizing the figure.
Understanding the figure can be simpler due to its more concrete and explicit nature, but the vision can not be complete without the ground. I even guess that thinking about the ground as a result of drawing the figure is quite naive. I guess that the ground defines rules of the environment, and is present implicitly in the definition of the shape. The fact that these rules are implicit makes them harder to capture. And easily ignored.
If we think about Object Oriented Programming as a figure, then what is the ground? The ground should be the environment that allowed us to define this meta-System.
Thinking about OOP as a meta system, allows us to capture the meta-meta-system. How this meta-meta-system can be defined?
Well, If we look at objects, they are special things that fall in a category ,things that fall in this category have special kind of relationship called inheritance, this relationship is governed by rules of polymorphism. Also we can add adjectives to tag some special behavior on the methods and properties of these things.
So far, I got things that fall in a category, governed by rules applied to relationships . moreover methods and properties of these things can have adjectives that can add rules on their use.
Now, with such a meta-meta-system I can define another meta-system than OOP, say a hierarchical one, or maybe a system of connectors. These several meta-systems can co-exist exactly as several categories of things co-exist in real world.
A question that raises evidently here, is How do they co-exist? How do they inter-connect? The simple answer is : messages… The problem of the integration of different types of paradigm had always existed, and had always been pushed out to frameworks to handle it. I believe that these frameworks of integration are themselves not well integrated in the language. Maybe including them in the language can make more natural?
Anyway my whole idea is a paradigm oriented programming language, where we define dimensions, that we can use to define meta-systems. I see the idea is pretty faisable, might be more than a (things, category, relationship, rules, adjectives) even if I could imagine a lot of meta-systems built only on this 5 dimensioned programming language…
All what I am about in this blog post is ideas, far from being mature.It is just a stream of ideas that I felt to persist somewhere. And here I did
Powered by WordPress




