CSC/ECE 517 Fall 2010/ch6 6h cb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
Introduction to Domain Object Models
Although they share the same initials, the Document Object Model discussed in the previous chapter and the Domain Object Model (DOM) discussed here have very little in common. Throughout the chapter I may abbreviate the Domain Object Model as DM (since it is also referred to as the Domain Model) so that it is not confused with the more common use of DOM as a Document Object Model. A Domain Model is a tool used to translate business logic into a visual representation which includes all relevant relationships and data. This visual aid can then be used to verify a problem domain or system architecture among both technical and non-technical contributors.


==Introduction==
Although they share the same acronym, the [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2010/ch6_6g_ss Document Object Model] discussed in the previous chapter and the Domain Object Model (DOM) discussed here have very little in common. Throughout the chapter I may abbreviate the Domain Object Model as DM (since it is also referred to as the Domain Model) so that it is not confused with the more common use of DOM as a Document Object Model.


What defines a DM?
A Domain Model is a tool used to translate business logic into a visual representation. This visual representation includes all relevant relationships and data so that customers, developers, experts and non-experts can all understand and contribute to a system's design. It can also be used to verify a particular problem domain or system architecture in a consistent format so that everyone fully understands the design.
To help define a Domain Model we’ll use the trite example of an online store which includes a shopping cart, items to purchase, a customer, etc. The DM for such an abstraction would look similar to the following


…....insert diagram here.


==What is a Domain Model?==
To help define a Domain Model we’ll use the example of an online store which includes a shopping cart, items to purchase, a customer, etc. The DM for such an abstraction would look similar to the following


At first glance, the structure of a DM looks very much like a flow diagram, UML diagram, or database map with slight variations on each of these. The big blocks in the diagram represent the Business Objects of the model. These objects typically represent real world objects and are modeled accordingly. For instance. the shopping cart in the example above is a business object. Each business object in a DM holds certain variables and attributes that pertain directly to that object. A shopping cart may contain a customer number, a list of items, and a total price. In addition to holding data, these objects can also perform operations. In fact, a domain model where objects do not contain any logic is called an Anemic Domain Model. Most objects, however, do contain business logic, such as an AddToCart method for the shopping cart object.
Image:Simple_DOM
[[Image:Simple_DOM.png|center|DOM Breakdown]]


So thus far a DM may not seem very different from a UML diagram or database map diagram. However, what it can represent that the other two cannot is a process or series of events. So then beyond simply defining the relationships between objects, such as a shopping cart contains items, a DM can specify that a customer must add items to the shopping cart before being able to check out, for instance.
At first glance, the structure of a DM looks very much like a flow diagram, UML diagram, or database map with slight variations on each of these. The big blocks in the diagram represent the Business Objects of the model. These objects typically represent real world objects and are modeled accordingly[7].  


When is it used?
For instance, the shopping cart in the example above is a business object. Each business object in a DM holds certain variables and attributes that pertain directly to that object. A shopping cart may contain a customer number, a list of items, and a total price. In addition to holding data, these objects can also perform operations. In fact, a domain model where objects do not contain any logic is called an Anemic Domain Model[6]. Most objects, however, do contain business logic, such as an AddToCart method for the shopping cart object.
The two primary development cycles that Domain Models are used are Domain Driven Development (DDD) and Feature Drive Development (FDD).  


DDD
So thus far a DM may not seem very different from a UML diagram or database map diagram. However, what it can represent that the other two cannot is a process or series of events. So then beyond simply defining the relationships between objects, such as a shopping cart contains items, a DM can specify that a customer must add items to the shopping cart before being able to check out, for instance. This can be very helpful in complex domains such as a government approval process where an item might need to be approved by a dozen different people in a particular order and routed appropriately if denied.
The first, Domain Driven Development, concentrates on tackling complex problems by leaning on the expertise of the domain in which the problem exists. In this case a Domain Model can be very useful in determining if all parties in a project fully understand the domain and how each piece works together in the system. It is important, however, that all pieces of the DM be written in a “ubiquitous language” that is common among experts in the field.


FDD
==When to use a Domain Model==
Feature Driven Development, uses a very communicative relationship between developers and customers to iteratively develop and refine features requested by the customer. The DM is an important piece of each iteration of the cycle and is one of the first things that is agreed upon by both parties. As it works in DDD, the Domain Model serves as proof that both sides agree and understand the problem domain before any design or development work begins. This is especially important for complex systems.
The two primary development cycles that Domain Models are used are Domain Driven Development (DDD) and Feature Driven Development (FDD).  


===Domain Driven Development===
The first, Domain Driven Development, concentrates on tackling complex problems by leaning on the expertise of the domain in which the problem exists[5]. In this case a Domain Model can be very useful in determining if all parties in a project fully understand the domain and how each piece works together in the system. It is important, however, that all pieces of the DM be written in a “ubiquitous language” that is common among experts in the field.
===Feature Driven Development===
Feature Driven Development, uses a very communicative relationship between developers and customers to iteratively develop and refine features requested by the customer[4]. The DM is an important piece of each iteration of the cycle and is one of the first things that is agreed upon by both parties. As it works in DDD, the Domain Model serves as proof that both sides agree and understand the problem domain before any design or development work begins. This is especially important for complex systems.
==Conclusion==
In all honesty, creating a well done domain object model is a time consuming and difficult task.  However, it is one of the few ways that a combination of customers, system experts, and developers can agree and understand the interaction of components of a system from the very beginning of the development cycle. By properly using a domain object model as part of the design process a team can save themselves confusion, misunderstanding, and the most precious commodity of all, time.




==References==
==References==
http://en.wikipedia.org/wiki/Domain_model
1. Fowler, Martin. Patterns of Enterprise Application Architecture. Addison-Wesley Professional. November 5, 2002. pp. 116-120
http://en.wikipedia.org/wiki/Feature_Driven_Development
 
