Object-Oriented Modeling
This methodology is all about visualizing the things by using models organized around real world concepts. Object-Oriented Modeling helps in understanding problems, communicating with experts from distance, modeling enterprises, designing programs and databases. In Object-Oriented Modeling, the modeling passes through following processes:
- System Analysis
- System Design
- Object Design
- Final Implementation
For a system description, the object-oriented model can be covered by 3 models
- Object Model
- Dynamic Model
- Function Model
Object Modeling
Object modeling are used for describing the objects in the system and their relationship among each other in the system.
Class and Objects
An object is a real-world element in an object-oriented environment that may have a physical or a conceptual existence. An object may have a physical existence like a customer, a car etc, or; an intangible conceptual existence like a project, a process etc.
A class represents a collection of objects having same characteristics properties that exhibit common behavior. It gives a blueprint or prototype of description of objects that can be created from it. Creation of object as a member of a class is called instantiation. Thus, object is an instance of a class.
The notation of a class is a box with three sections. The top section contains the name of class in boldface type, the middle section contains the attributes that belong to the class and the bottom section contains the class operations.
We can also show a class without attributes or its operations, or the name of class can appear by itself.
The notation for an object is the same as that for a class. There are three differences between the notations which are:
- In the top section, the object may have a name which appears before the colon or it may be anonymous in which nothing appears before the colon.
- The contents of the top compartments are underlined for an object.
- Each attribute defined for the given class has a specific value for each object belongs to the class.
Generalization and Specialization
In the generalization process, the common characteristics of classes are combined to form a class in a higher level of hierarchy i.e., sub-classes are combined to form a generalized super-class.
Specialization is the reverse process of generalization. Here, the distinguishing features are used to form specialized classes form existing classes. It can be said that the sub-classes are the specialized versions of the super-class.
Inheritance
The mechanism of acquiring objects and properties from other class is known as inheritance. Inheritance is used to borrow properties and methods from an existing class. Inheritance helps us create classes based on existing classes, which increases the code's reusability.
Links and Association
A link represents a connection through which an object collaborates with another object. In other words, a link represents the relationship between two or more objects. Through a link, one object may invoke(call) the methods or navigate through another object.
Association represents the relationship between objects of one or more classes. Association is a group of links having common structure and common behavior. A link can be defined as an instance of an association.
Degree of Association
Degree of an association denotes the number of classes involved in a connection.
- A unary relationship connects objects of the same class.
- A binary relationship connects objects of two classes.
- A ternary relationship connects objects of three or more classes.
Cardinality Ratios of Associations
Cardinality of a binary association denotes the number of instances participating in an association.
- One-to-One: A single object of class A is associated with a single object of class B.
- One-to-Many: A single object of class A is associated with many objects of class B.
- Many-to-Many: An object of class A may be associated with many objects of class B and conversely an object of class B may be associated with many objects of class A.
Aggregation and Composition
Aggregation is the weak association. An association is said to be aggregated if both objects can exist independently. Example: For an object Bank and another object Employee. The Bank contains many employees, so Bank can exist without an Employee and a Employee can exist without a Bank
Composition is the strong association. An association is said to be composition if an object own another object i.e. both can't exist without each others existence. Example: Human object contains an object Heart. Without Human, Heart can't exist and without Heart, Human can't exist.
Benefits of Object Model
The benefits of using object model are:
- It helps in faster development of software.
- It is easy to maintain.
- It enables reuse of objects, designs and functions.
- It reduces development risks, particularly in integration of complex systems.
- It supports relatively hassle-free upgrades.
Process of Object Modeling
- Identify associations between classes.
- Identify attributes of objects.
- Identify links between objects.
- Organize and simplify object classes using inheritances.
- Iterate and refine the model.
- Group classes into modules.
Comments
Post a Comment