When I was at the Lang.NET symposium in Redmond I had the chance to hear two talks from Roman Ivantsov, who is the developer behind the Irony project on Codeplex. One of his topics was related to enlisting language architects to focus on the large problem of developing ERP applications. The point I took away from his talk was that current tools and language constructs were not enough for enabling the success for such large scale applications to the degree he would like. It seems that despite the high costs the likelihood of success is tentative at best. Roman was soliciting the language development community to apply some more though to the problem so we can try to improve the state of ERP application development success.
I found this to be a very interesting talk because to some extent this is what I think NBusiness is about, or should be about at least. Admittedly, however, the scale of NBusiness has yet to soar above the level of even ORM technology. As useful as it may be as is, it is only the beginning of what can be done. I will say that I strongly believe that using a DSL for designing the logical layers of an application can be done and will prove to be ultimately important for higher levels of abstraction for any application.
This leads me to some thoughts about the logical conclusions of such a hypothesis. To me these ideas lead to, or at least what I understand as,
intentional programming. Now I don’t really know how
Charles Simonyi and those guys at
Intentional Software are doing what they do but I can imagine a way to have constructs directly in an application for dynamically specifying languages to describe the layers of your application. I suppose it would end up looking drastically different than what we work with now but in my naive imagination I can literally imagine writing an application, at the highest levels, in what reads almost like human speech. Imagine writing code that looked like this:
|
User starts application and enters Main screen.
from Main screen User enters ListProduct screen or EditOptions screen.
ListProduct screen lists Product model.
from ListProduct screen User selects Product model or enters Main screen.
from Product screen User edits Product model or enters ListProduct screen.
from EditOptions screen user edits Options model or enters Main screen.
|
Now imagine being able to have tools directly in your application for parsing out such language and creating for you an object model representing what you have described. In this tool you could then define users, screens and models perhaps, which are described in another language which you have defined directly in your application.
During compile time you would then receive an object model of what you have written for use in templates which compile your object model into actual machine code (or IL or whatever). The example above is probably very simple but the idea I would like to put forth is that of having N layers of arbitrary languages in your application.
Imagine hovering your mouse over the “Main” identifier above and have it describe to you various information about Main, all dynamically created for you based on your language definitions. Imagine intellisense knowing about screens and therefore being able to list for you available screens and all you had to do to get this was to create simple syntax rules in other files for all of the various layers of your application.
To some extent this is possible to do using the
DSL tools for Visual Studio, which is VERY cool and powerful and definitely worth checking out. However, as far as I understand it, with this tool DSL’s are always graphical UML style blobs with lines and arrows and such. Yuck. I’m a programmer, I think in code. Also, maybe I’m wrong about this, but from my research my impression is that these DSL tools are more useful for situations with the perspective of wanting to create things that belong
along side of a lower level language, similar to the way that you might use a regular expression for example. But do check it out despite my misgivings, it’s very cool.
With all that being said, how does this relate to NBusiness? That’s a good question. I’m currently in the process of developing NBusiness 3.0 and I will tell you that I’m pretty excited about the lineup of new features planned, which I think will drastically improve the usefulness and power of NBusiness. Here is a brief list (you can find out more details on the main wiki page of NBusiness):
o The ability to describe 1:1 relationships as in databases.
· Entity reflection
o The ability to inherit from and have relationships with entities described in different libraries.
o Similar to partial classes, useful for supporting code generation of entities.
o There will be a tool for generating entities based on a database and you can use partial entities to establish rules and relationships in places where constraints and foreign keys are missing.
o The ability to add meta-data to entity elements, similar to attributes in .NET.
o Models must inherit from entities to allow the ability to access subsets of an entity for specific use cases.
o More formally distinguishes the differences between and entity and a business object. An entity will more officially take on ORM responsibilities while Models will not necessary be so.
· Componentized Access and Authorization rules
o Add the ability to create arbitrary access and authorization rules not simply blanket role based rules.
In addition to this I am intensely interested in coming up with some ideas for supporting the definitions of use cases or “controllers” perhaps. I haven’t figured it out yet but it might be that this is something that will be left for NBusiness 4. I am keenly interested in this idea though. The intentional programming rant I spouted above is just a snippet of off the top of my head ideas running rampant in my head right now. If anybody has any ideas about how to describe the concepts of use cases please drop a comment, fire off an email or create a thread on the
NBusiness forums!
I will wrap up this blog with a few excerpts from Roman’s email that really inspired me to think a on a level a little higher than I have been so far.
“IMHO, you are not radical enough, not even enough to justify a new programming language. Other ORM frameworks are quickly catching up, including coming entity framework from MS. They actually show that even inside c# (with some XML) you can do a lot of things, in declarative style as well, thus questioning the need for a special language. Although I dislike the idea of generating these XML meta-data files in MS entity framework – I would prefer your approach. I’m not saying a special language is not needed – just that new language must do things that are nearly impossible without it.
In general, I start to think that the biggest problem in business applications development is insufficient abstraction level in business code – this causes all our problems, including quick code aging and low reusability. We need to raise the abstraction level – much higher than moving from DB tables to “entities”. I don’t have a ready-to-use solution, only the general direction to move.”
I believe that this is something that I’ve heard from
Rocky Lhotka a million times also. It’s funny how I hear what Rocky says whenever I talk to him but I am not really able to understand it until I have some ah-ha moment a year and a half later. Then I realize that was what he was telling me all along.
I believe that I have struck upon a good idea with NBusiness. I believe that a programming language style DSL really has the potential to be the best way to express higher levels of abstraction. All I have to do is to really understand the domain of the problem I am trying to abstract and learn how to describe it in an elegant way. We’re coming along nicely so far and who knows, in the future perhaps we’ll have the ability more fluidly express these abstractions with greater and greater ease.