Friday, September 3, 2010

Business Object/Domain Object

A business object is a an entity. That is an actor inside the business layer in a multi-tiered system of object-oriented computer programs. A business object, itself usually does nothing but holds a set of instance variables or properties, known as attributes and associations with other business objects, a map of objects representing the business relationships. It communicates across the tiers in a multi-tiered system.

Business objects are sometimes called domain objects (where the word domain means the business).

Good business objects will encapsulate all of the data and behavior associated with the entity that it represents.
For example, an order object will have the sole responsibility for loading an order from a database, exposing or modifying any data associated with that order (i.e. order number, the order's customer account), and saving the order back to the database.

A domain object is an object from a domain model. It encapsulates only business rules and logic. Domain objects are Java classes that perform operations on data objects and provide data for presentation.

Domain objects contain logic particular to a business domain, such as managing users or credit cards. This logic operates over a persistent data object that contains the state necessary to implement the domain specific logic. Domain objects contain the application logic specific to the domain that require representing persistent state.

The purpose of the DomainObject class is to encapsulate access to one or more types of data objects. A number of methods, such as the save and delete methods, are delegated to the data object. The domain object, part of the application logic layer, is acting as a facade for an operation of the data object, part of the persistence layer. This is an interface between the persistence and application logic layers and one point where the two layers connect.

Domain objects are responsible for providing an interface to create, retrieve, update, and delete (the CRUD methods).

Hope this is useful!

No comments:

Post a Comment