July 23, 2009
Did you already ask yourself if you’re really developing your projects object-oriented? How many times have you already had problems that implemented design patterns for the resolved? For Example: those classified by Eric Gamma’s book. Why the most design patterns of GoF don’t apply in the resolution of my problems? Perhaps because your problem is not framed into existent solutions. Or maybe not! And what really happens is the “or not”.
During several interviews that I’ve been doing with developers, It’s hard to find someone that are really working in object-oriented projects ( in scenario where I live! Of course). And why these peoples are not developing objects-oriented? Everyone had the basic training on universities, courses or books. But most of developers when take part in some projects into some companies came across with another situation.
One of the main factors is that the fresh developers are following what others started. And if the project works that so, I think so too! Ok, I don’t shoot the reason of all this. But keep working in these projects a long time, do you still thinking that you’re really developing objects-oriented?
Finding to know if i’m following the best practices of object-oriented projects, myself ask, Is my domain model ( really exists? ) reflecting the real world business? How about the objects coupling? The responsibilities are well distributed between their representations?
Maybe if the developers think again as they think about the real world to develop their projects, Thet can take advantage of the great benefits of a object-oriented programming.
June 26, 2009
I thought about this a long time ago and i decided write this post. Ok, I think the someone must have my question an answer, but i would like to share my point of view.
How do these people show the data of domain model in the presentation? I have seen most of people using domain objects in presentation to not duplicate datas. But for this situation, my opinion is: I prefer duplicated datas. Why? In fact, most of people know about the existence of problems when they use domain objects in presentation. They have a high coupling and in majority of times require the algorithms for build a rich interface that can effect the domain objects.
I think that some of solutions for that problem is the use of Observer pattern, but personally i don’t like that my domain obejct has that inherit of Observable class. Ok, maybe my vision is wrong. Other solution that i like it is Presentation Model. In the web context, isn’t this a simple Struts Form 1.x ? 🙂 I think that yes.
The most of people work with DTOs and questions about what is the problem when uses the DTO in presentation? Simple, that is not your role. DTOs are for transfer data. Using it for presentation model falls in the same problem. Phillip Calçado has a post about the use of DTO in presentation.
When i talk about the problems that exist when someone uses domain objects in presentation, those people ask me. So i will show an example:
I have a RouteSpecification ( I had taken this from ddd-sample project) and this Route to exist needs two locations ( Origin and Destination ). I cannot create a Route without them. But if i use the object Route in presentation, it has to exist to be filled in the presentation
Ok, all of that is my opinion. I think that duplicated data is inevitable, but to have a good domain model your work is valid.