Dasdsad
Dasdsad
Programming
Oakar Htet
Date
9,16,2023
Course title
Object Oriented
Programming
Table of Contents
Importance of encapsulation, polymorphism and inheritance on object-oriented
programming......................................................................................................................3
Encapsulation..................................................................................................................3
Polymorphism.................................................................................................................3
Inheritance......................................................................................................................3
Suitability of object-oriented programs for graphical applications...................................4
Encapsulation
In object-oriented programming (OOP), encapsulation is the practice of bundling
related data into a structured unit, along with the methods used to work with that data.
Most OOP languages implement encapsulation primarily through classes and the
objects instantiated through those classes. A class defines a set of attributes for the
data and the methods used to carry out operations related to the data. (Sheldon, 2023)
Polymorphism
Polymorphism is one of the core concepts of object-oriented programming (OOP) that
describes situations in which something occurs in several different forms. In computer
science, polymorphism describes the concept that you can access objects of different
types through the same interface. Each type can provide its own independent
implementation of this interface.
You can perform a simple test to know whether an object is polymorphic. If the object
successfully passes multiple is-a or instance of tests, it’s polymorphic. (Thorben, 2021)
Inheritance
Inheritance refers to the assets that an individual bequeaths to their loved ones after
they pass away. An inheritance may contain cash, investments such as stocks or bonds,
and other assets such as jewelry, automobiles, art, antiques, and real estate.
(BLOOMENTHAL, 2022)
Strengths of OOP:
1. Reusability: OOP allows developers to create code that can be reused in different
parts of an application. This makes development faster and more efficient because
developers do not have to write new code from scratch each time they need to
create a new feature.
2. Modularity: OOP allows developers to break down complex systems into smaller,
more manageable modules. This makes it easier to develop, test, and maintain
code because changes made to one module do not affect other parts of the
system.
5. The principle of data hiding helps the programmer to build secure programs
which cannot be invaded by the code in other parts of the program.
1. Steep Learning Curve: OOP is a complex paradigm, and it can take time for
developers to become proficient in it. The concepts of inheritance, polymorphism,
and encapsulation can be difficult to understand for beginners.
2. Overhead: OOP code can be more verbose than code written in other paradigms,
which can result in slower performance. Additionally, OOP often requires more
memory and processing power than other paradigms.
3. Complexity: OOP can lead to complex code, especially when dealing with large
systems that have many interdependent objects. This complexity can make it
more difficult to debug and maintain code.
4. Limited Reusability: Although OOP allows for code reusability, it can also lead to
tightly coupled code that is difficult to reuse in other contexts. This can make it
challenging to maintain the codebase in the long run.
5. The length of the programmes developed using OOP language is much larger than
the procedural approach. Since the programme becomes larger in size, it requires
more time to be executed that leads to slower execution of the programme.
6. OOPs take time to get used to it. The thought process involved in object-oriented
programming may not be natural for some people.
In conclusion, OOP has several advantages and disadvantages. The advantages of OOP
include reusability, modularity, encapsulation, and inheritance. These features make it
easier to develop, test, and maintain code. However, OOP also has some disadvantages,
including a steep learning curve, overhead, complexity, and limited reusability. As with
any programming paradigm, developers must weigh the pros and cons of OOP when
deciding whether to use it for a particular project. (Mandl, 2023)