Sadek Drobi’s Blog

April 20, 2008

And Design Patterns suddenly Degrade!

Filed under: Architecture, C#, Functional Programming, LinQ, DSL, Haskell — Sadache @ 9:25 pm

Lately I’ve been writing some programs with Haskell (a pure functional programming language) and I noticed that I am not using GoF design patterns anymore, and that got me to a question: What are GoF design patterns? And why do we need them?

This actually reminds me of a good definition I read (I can’t recall where) of these design patterns: Resolutions to programming language limitations implemented using the programming language available syntax. When one learns a programming language, he learns to express what he wants to express using a very limited set of expressions of the language. The problem with this is that his imagination in this environment gets boxed! So what are GoF design patterns?

Most of GoF design patterns are inspired from Smaltalk, so what is so special about Smaltalk? Closures! It turns out that Java and C++ didn’t have closures and higher order functions. Some of the Design Patterns came to rescue and provide "alternatives" to these powerful constructs or workarounds  to resolve these limitations. Such an approach requires a kind of object gymnastics and results in an explosion of classes!

I am now on a project where I use C# 3.5 features, and guess what? Suddenly I use much less strategies, much less templates. I write much less code yet being as or even more flexible. Powerful lambda expressions!

Update: DSLs also come from fp paradigm!

March 28, 2008

Insights: You don’t need your DSL to be English-like

Filed under: Agile Programming, Domain Driven Design, DSL, Useability — Sadache @ 7:49 pm

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.

(more…)

January 18, 2008

Refex:: Does code become better as it approaches English?

Filed under: Architecture, Agile Programming, DSL — Sadache @ 5:50 pm

Achieving readability and expressiveness by writing English-like code is one of the trends on the rise in today’s industry. Michael Feathers advocates for considering other alternatives that can be instrumental for improving code expressiveness. He argues that in some circumstances symbolic approach is more appropriate than the narrative one and highlights some trades-offs between them.

(more…)

January 5, 2008

Crosswords :: Decisions driven by productivity concerns: Reasons, implications and limitations

Filed under: Agile Programming, DSL — Sadache @ 1:13 am

Often the necessity to rapidly adapt software projects to new clients’ needs results in adopting approaches focused on productivity. Reasons, implications and limitations of this were recently discussed in the blog sphere.

(more…)

December 21, 2007

Separating business logic from technology: Kathleen Dollard on a new view of code generation

Filed under: Architecture, Agile Programming, DSL — Sadache @ 2:36 am

Even the most successful project becomes a failure when a new technology comes out and everything has to be rewritten from the ground. This is why business logic has to be separated from technology. And, according to Kathleen Dollard, code generation is a promising approach to achieve it.

(more…)

September 24, 2007

Charles Simonyi reveals production use of Intentional Software @ JAOO

Filed under: Domain Driven Design, Conferences, DSL — Sadache @ 10:31 pm

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 19, 2007

Domain Specific Languages are technology-agnostic, a more mature representation of their specific domain

Filed under: Architecture, Domain Driven Design, DSL — Sadache @ 7:02 am

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.

http://www.infoq.com/news/2007/08/multi-lingual-programming

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.

Powered by WordPress