Presented by
Deborah Ewurama Minka Akuoko…
OOP BASIC OVERVIEW
… USING C++
A program = software = application = a set of instructions organised to
perform specific activities when executed or run…
A program is written by a programming language. e.g c++
WHAT IN THE FIRST PLACE IS A PROGRAM ?
❖ Object oriented programming - OOP
❖ Programmer thinks about and defines the attributes and behavior of real
life objects but does it in a logical way.
❖ Often the objects are modeled after real-world entities.
❖ Very different approach than function-based programming (like C).
WHAT IS OOP
❖ Unstructured
❖ Procedural
❖ Modular or Structured
❖ Object Oriented Programming
KINDS OF PROGRAMMING TECHNIQUES
Usually, people st to learn a programming language by writing small
and simple programs that consist mainly of one main program.
Here the term ―main programǁ stands for a sequence of commands or statements,
which modify global data, throughout the whole program. Figure 1
illustrates this concept.
Unstructured programming techniques provide tremendous
disadvantages once a program gets sufficiently large.
For example, if the same statement sequence is needed at different locations within the program,
the same sequence of statements must be repeatedly copied to
the new locations.
UNSTRUCTURED
The natural improvement to the unstructured programming technique was the introduction of the
Procedural Programming technique.
In such a technique, a sequence of instructions used to perform a specific task
are grouped together and then called a Program.
The main program directly operates on global data needed. The grouping of such
instructions is called a Procedure.
PROCEDURAL
In procedural programming, a single program is divided into smaller pieces called procedures. To
enable the usage of general procedures, or groups of procedures, in other programs, such
procedures must be separately available.
Modular programming allows the grouping of procedures into what is known as modules.
With modular programming, procedures of common functionality are
grouped together into separate modules.
A program therefore no longer consists of only one single part rather is now divided into several
smaller parts which interact with each other through procedure calls. Each module can have its own
data. This allows each - module to manage an internal state that is modified by calls to procedures
of this module.
However, there is only one state per module and each module
exists at most once in the whole program.
MODULAR OR STRUCTURED
Due to the problems rose with the former techniques of programming; especially, when programs
get larger, the object- oriented programming was introduced as a new programming technique.
Many object-oriented programming languages were Implemented and introduced for this technique;
however, C++ was one of the most powerful true object oriented languages that were introduced
OOP
Object:
This is the basic unit of object oriented programming. That is both data and function that operate
on data are bundled as a unit called object.
Class:
When you define a class, you define a blueprint for an object. This doesn't actually define any data,
but it does define what the class name means, that is, what an object of the class will consist of
and what operations can be performed on such an object.
Abstraction:
Data abstraction refers to, providing only essential information to the outside world and hiding their
background details, i.e., to represent the needed information in program without presenting the
details.
For example, a database system hides certain details of how data is stored and created and
maintained. Similar way, C++ classes provides different methods to the outside world without giving
internal detail about those methods and data.
OOP FEATURES
Encapsulation:
Encapsulation is placing the data and the functions that work on that data in the same place. While
working with procedural languages, it is not always clear which functions work on which variables
but object-oriented programming provides you framework to place the data and the relevant
functions together in the same object.
Inheritance:
One of the most useful aspects of object-oriented programming is code reusability. As the name
suggests Inheritance is the process of forming a new class from an existing class that is from the
existing class called as base class, new class is formed called as derived class.
This is a very important concept of object-oriented programming since this feature helps to reduce
the code size.
OOP FEATURES
Polymorphism:
The ability to use an operator or function in different ways in other words giving different meaning
or functions to the operators or functions is called polymorphism. Poly refers to many. That is a
single function or an operator functioning in many ways different upon the usage is called
polymorphism.
Overloading:
The concept of overloading is also a branch of polymorphism. When the exiting operator or function
is made to operate on new data type, it is said to be overloaded.
OOP FEATURES
❖ Improved software-development productivity: Object-oriented programming is modular, as it
provides separation of duties in object-based program development. Each object exists
independently.
➢ Objects can also be reused within an across applications.
■ Because of these three factors – modularity, extensibility, and reusability – object-
oriented programming provides improved software-development productivity over
traditional procedure-based programming techniques.
❖ Improved software maintainability: For the reasons mentioned above, object-oriented software
is also easier to maintain.
➢ Since the design is modular, part of the system can be updated in case of issues without a
need to make large-scale changes.
OOP ADVANTAGES
❖ Faster development: Reuse enables faster development.
➢ Object-oriented programming languages come with rich libraries of objects, and code
developed during projects is also reusable in future projects
❖ Lower cost of development: The reuse of software also lowers the cost of
development. Typically, more effort is put into the object-oriented analysis and
design, which lowers the overall cost of development
OOP ADVANTAGES
❖ Higher-quality software: Faster development of software and lower cost of development allows
more time and resources to be used in the verification of the software. Although quality is
dependent upon the experience of the teams, object-oriented programming tends to result in
higher-quality software.
OOP ADVANTAGES
❖ Steep learning curve: The thought process involved in object-oriented programming may not be
natural for some people, and it can take time to get used to it.
➢ It is complex to create programs based on interaction of objects.
■ Some of the key programming techniques, such as inheritance and polymorphism, can
be challenging to comprehend initially.
❖ Larger program size: Object-oriented programs typically involve more lines of code than
procedural programs.
OOP DISADVANTAGES
❖ Slower programs: Object-oriented programs are typically slower than procedure-based programs,
as they typically require more instructions to be executed.
❖ Not suitable for all types of problems: There are problems that lend themselves well to
functional-programming style, logic-programming style, or procedure-based programming style,
and applying object-oriented programming in those situations will not result in efficient programs
OOP DISADVANTAGES
❖ User interface design such as windows, menu ,…
❖ Real Time Systems
❖ Simulation and Modeling
❖ Object oriented databases
❖ AI and Expert System
❖ Neural Networks and parallel programming
❖ Decision support and office automation system
OOP APPLICATIONS