On a previous post I was commenting on how easy it was to prototype a domain model in lisp. This happens primarily due to its REPL (read-eval-print-loop) way of programming.
A few days ago I started playing with weblocks which is, as it is referred on its website, "A continuations-based common lisp web framework". The shift of paradigm from page-centric development to something different at first sounded just like something interesting to learn about. Because of that, I tried it a couple of months ago, without much success, trying to replace a league management system I built using only hunchentoot by itself.
Today, with a little bit more experience in lisp I could manage to build a simple prototype with some of the entities of a domain model I was working on. The results were really impressive, primarily due to the straight forward approach to get the presentation done.
At first, the whole composite widget centric approach seems overwhelming but at some point it sinks in and we can see how easy it is to "compose" the web user interface for an application using weblocks without having to think about pages and getting data back and forth from the web session.
Despite the fact that it is still a work in progress, I really liked the feeling of working on a web application and not having to deal with html or ajax to get a nice presentation in minutes. (In my case, one hour, because I had no clue how to use it...)
Anyway, personally I really like building software without having to work on the UI manually. Auto-generation based on the model or on view definitions seems to be the more productive approach to deliver enterprise based applications. I wish one day we could have weblocks and cells-gtk, for example working against the same view abstraction and being able to generate desktop and web user interfaces in a seamless way.
Primarily technical blog on Lisp, .NET, C# development.
Showing posts with label Domain-Driven Design. Show all posts
Showing posts with label Domain-Driven Design. Show all posts
Tuesday, March 25, 2008
Thursday, December 27, 2007
DDD - Factories and Repositories
There is this chapter about factories and repositories. The first to create new entities or aggregates. The second to retrieve/store the entities from/to a database.
There is this mysterious middle ground where you don't have too many associations. Where you normalize but not too much. You create a complex query engine but impose some restrictions to what should be retrieved. I agree, and have been there before, where too many associations tend to cause a graph loading issue. It may appear as too many resources to load an entity by a filter, or even worse, as a lazy initialization - no session in NHibernate. It is very difficult to achieve this middle ground. There is a compromise involved in richness of the model and speed/memory/session handling. On the other hand, to avoid the use of the associations is a way to kill the domain model completely. Removing its meaning and making it just a set of disconnected types.
I developed this filter type of criteria that uses allows the client to use the model to retrieve objects using a very declarative syntax. With this approach, by encapsulating the ORM framework and abstracting its complexities, I can say we have 90% or more of all needs satisfied. And it seems like the way to go. But the use of traversal to navigate the domain model, implying in an underlying implicit querying mechanism to retrieve the objects, although powerful, brings us too much complexity in terms of the lazy initialization nightmare. We end up loosing too much time trying to figure out how to fix these infrastructure issues then working on the model. When the issue arises, I have to say.
I have a feeling that most of the problems we end up having could be solved by a more DDD approach in terms of the usage of aggregates to encapsulate a group of dependent related entities and maintain its invariants. That would simplify a lot the way we interact with the objects in all business logic code and at the same time it would help us to build more reliable user interfaces.
There is this mysterious middle ground where you don't have too many associations. Where you normalize but not too much. You create a complex query engine but impose some restrictions to what should be retrieved. I agree, and have been there before, where too many associations tend to cause a graph loading issue. It may appear as too many resources to load an entity by a filter, or even worse, as a lazy initialization - no session in NHibernate. It is very difficult to achieve this middle ground. There is a compromise involved in richness of the model and speed/memory/session handling. On the other hand, to avoid the use of the associations is a way to kill the domain model completely. Removing its meaning and making it just a set of disconnected types.
I developed this filter type of criteria that uses allows the client to use the model to retrieve objects using a very declarative syntax. With this approach, by encapsulating the ORM framework and abstracting its complexities, I can say we have 90% or more of all needs satisfied. And it seems like the way to go. But the use of traversal to navigate the domain model, implying in an underlying implicit querying mechanism to retrieve the objects, although powerful, brings us too much complexity in terms of the lazy initialization nightmare. We end up loosing too much time trying to figure out how to fix these infrastructure issues then working on the model. When the issue arises, I have to say.
I have a feeling that most of the problems we end up having could be solved by a more DDD approach in terms of the usage of aggregates to encapsulate a group of dependent related entities and maintain its invariants. That would simplify a lot the way we interact with the objects in all business logic code and at the same time it would help us to build more reliable user interfaces.
Tuesday, December 11, 2007
Studying Domain-Driven Design
I started reading the Domain-Driven Design book, by Eric Evans some weeks ago and today I restarted reading the chapter on Entities, Value Objects and Services.
From the first chapter of the book I had the feeling the author really knows what he is talking about. I always had the feeling that Object Oriented design was a problem when applied to a real world application, especially when we ended up having to decide for more then 30 minutes where a method should be implemented from the actual domain model entities. The service concept is perfect to solve this type of problem nicely by the use of those stateless process coordinators. They have the sole purpose of coordinating the execution of an activity that deals with a group of entities.
I used to simplify my projects by avoiding the implementation of almost any behavior on an entity, but I am reconsidering my position after reading this excellent book. I didn't finish yet.
I hope it will give me some light onto this holy grail of software engineering which is to build great software.
By the way, great software for me is a software that does what it is supposed to do, that is easy to maintain and easy to extend.
From the first chapter of the book I had the feeling the author really knows what he is talking about. I always had the feeling that Object Oriented design was a problem when applied to a real world application, especially when we ended up having to decide for more then 30 minutes where a method should be implemented from the actual domain model entities. The service concept is perfect to solve this type of problem nicely by the use of those stateless process coordinators. They have the sole purpose of coordinating the execution of an activity that deals with a group of entities.
I used to simplify my projects by avoiding the implementation of almost any behavior on an entity, but I am reconsidering my position after reading this excellent book. I didn't finish yet.
I hope it will give me some light onto this holy grail of software engineering which is to build great software.
By the way, great software for me is a software that does what it is supposed to do, that is easy to maintain and easy to extend.
Subscribe to:
Posts (Atom)
