Sadek Drobi’s Blog

March 29, 2009

Abstraction for People: Configurations, Patterns, DSLs and Monads

DSC_2692a3

LinQ is often understood in terms of introducing a Domain Specific Language to work with data to C# and .Net in general. The fact is:it is not, and there is a considerable difference between LinQ syntax nature and a DSL. The problem is that DSL definition is blur enough to take anything interesting or cool under it!

(more…)

January 5, 2009

You’ve got 100 pages to convince me of your shiny language!

DSC_0150- In the rapidly spanning world of programming languages, I find myself buying and reading a lot of books about new and old programming languages. There are a few interesting concepts in each language, and if you think about employing more than one language in your projects then you better know about the existence of these concepts (see Paradigm based Polyglot Programming).

One thing that annoys me though about most programming language books is how raw they often are.

(more…)

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.

(more…)

February 15, 2008

Communicating Intent through Idiom and Paradigm Selection

What about using idioms and programming conventions as signals to achieve more readability and expressiveness? This is what Reg Braithwaite advocates for, suggesting that syntax or even paradigm choices can be a means to communicate the intent.

(more…)

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 :)

June 10, 2007

Everything is Not an "object"

I just streamed some fresh ideas I got on my Domain Specific Wiki about a term I call  “Thing Oriented Programming”.
Later I ll try to gather them in a more readable essay that will be available both here and there.

Powered by WordPress