Sunteți pe pagina 1din 11

PRACTICAL ASSIGNMENT ON OBJECT

ORIENTED PROGRAMMING USING C++

PRESENTED BY GROUP 1

OLATUNJI FATAI ABIODUN HC201602244

SALAKO RACHAEL BOSEDE HC201601641

ANIKWUE EMMANUEL DUMEBI HC201600258

ALAMU AKOREDE TAOREED HC201601424

ADEWOLE ADEFUNKE ELIZABETH


HC201602193

OLAWALE MUJEEB O. HC201601836

OLAREWAJU WASIU S. HC201601972

SIJUADE TEJUMADE A. HC201600109

AJAO AISHAT ADEOLA HC201602914

Submitted to

Computer Science Department

School of Applied Sciences

The Federal Polytechnic, Ede

May 2016
OBJECT ORIENTED PROGRAMMING

Object Oriented Programming is a programming style that is associated with the concept of
Class, Objects and various other concepts revolving around these two, like Inheritance,
Polymorphism, Abstraction, Encapsulation etc.

Fig 1: Basic OOP Concept

Object Oriented Programming Concept Definitions:

1. Objects

Objects are basic run-time entities in an object oriented system, objects are instances of a class
these are defined user defined data types. Object take up space in memory and have an
associated address like a record in pascal or structure or union in C.

When a program is executed the objects interact by sending messages to one another. Each object
contains data and code to manipulate the data. Objects can interact without having to know
details of each other data or code, it is sufficient to know the type of message accepted and type
of response returned by the objects.
2. Class

Class is a blueprint of data and functions or methods. Class does not take any space. Class can
also be defined as user defined data type but it also contains functions in it. So, class is basically
a blueprint for object. It declare & defines what data variables the object will have and what
operations can be performed on the class's object.

3. Encapsulation

Wrapping up(combing) of data and functions into a single unit is known as encapsulation. The
data is not accessible to the outside world and only those functions which are wrapping in the
class can access it. This insulation of the data from direct access by the program is called data
hiding or information hiding.

4. Data abstraction

Data abstraction refers to, providing only needed information to the outside world and hiding
implementation details. For example, consider a class Complex with public functions as
getReal() and getImag(). We may implement the class as an array of size 2 or as two variables.
The advantage of abstractions is, we can change implementation at any point, users of Complex
class wontt be affected as out method interface remains same. Had our implementation be
public, we would not have been able to change it.

5. Inheritance

Inheritance is the process by which objects of one class acquire the properties of objects of
another class. It supports the concept of hierarchical classification. Inheritance provides re
usability. This means that we can add additional features to an existing class without modifying
it.

6. Polymorphism

Polymorphism means ability to take more than one form. An operation may exhibit different
behaviors in different instances. The behavior depends upon the types of data used in the
operation.
C++ supports operator overloading and function overloading.

Operator overloading is the process of making an operator to exhibit different behaviors in


different instances is known as operator overloading. Function overloading is using a single
function name to perform different types of tasks. Polymorphism is extensively used in
implementing inheritance.

7. Dynamic Binding

In dynamic binding, the code to be executed in response to function call is decided at runtime.
C++ has virtual functions to support this.

8. Message Passing

Objects communicate with one another by sending and receiving information to each other. A
message for an object is a request for execution of a procedure and therefore will invoke a
function in the receiving object that generates the desired results. Message passing involves
specifying the name of the object, the name of the function and the information to be sent

CHOICE OF C++ AGAINST OTHERS PROGRAMMING LANGUAGE

C++ is a multi-paradigm language, meaning it supports programming models on top of


procedural and object oriented, including generic programming and meta-programming.

C++ also supports programming abstractions such as exceptions, operators & operator
overloading, and lamba functions that aren't particular to one programming model.

C++ also provides the Standard Template Library (STL), a set of templatized objects that enable
object oriented and generic programming through value-agnostic container classes and
algorithms. For example, there are queues & hash sets that can contain any type and sorts &
searches that can operate on any container.

Conciseness: programming languages allow us to express common sequences of commands


more concisely. C++ provides some especially powerful shorthands.
Maintainability: modifying code is easier when it entails just a few text edits, instead of
rearranging hundreds of processor instructions. C++ is object oriented, which further improves
maintainability.

