Business object (computer science)
Encyclopedia
A business object is a type of an intelligible entity being an actor inside the business layer in an n-layered architecture of object-oriented
computer program
s.
Whereas a program may implement classes
, which typically end in objects managing or executing behaviors, a business object usually does nothing itself but holds a set of instance variable
s or properties
, also known as attributes, and associations
with other business objects, weaving a map of objects representing the business relationships.
A domain model where business objects do not have behaviour is called an Anemic Domain Model
.
Business objects separate state from behavior because they are communicated across the tiers in a multi-tiered system, while the real work of the application is done in the business tier and does not move across the tiers.
For example, a "Principal" would be a business object where its attributes can be "Name", "Second name", "Age", "Area", "Country" and it could hold an 1-n association with its employees (a collection of Employee instances).
Another example would be a concept like "Process" having "Identifier", "Name", "Start date", "End date" and "Kind" attributes and holding an association with the "Employee" (the responsible) that started it.
Finally, although a business object represents an entity, it should not be confused with relational
model entities. Sometimes a relational entity could be mapped
by a business object but this is not a rule. Take as example a relational entity like "Customer" which has a "Kind" attribute in order to distinguish "Country customers" from "Abroad customers". Because of design needs, maybe this relational entity will end in two business objects: "CountryCustomer" and "AbroadCustomer", since everyone will not hold same associations. First will be holding fiscal associations while second will be associated with taxes and its related duty.
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
computer program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
s.
Whereas a program may implement classes
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...
, which typically end in objects managing or executing behaviors, a business object usually does nothing itself but holds a set of instance variable
Instance variable
In object-oriented programming with classes, an instance variable is a variable defined in a class , for which each object of the class has a separate copy. They live in memory for the life of the object....
s or properties
Property (programming)
A property, in some object-oriented programming languages, is a special sort of class member, intermediate between a field and a method. Properties are read and written like fields, but property reads and writes are translated to get and set method calls...
, also known as attributes, and associations
Association (object-oriented programming)
In object-oriented programming, association defines a relationship between classes of objects that allows one object instance to cause another to perform an action on its behalf...
with other business objects, weaving a map of objects representing the business relationships.
A domain model where business objects do not have behaviour is called an Anemic Domain Model
Anemic Domain Model
Anemic domain model is a term used to describe the use of a software domain model where the business logic is implemented outside the domain objects.-Overview:...
.
Business objects separate state from behavior because they are communicated across the tiers in a multi-tiered system, while the real work of the application is done in the business tier and does not move across the tiers.
For example, a "Principal" would be a business object where its attributes can be "Name", "Second name", "Age", "Area", "Country" and it could hold an 1-n association with its employees (a collection of Employee instances).
Another example would be a concept like "Process" having "Identifier", "Name", "Start date", "End date" and "Kind" attributes and holding an association with the "Employee" (the responsible) that started it.
Finally, although a business object represents an entity, it should not be confused with relational
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...
model entities. Sometimes a relational entity could be mapped
Object-relational mapping
Object-relational mapping in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language...
by a business object but this is not a rule. Take as example a relational entity like "Customer" which has a "Kind" attribute in order to distinguish "Country customers" from "Abroad customers". Because of design needs, maybe this relational entity will end in two business objects: "CountryCustomer" and "AbroadCustomer", since everyone will not hold same associations. First will be holding fiscal associations while second will be associated with taxes and its related duty.
See also
- Anemic Domain ModelAnemic Domain ModelAnemic domain model is a term used to describe the use of a software domain model where the business logic is implemented outside the domain objects.-Overview:...
- Active record patternActive record patternIn software engineering, the active record pattern is an architectural pattern found in software that stores its data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture...
- Data access objectData Access ObjectIn computer software, a data access object is an object that provides an abstract interface to some type of database or persistence mechanism, providing some specific operations without exposing details of the database. It provides a mapping from application calls to the persistence layer...
- Data transfer objectData Transfer ObjectData transfer object , is a design pattern used to transfer data between software application subsystems. DTOs are often used in conjunction with data access objects to retrieve data from a database....
External links
- A definition of domain model by Martin FowlerMartin Fowler-Online presentations:* at RailsConf 2006* at JAOO 2006* at QCon London 2007 * at QCon London 2008 * at ThoughtWorks Quarterly Technology Briefing, October 2008...
- Anemic Domain Model by Martin FowlerMartin Fowler-Online presentations:* at RailsConf 2006* at JAOO 2006* at QCon London 2007 * at QCon London 2008 * at ThoughtWorks Quarterly Technology Briefing, October 2008...
- A definition of business object by Joseph Reddy