Académique Documents
Professionnel Documents
Culture Documents
Sub Classes, Super Classes Specialization and Generalization Participation Constraints UML Class Diagram
MANAGER
EMPLOYEEs who are managers
SALARIED_EMPLOYEE, HOURLY_EMPLOYEE
Based on the EMPLOYEEs method of pay
EER diagrams extend ER diagrams to represent these additional subgroupings, called subclasses or subtypes
Note: An entity that is member of a subclass represents the same real-world entity as some member of the superclass:
The subclass member is the same entity in a distinct specific role
Specialization (1)
Specialization is the process of defining a set of subclasses of a superclass The set of subclasses is based upon some distinguishing characteristics of the entities in the superclass Example: {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of EMPLOYEE based upon job type. May have several specializations of the same superclass
Specialization (2)
Example: Another specialization of EMPLOYEE based on method of pay is {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}.
Superclass/subclass relationships and specialization can be diagrammatically represented in EER diagrams Attributes of a subclass are called specific or local attributes.
For example, the attribute TypingSpeed of SECRETARY
Specialization (3)
Generalization
Generalization is the reverse of the specialization process Several classes with common features are generalized into a superclass;
original classes become its subclasses
Generalization (2)
Relationships
Relationships between entities can be optional or compulsory. Total participation Partial participation In an ER diagram, we indicate total participation with a double line between the entity box and the relationship diamond.
Total Participation
Example
Partial Participation
Example
Example
We could decide that a person is considered to be a customer only if they have bought a product. On the other hand, we could say that a customer is a person whom we know about and whom we hope might buy something that is, we can have people listed as customers in our database who never buy a product. In the first case, the customer entity has total participation in the bought relationship (all customers have bought a product, and we cant have a customer who hasnt bought a product), while in the second case it has partial participation (a customer can buy a product). These are referred to as the participation constraints of the relationship.
Participation Constraints
Recall that a key constraint requires that each entity of a set be required to participate in at most one relationship. Dual to this, we may ask whether each entity of a set be required to participate in at least one relationship. If this is required, we call this a total participation constraint; otherwise the participation is partial. In our ER diagrams, we will represent a total participation constraint by using a double or thick line.
Example
UML
What is UML?
The Unified Modeling Language (UML) is a standard language for specifying, visualizing, constructing, and documenting the artifacts of software systems, as well as for business modeling and other non-software systems. The UML represents a collection of best engineering practices that have proven successful in the modeling of large and complex systems. The UML is a very important part of developing object oriented software and the software development process. The UML uses mostly graphical notations to express the design of software projects. Using the UML helps project teams communicate, explore potential designs, and validate the architectural design of the software.
Goals of UML
The primary goals in the design of the UML were: Provide users with a ready-to-use, expressive visual modeling language so they can develop and exchange meaningful models. Provide extensibility and specialization mechanisms to extend the core concepts. Be independent of particular programming languages and development processes. Provide a formal basis for understanding the modeling language. Encourage the growth of the OO tools market. Support higher-level development concepts such as collaborations, frameworks, patterns and components. Integrate best practices.
Class diagrams
Class diagrams are widely used to describe the types of objects in a system and their relationships. Class diagrams describe three different perspectives when designing a system, conceptual, specification, and implementation. These perspectives become evident as the diagram is created and help solidify the design.
Classes
Classes are composed of three things: a name, attributes, and operations. Below is an example of a class.
Relationship
The association relationship is the most common relationship in a class diagram. The association shows the relationship between instances of classes.
Example
For example, the class Order is associated with the class Customer. The multiplicity of the association denotes the number of objects that can participate in then relationship. For example, an Order object can be associated to only one customer, but a customer can be associated to many orders.
Class Hierarchies
As with object-oriented programming, it is often convenient to classify an entity sets as a subclass of another. In this case, the child entity set inherits the attributes of the parent entity set. We will denote this scenario using an "ISA" triangle, as in the next slide ER diagram:
ER diagram
Aggregation
Define new relationship which associates some entity with some other existing relationship. To do this, we will introduce a new feature to our model called aggregation. Identifying an existing relationship set by enclosing it in a larger dashed box, and then we will allow it to participate in another relationship set.
Example