The use of an object by other objects is very common in POO. This behavior is classified as relation, whose behavior will be determined by specific classifications. Association, aggregation and composition are names used to classify the type of relations between objects and each of them will be explained below.

Objects that work by association use one another. This type of relation is the most common. Each one of them works independently, but associate with another one in order to perform a certain task. A driver of a car, for example. The driver and the car exist independently, but combine to make the car function.

In the aggregation, the behavior is slightly different. In this case, an object adds another object, such as a parent object. Thus, the parent object begins to utilize the features of the aggregate object. Still, both objects can exist independently. For example, a lid adds a pan, but the lid and the pan may still exist without depending on the existence of one another.

In the composition, the behavior changes completely. An object becomes dependent on the other to exist. The parent object is responsible for the creation and destruction of child object, which shall be responsible for the instance of its parts. In this example we can mention the wheels of the bike – the bike can only exist if the wheels exist.

These classifications help the interpretation of various diagrams, thereby allowing the reading and understanding to be facilitated.

In the class diagram, for example, those relations are marked in form of UML, thus allowing the reader to understand in few minutes all the logic that was used in the creation and implementation of objects. In the case, representation by lines indicates the type of relationship between objects:

  • Straight line: indicates Association;
  • Line with cutting of empty lozenge: indicates Agregation;
  • Line with cutting of filled lozenge: indicates Composition.

Check out more content on our blog!
Learn all about Scriptcase.

By ,

June 12, 2015

a

You might also like…

Business Process Automation with Scriptcase

In the modern business world, operational efficiency is not just a goal. It's a necessity. With inc...

“We developed RISK4ALL, a SaaS platform that allows implementing GRC in an organization with total security and privacy.” (RISK4ALL)

Come and discover the success case of the Risk4all, software, a multilingual and multi-company SaaS...

You might also like…

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.