In: Computer Science
1.relationships between aggregation, generalization, and association.:
Relationships depict a connection between several things, such as structural, behavioral, or grouping things in the unified modeling language. Since it is termed as a link,
it demonstrates how things are interrelated to each other at the time of system execution.
Association:
Association is a structural relationship that represents how two entities are linked or connected to each other within a system.
It can form several types of associations, such as one-to-one, one-to-many, many-to-one, and many-to-many.
A ternary association is one that constitutes three links. It portrays the static relationship between the entities of two classes.
An association can be categorized into four types of associations, i.e., bi-directional, unidirectional, aggregation and composition
aggregation is a special form of association and composition is a special form of aggregation.
Aggregation:
An aggregation is a special form of association.
It forms a binary relationship, which means it cannot include more than two classes.
It is also known as Has-a relationship.
There is no Logical relationship between two classes but we have to accses the some properties of parent class then we implement the Has-a relationship.
It specifies the direction of an object contained in another object.
Generalization:
In Aggregation There is no Logical relationship between two classes In Generalization It having the logical relationshp we Represent In is-a relationship.
It exists between two objects (things or entities), such that one entity is a parent (superclass or base class), and the other one is a child (subclass or derived class).
These are represented in terms of inheritance.
child class can access, update, or inherit the functionality, structure, and behavior of the parent.
2 .
Classes:
A class diagram contains a rectangle for each class. It is divided into three parts.
For example, a Person class and a Book class might be modeled like this.
This indicates that a Person object has private fields named name and birthDate, and that it has public methods named getName, setName and isBirthday. A Book object has private fields named title and authors. A Book object also has public methods named getTitle, getAuthors and addAuthor.
There are four type of Association:
Bi-directional
Unidirectional
aggregation
Reflexive
1 Bi-directional:
It having the many-to-many relationship. when multiple records in a table are associated with multiple records in another table.
Two objects might store each other in fields
two objects are related but only one object know about the relation.
For example
Person object listing all the books that the person owns and Book object might list all the people that own it.
2.Unidirectional:
In a unidirectional association, two classes are related, but only one class knows that the relationship exists.
A unidirectional association is drawn as a solid line with an open arrowhead pointing to the known class.
3.Aggregation:
Aggregation is a subset of association, is a collection of different things.
It represents has a relationship. It is more specific than an association.
It describes a part-whole or part-of relationship. It is a binary association, i.e., it only involves two classes. It is a kind of relationship in which the child is independent of its parent.
For example: Person object has/owns the Book object while the book is not really part of the person,
mean If the Person object gets destroyed still the Book object can work independently
Reflexive Association:
This occurs when a class may have multiple functions or responsibilities.
For example, a staff member working in an airport may be a pilot, aviation engineer, a ticket dispatcher, a guard, or a maintenance crew member. If the maintenance crew member is managed by the aviation engineer there could be a managed by relationship in two instances of the same class.