http://en.wikipedia.org/wiki/Domain-driven_design
2. [http://dotnettemplar.net/Object+Thinking+Domain+Model+Example.aspx Little, Ambrose. Object Thinking Domain Model. October 1, 2007 http://dotnettemplar.net/Object+Thinking+Domain+Model+Example.aspx]
http://en.wikipedia.org/wiki/Anemic_Domain_Model
 
http://en.wikipedia.org/wiki/Business_object_(computer_science)
3. [http://en.wikipedia.org/wiki/Domain_model Wikipedia, Domain Model. November 20, 2010 http://en.wikipedia.org/wiki/Domain_model]
Patterns of Enterprise Application Architecture by Martin Fowler
 
Addison-Wesley Professional. November 5, 2002 pp 116-120
4. [http://en.wikipedia.org/wiki/Feature_Driven_Development Wikipedia, Feature Driven Development. November 3, 2010 http://en.wikipedia.org/wiki/Feature_Driven_Development]
 
5. [http://en.wikipedia.org/wiki/Domain-driven_design Wikipedia, Domain-driven Design. November 24, 2010 http://en.wikipedia.org/wiki/Domain-driven_design]
 
6. [http://en.wikipedia.org/wiki/Anemic_Domain_Model Wikipedia, Anemic Domain Model. October 24, 2010 http://en.wikipedia.org/wiki/Anemic_Domain_Model]
 
7. [http://en.wikipedia.org/wiki/Business_object_(computer_science) Wikipedia, Business Object (Computer Science). November 12 2010 http://en.wikipedia.org/wiki/Business_object_(computer_science)]

Latest revision as of 12:51, 27 November 2010

Introduction

Although they share the same acronym, the Document Object Model discussed in the previous chapter and the Domain Object Model (DOM) discussed here have very little in common. Throughout the chapter I may abbreviate the Domain Object Model as DM (since it is also referred to as the Domain Model) so that it is not confused with the more common use of DOM as a Document Object Model.

A Domain Model is a tool used to translate business logic into a visual representation. This visual representation includes all relevant relationships and data so that customers, developers, experts and non-experts can all understand and contribute to a system's design. It can also be used to verify a particular problem domain or system architecture in a consistent format so that everyone fully understands the design.


What is a Domain Model?

To help define a Domain Model we’ll use the example of an online store which includes a shopping cart, items to purchase, a customer, etc. The DM for such an abstraction would look similar to the following

Image:Simple_DOM

DOM Breakdown
DOM Breakdown

At first glance, the structure of a DM looks very much like a flow diagram, UML diagram, or database map with slight variations on each of these. The big blocks in the diagram represent the Business Objects of the model. These objects typically represent real world objects and are modeled accordingly[7].

For instance, the shopping cart in the example above is a business object. Each business object in a DM holds certain variables and attributes that pertain directly to that object. A shopping cart may contain a customer number, a list of items, and a total price. In addition to holding data, these objects can also perform operations. In fact, a domain model where objects do not contain any logic is called an Anemic Domain Model[6]. Most objects, however, do contain business logic, such as an AddToCart method for the shopping cart object.

So thus far a DM may not seem very different from a UML diagram or database map diagram. However, what it can represent that the other two cannot is a process or series of events. So then beyond simply defining the relationships between objects, such as a shopping cart contains items, a DM can specify that a customer must add items to the shopping cart before being able to check out, for instance. This can be very helpful in complex domains such as a government approval process where an item might need to be approved by a dozen different people in a particular order and routed appropriately if denied.

When to use a Domain Model

The two primary development cycles that Domain Models are used are Domain Driven Development (DDD) and Feature Driven Development (FDD).

Domain Driven Development

The first, Domain Driven Development, concentrates on tackling complex problems by leaning on the expertise of the domain in which the problem exists[5]. In this case a Domain Model can be very useful in determining if all parties in a project fully understand the domain and how each piece works together in the system. It is important, however, that all pieces of the DM be written in a “ubiquitous language” that is common among experts in the field.

Feature Driven Development

Feature Driven Development, uses a very communicative relationship between developers and customers to iteratively develop and refine features requested by the customer[4]. The DM is an important piece of each iteration of the cycle and is one of the first things that is agreed upon by both parties. As it works in DDD, the Domain Model serves as proof that both sides agree and understand the problem domain before any design or development work begins. This is especially important for complex systems.

Conclusion

In all honesty, creating a well done domain object model is a time consuming and difficult task. However, it is one of the few ways that a combination of customers, system experts, and developers can agree and understand the interaction of components of a system from the very beginning of the development cycle. By properly using a domain object model as part of the design process a team can save themselves confusion, misunderstanding, and the most precious commodity of all, time.


References

1. Fowler, Martin. Patterns of Enterprise Application Architecture. Addison-Wesley Professional. November 5, 2002. pp. 116-120

2. Little, Ambrose. Object Thinking Domain Model. October 1, 2007 http://dotnettemplar.net/Object+Thinking+Domain+Model+Example.aspx

3. Wikipedia, Domain Model. November 20, 2010 http://en.wikipedia.org/wiki/Domain_model

4. Wikipedia, Feature Driven Development. November 3, 2010 http://en.wikipedia.org/wiki/Feature_Driven_Development

5. Wikipedia, Domain-driven Design. November 24, 2010 http://en.wikipedia.org/wiki/Domain-driven_design

6. Wikipedia, Anemic Domain Model. October 24, 2010 http://en.wikipedia.org/wiki/Anemic_Domain_Model

7. Wikipedia, Business Object (Computer Science). November 12 2010 http://en.wikipedia.org/wiki/Business_object_(computer_science)