Portability: different processors make different instructions available. Programs writ ten as text
can be translated into instructions for many different processors; one of C++s strengths is that it
can be used to write programs for nearly any processor

OBJECT ORIENTED TECHNOLOGIES

Object Oriented Design

Object Oriented Design is the concept that forces programmers to plan out their code in order to
have a better flowing program. The origin of object oriented design is debated, but the first
languages that supported it included Simula and SmallTalk. The term did not become popular
until Grady Booch wrote the first paper titled Object-Oriented Design, in 1982.

Object Oriented Design is defined as a programming language that has 5 conceptual tools to aid
the programmer. These programs are often more readable than non-object oriented programs, and
debugging becomes easier with locality.

Object Oriented Design (OOD) Language Concepts

The 5 Basic Concepts of Object Oriented Design are the implementation level features that are
built into the programming language. These features are often referred to by these common
names:

Encapsulation: A tight coupling or association of data structures with the methods or


functions that act on the data. This is called a class, or object (an object is often the
implementation of a class).
Data Protection: The ability to protect some components of the object from external
entities. This is realized by language keywords to enable a variable to be declared as
private or protected to the owning class.
Inheritance: The ability for a class to extend or override functionality of another class.
The so called child class has a whole section that is the parent class and then it has its
own set of functions and data
Interface: A definition of functions or methods, and their signatures that are available for
use to manipulate a given instance of an object
Polymorphism: The ability to define different functions or classes as having the same
name but taking different data types.

OOD Programming Concept

There are several concepts that were derived from the new languages once they became popular.
The new standards that came around pushed on three major things:

Code Re-usability: The ability to reuse code for multiple applications. If a programmer
has already written a power function, then it should be written that any program can make
a call to that function and it should work exactly the same.
Privacy: This is important for large programs and preventing loss of data.
Documentation: The commenting of a program in markup that will not be converted to
machine code. This markup can be as long as the programmer wants, and allows for
comprehensive information to be passed on to new programmers. This is important for
both the re-usability and the maintainability of programs

Object Oriented Programming (OOP)

Object-oriented programming (OOP) is a programming language model organized around


objects rather than "actions" and data rather than logic. Historically, a program has been viewed
as a logical procedure that takes input data, processes it, and produces output data.

The programming challenge was seen as how to write the logic, not how to define the data.
Object-oriented programming takes the view that what we really care about are the objects we
want to manipulate rather than the logic required to manipulate them. Examples of objects range
from human beings (described by name, address, and so forth) to buildings and floors (whose
properties can be described and managed) down to the little widgets on a computer desktop (such
as buttons and scroll bars).
The first step in OOP is to identify all the objects the programmer wants to manipulate and how
they relate to each other, an exercise often known as data modeling. Once an object has been
identified, it is generalized as a class of objects which defines the kind of data it contains and any
logic sequences that can manipulate it. Each distinct logic sequence is known as a method.
Objects communicate with well-defined interfaces called messages.

The concepts and rules used in object-oriented programming provide these important benefits:

The concept of a data class makes it possible to define subclasses of data objects that
share some or all of the main class characteristics. Called inheritance, this property of
OOP forces a more thorough data analysis, reduces development time, and ensures more
accurate coding.
Since a class defines only the data it needs to be concerned with, when an instance of that
class (an object) is run, the code will not be able to accidentally access other program
data. This characteristic of data hiding provides greater system security and avoids
unintended data corruption.
The definition of a class is reuseable not only by the program for which it is initially
created but also by other object-oriented programs (and, for this reason, can be more
easily distributed for use in networks).
The concept of data classes allows a programmer to create any new data type that is not
already defined in the language itself.

Simula was the first object-oriented programming language. Java, Python, C++, Visual Basic
.NET and Ruby are the most popular OOP languages today.

Object Oriented Analysis and Design (OOAD)

Object-oriented analysis and design (OOAD) is a technical approach used in the analysis and
design of an application or system through the application of the object-oriented paradigm and
concepts including visual modeling. This is applied throughout the development life cycle of the
application or system, fostering better product quality and even encouraging stakeholder
participation and communication.

