Friday, December 16, 2005

Design vs Coding, and DDD

I have the chance (some would probably not call it that way) to deal with architecture/design stuff in my work, in addition to doing real coding and hands-on development work during my consulting activities.

For me, it's sort of an experimental way aiming to find which of one of these two would fulfill my day the most. After doing the two for the past 2 years: I came up to the conclusion: the mix of both is what fits me since coding allow to stay more in touch with the technical aspect and the technology while the design and architecture helps me keep some perspective as to which technology can make some difference and which adds up to ... well mostly hype!

An interesting approach that I find in OO-type of development that actually stresses the importance of having both competence in order to build complex system having all usual quality indicators. This approach originated from Eric Evans and is now well accepted and referred to as Domain-Driven Design (or DDD). I will not describe it here, please refer to his book.

However let me just comment of one aspect that I find particularly useful during OO design of a typical business application. It really helps in producing well organized, well designed, well documented and logical Domain Model construction. Very briefly the way I see this particular concept, is similar to a form of taxonomy that helps you organize and classified each object that you design in your Domain Model based on their roles:



  • Entity Objects are those with a very precise identity and transactional lifecycle, and for which we usually worry when multiple instances of the same identity could be found at runtime. They would typically be mapped to a unique row in the persistence database.



  • Value Objects are those without any identity where its field attribute are only compared by value (i.e. two instances with same value are considered equal).



  • Factory Objects are those concerned with the creation of object(s)... more often justified when creating group of objects along with their associated graph. This is required when this creation involve enough complexity to warrant encapsulation through factory.



  • Service Objects are those used to handle and implement business service along with associated business rules. These service objects usually operate on multiple collaborators entity objects as well as their repository.

  • Repository Objects are those used to handle entity lookup and persistence through an abstract layer hiding any details and idiosynchracies of the related persistence engine. They are typically used by Service objects, but sometimes by Entity Object, in which case Entity object would have a reference to the Repository passed inside its methods requiring Repository functionality.
I find this taxonomy very insighful and convenient, and this is certainly useful to adopt..still worth it when only used to help standardizing design terminology among developers and architect!


Martin

Tuesday, January 11, 2005

Intelligent Agent part 4: Implementation with OO programming

Intelligent agent implementation using Object Oriented programming paradigm


Wooldridge in Multiagents Systems provides a comparison between object oriented system and agent system paradigm, which seems awkward in the sense that the two paradigms serve different purposes. According to his reasoning, OO does share agent system characteristics by exhibiting autonomy over its state (and object control its state by making it private), however fails in controlling its behaviour (because once object methods are made public, control is switched to external object) contradicting the autonomy notion of agent. Other observations include the fact the agent have their own thread of control whereas in standard object model, a single thread of control is allocated to the entire system.


Actually, OO paradigm is sophisticated enough to provide mechanism required by the agent specification. For example, the access control granularity of object could allow to make only state information visible through methods and no operation done on the objects themselves (or condition could be applicable to the operation in order to respect the autonomy notion of the object), furthermore most OO implementation offers robust multi-threading control capacity, etc.). Surprisingly, the article refers to active object, which shares the property just mentioned, and also mentions that OO system can be used to build agent based system. We could add that it is actually being used, see Bigus for specific application example. Furthermore, from an ad-hoc search on the current software architecture currently available in building agent-based system, we see that the majority of development frameworks are actually originated from OO language implementation (reference: http://www.multiagent.com/) and most of them are actually from a well accepted general purposes language, i.e. Java:


Academic research based:


Commercial based product:



Taken from

“Constructing Intelligent Agents with Java” (1998) from J.P. Bigus and Internet ad-hoc researches