Object-oriented Design (OOD)
Learn via video courses
Overview
Object-oriented design (OOD) is the process of creating a software system or application utilizing an object-oriented paradigm. This technique permits the creation of a software solution based on object notion. OOD is an implementation of the object-oriented programming (OOP) paradigm.
What is Object Oriented Design?
In the object-oriented design method, the system is considered a collection of objects (i.e., entities). The state is shared among the objects, and each object is responsible for its own state data. Tasks designed for a specific purpose cannot refer to or update data from other objects. Objects have internal data that represents their current state. Similar objects form a class. In other words, every object belongs to a class.
Important Terms Related to Object-Oriented Design
- Objects: Objects are all the entities involved in the solution design. Persons, banks, companies, and users are all examples of objects. Every object has some properties associated with it, along with some methods for performing operations on those attributes.
- Class: Classes are generic descriptions of objects. An object is a class instance. A class defines all the properties an object can have and the methods that represent the object's functionality.
- Messages: Objects communicate by passing messages. Messages contain the target object's integrity, the name of the requested operation, and any other action required to complete the function. Messages are frequently implemented through procedure or function calls.
- Abstraction: Abstraction is used in object-oriented design to deal with complexity. Abstraction is the removal of the unnecessary and the amplification of the necessary.
- Encapsulation: It is also known as information concealing. The processes and data are tied to a single unit. Encapsulation not only groups together an object's vital information but also restricts access to the data and operations from the outside world.
- Inheritance: OOD allows similar classes to be stacked hierarchically, with lower or sub-classes being able to import, implement, and reuse variables and functions from their immediate superclasses. This OOD characteristic is known as inheritance. This facilitates the definition of specialized classes as well as the creation of generic classes.
- Polymorphism: OOD languages give a technique for assigning the same name to methods that perform similar functions but differ in arguments. This is referred to as polymorphism, and it allows a single interface to perform functions for multiple types. The relevant piece of the code is run depending on how the service is invoked.
Stages of Object-Oriented Design
The object-oriented design process includes two main stages:
- System design
- Object design.
System Design
The entire architecture of the intended system is designed at this stage. The system is envisioned as a collection ofinteracting subsystems, each comprising a hierarchy of interacting objects classified into classes. The system analysis model and the proposed system architecture are used to design the system. The emphasis here is on the system's objects rather than the system's processes.
Object Design
A design model is created in this phase based on the models created in the system analysis phase and the architecture built in the system design phase. All of the requisite classes have been recognized. The relationships between the specified classes are established, and class hierarchies are identified. In addition, the developer creates the internal details of the classes and their relationships, such as the data structure for each attribute and the algorithms for the operations.
Object-Oriented Decomposition
Decomposition is the process of dividing a vast, complicated system into a hierarchy of smaller components with lower complexities based on divide-and-conquer concept. Each significant component of the system is referred to as a subsystem. Object-oriented decomposition identifies individual autonomous objects in a system and their communication. Individual components are **less complex, making them more understandable and manageable. It allows for the division of labor with specialized talents. It enables subsystems to be changed or modified without affecting other subsystems.
Concurrency Identification
Concurrency allows multiple objects to receive events at the same time and multiple activities to be completed simultaneously. To support concurrency, each concurrent element is given its own control thread. If the concurrency is at the object level, two concurrent objects are given separate threads of control. Likewise, if two operations on a single object are concurrent, the object is divided among different threads. Concurrency can be plagued with issues such as data integrity, deadlock, and starvation. When concurrency is required, a clear strategy to tackle these issues must be developed. Furthermore, concurrency must be discovered during the design stage and cannot be ignored till the implementation stage.
Pattern Identification in OOD
Patterns are conventional solutions to common challenges in object-oriented design. A Software Design Pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. A design pattern systematically describes and explains a general design that handles a recurring design challenge in object-oriented systems. It discusses the problem, the remedy when to use it, and the repercussions. It also provides implementation guidance and examples. A pattern in object-oriented programming might include the description of specific objects and object classes to be utilized, their properties and dependencies, and the overall strategy for solving the problem.
Controlling Events in OOD
During system design, the events that may occur in the system's objects must be identified and dealt with effectively. An event is a description of a noteworthy occurrence with a time and geographical location. There are four sorts of events that can be represented, which are as follows:
- Signal event: A signal event is a named item thrown by one object and caught by another.
- Call event: A synchronous event that represents the dispatch of an operation.
- Time event: A time event is an occurrence that represents the passage of time.
- Change event: A change event represents a state change.
Boundary Conditions Handling in OOD
The initiation and termination of the system as a whole, as well as each subsystem, must be addressed throughout the system design process. Boundary use cases illustrate boundary conditions. The following are some aspects that are documented:
- The system's startup, or the shift from a non-initialized state to a stable state.
- The system is terminated, which includes the shutdown of all running threads, the cleanup of resources, and the messages to be sent.
- The initial configuration of the system and its adjustment when needed.
- Predicting system failures or unintended system shutdown.
Design of Object
The object design process comprises the following tasks:
- Object recognition
- Object representation, or the creation of design models
- Operation classification
- Design of algorithms
- Relationship design
- Control implementation for external interactions
- Modularize classes and connections.
Relationships Designing
During the object design phase, the strategy for implementing the relationships must be developed. Associations, aggregations, and inheritances are some of the common relationships. The designer should address things like identifying whether an association is unidirectional or bidirectional, etc.
Packaging Classes in OOD
A package is a namespace that organizes a set of related classes and interfaces. The thorough partitioning of an implementation into modules or packages is critical in any major project. Classes and objects are bundled into packages during object design to allow several groups to collaborate on a project.
Optimizing the Design
Before implementing a design, it should be optimized to make the implementation more efficient. Optimization aims to reduce costs in time, space, and other metrics. However, excessive design optimization should be avoided because ease of implementation, maintainability, and extensibility are also significant considerations. A perfectly optimized design is often more efficient but less understandable and reusable. As a result, the designer must find a happy middle ground between the two.
Documentation of Design
Documentation is an essential aspect of any software development process since it records the steps involved in creating the product. For any non-trivial software system, design decisions must be documented in order to be transmitted to others.
Conclusion
- In the object-oriented design method, the system is considered a collection of objects (i.e., entities).
- Classes are generic descriptions of objects. An object is a class instance. A class defines all the properties an object can have and the methods that represent the object's functionality.
- Abstraction is used in object-oriented design to deal with complexity. Abstraction is the removal of the unnecessary and the amplification of the necessary.
- OOD allows similar classes to be stacked hierarchically, with lower or sub-classes able to import, implement, and reuse variables and functions from their immediate superclasses. This OOD characteristic is known as inheritance.
- Encapsulation is also known as information concealing. The processes and data are tied to a single unit.
- OOD languages give a technique for assigning the same name to methods that perform similar functions but differ in arguments. This is referred to as polymorphism.