Software and computer application systems are incredibly complex concepts since there are few
material restrictions and a lot of possible arbitrary reconstructions. Contrast that to things like
bridge or building design, where the concept of a bridge or building is defined by the materials to
be used and the nature of the environment it is built upon, which results in few options. Software
does not enjoy the same restrictions, and the room for complexity to grow is very large. This is
where object-oriented analysis and design comes into play. It uses abstraction as a tool to
encapsulate complexity, and the more abstractions are introduced, the greater is the reduction in
complexity. These acts of abstraction and encapsulation allow for certain problems to be
highlighted and subsequently suppressed.

OOAD is best applied iteratively since there is no clear process involved, but each aspect where
OOAD is applied is refined as it is reused. This is because major portions of the designs are
based on the entire aspects of the system and on the entities rather than on individual functions
and code. This enforces the modular approach of OOAD whose goal is to break down the
problem or the system into smaller units, called objects that can stand on their own and be
changed without affecting the ones around them too much. This makes it easy to add
functionality and behavior and allow the system to gracefully accept change.

Object Oriented Database (OODB)

Object oriented databases are also called Object Database Management Systems (ODBMS).
Object databases store objects rather than data such as integers, strings or real numbers. Objects
are used in object oriented languages such as Smalltalk, C++, Java, and others. Objects basically
consist of the following:

Attributes - Attributes are data which defines the characteristics of an object. This data
may be simple such as integers, strings, and real numbers or it may be a reference to a
complex object.
Methods - Methods define the behavior of an object and are what was formally called
procedures or functions

Therefore objects contain both executable code and data. There are other characteristics of
objects such as whether methods or data can be accessed from outside the object. We don't
consider this here, to keep the definition simple and to apply it to what an object database is. One
other term worth mentioning is classes. Classes are used in object oriented programming to
define the data and methods the object will contain. The class is like a template to the object. The
class does not itself contain data or methods but defines the data and methods contained in the
object. The class is used to create (instantiate) the object. Classes may be used in object
databases to recreate parts of the object that may not actually be stored in the database. Methods
may not be stored in the database and may be recreated by using a class.

When to Use Object Databases?

Object databases should be used when there is complex data and/or complex data relationships.
This includes a many to many object relationship. Object databases should not be used when
there would be few join tables and there are large volumes of simple transactional data.

Object databases work well with:

CAS Applications (CASE-computer aided software engineering, CAD-computer aided


design, CAM-computer aided manufacture)
Multimedia Applications
Object projects that change over time.
Commerce

Object Oriented Database Advantages

Objects don't require assembly and disassembly saving coding time and execution time to
assemble or disassemble objects.
Reduced paging
Easier navigation
Better concurrency control - A hierarchy of objects may be locked.
Data model is based on the real world.
Works well for distributed architectures.
Less code required when applications are object oriented.

How data is stored in OODBM?

Two basic methods are used to store objects by different database vendors.

Each object has a unique ID and is defined as a subclass of a base class, using inheritance
to determine attributes.
Virtual memory mapping is used for object storage and management.

Data transfers are either done on a per object basis or on a per page (normally 4K) basis.
References

Basic Concepts of Object Oriented Programming using C++ - GeeksforGeeks Blog Post.
GeeksforGeeks n.d Web. < http://www.geeksforgeeks.org/basic-concepts-of-object-
oriented-programming-using-c/>

"Object Oriented Databases "comptech.org. Object Oriented Database, n.d. Web.


<http://www.comptechdoc.org/independent/database/basicdb/dataobject.html>.

"What is Object-Oriented Analysis and Design (OOAD)? - Definition from Techopedia " Blog post.
Techopedia.com. Definition from WhatIs, n.d. Web.
<https://www.techopedia.com/definition/21104/object-oriented-analysis-and-design-
ooad>.

"What is Object Oriented Design? (OOD) | Process Maturity | FAQ " Blog post. selectcbs.com.
Definition from Process Maturity, n.d. Web. <http://www.selectbs.com/process-
maturity/what-is-object-oriented-design>.

"What Is Object Oriented Programming?"WhatIs.com. Definition from WhatIs, n.d. Web.


<http://searchmicroservices.techtarget.com/definition/object-oriented-programming-
OOP>

S-ar putea să vă placă și