Features of OOD
Learn via video courses
Overview
Although the roots of Object Oriented Design (OOD) are unknown, the first languages to enable it was Simula and SmallTalk. Grady Booch's 1982 work titled "Object-Oriented Design" was the first to popularise the phrase. This software design style's primary goal is to identify the classes and connections required to develop a system that meets the Software Requirement Specifications.
Scope
In this article,
- We understand what object-oriented programming is.
- We briefly explain some important terms related to the object-oriented design paradigm.
- Using real-world examples, we discuss some fundamental concepts of object-oriented design, namely abstraction, encapsulation, polymorphism, and inheritance.
Introduction
Object Oriented Design (OOD) is a component of the entire object-oriented programming (OOP) approach. It is primarily the process of designing a computing system or application utilising an object-oriented methodology. This technique permits the creation of software based on object notions. Furthermore, it is a concept that forces programmers to plan out their code in order to create a more fluid software.
Furthermore, it is the discipline of defining the objects and their interactions in order to address a problem recognised and documented during the Object Oriented Analysis (OOA). Object Oriented Design (OOD) is a design method that includes the process of object oriented decomposition as well as a notation for describing both logical and physical representations of the system under design.
Terms Related to Object-Oriented Design
Object
Objects are all of the entities involved in the solution design. Persons, cars, companies, and users are all examples of objects. Every object has some attributes associated with it, as well as some methods for performing operations on those attributes.
Class
A class is an object's generalised description. It can be viewed as a collection of objects. An object is a class instance. A class defines all of the properties that an object can have, as well as the methods that represent the object's functionality.
Message
Message passage is how objects communicate. Messages contain:
- The target object's integrity.
- The name of the requested operation.
- Any other action required to complete the function.
Messages are usually implemented through procedure or function calls.
Members
Objects are capable of having their own methods, variables, and constants. An object's members or features are all of the variables, constants, and methods associated with it.
Object-Oriented Design Concepts
The technology-independent concepts in the analysis domain are translated onto implementing classes in Object Oriented Design (OOD), constraints are defined, and interfaces are designed, resulting in a model for the solution domain. In short, a thorough description is written to define how the system will be created using specific technologies. Furthermore, Object Oriented Design (OOD) employs a number of principles to achieve these objectives, each of which serves a distinct purpose and is extremely important.
Abstraction
One of the most fundamental and significant components of object-oriented programming is data abstraction. Abstraction refers to hiding the details and presenting simply the most important information. Most programming languages implement abstraction in the following ways:
- Abstraction with Classes: Classes can be used to implement abstraction. The class enables us to group data members and member methods. Which data member is visible to the public and which is not can be determined by a class using available access specifiers.
- Abstraction in header files: Header files are yet another form of abstraction in most programming languages. Take the pow() method in C++ from the math.h header file as an example. Without understanding the underlying algorithm used by the function to compute the power of numbers, we simply call the function pow() found in the math.h header file whenever we need to determine the power of a number.
Real-Life Example
Take a man operating a vehicle in the actual world as an example. The man only understands that pressing the accelerators will make the automobile go faster and that applying the brakes will make the car stop, but he is unaware of the inner workings of the car or how the accelerator, brakes, and other controls are implemented. This is what is meant by abstraction.
Encapsulation
Encapsulation is the process of concealing information. It simply combines process and data into a single entity. The data of an object is concealed from the rest of the system and is only accessible through the class's functions. It enables object methods to be improved or modified without affecting other components of a system.
Real-Life Example
Consider a real-world example of encapsulation: in a firm, there are various divisions such as the accounts section, the finance section, the sales section, and so on. The finance sector manages all financial transactions and keeps track of all financial data. Similarly, the sales section is in charge of all sales-related activities and maintains track of all sales. Now and again, an official from the finance department may require some data from the sales department. In this instance, he is not permitted to access the sales section's data directly. Instead, he must first contact another officer in the sales section and obtain specific data from him.
Polymorphism
Polymorphism is defined as having several forms. Polymorphism is defined as the ability of a message to be displayed in more than one form. Most programming languages implement polymorphism in the following ways:
- Operator Overloading: Operator overloading is the process of causing an operator to demonstrate different behaviours in different situations.
- Function Overloading: Function overloading is the use of a single function name to accomplish several functions.
Real-Life Example
A person can have multiple characteristics at the same time. A man is a father, a husband, and an employee, all at the same time. As a result, the same person behaves differently in different settings. This is known as polymorphism.
Inheritance
OOD allows similar classes to be stacked up in a hierarchical way, 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 specialised classes as well as the creation of generic classes from specific ones.
Real-Life Example
'Dog', 'Cat', and 'Cow' can be the derived classes which inherit from the 'Animal' base class.
Conclusion
- Object-oriented programming tries to implement real-world concepts in programming, such as inheritance, hiding, polymorphism, etc.
- The primary goal of OOP is to connect the data and the functions that operate on it so that no other part of the code may access the data except that function.
- This software design technique is mostly used to develop a system of interacting objects and address a software challenge, which aids software developers and programmers in creating software with exceptional features and qualities.