Lecture 1 :
Course Objective:
Objective of this course is to make students
familiar with the concepts of object oriented programming. These concepts
will be reinforced by their implementation in C++.
Course Contents:
The main topics that we will study in the 45
lectures of this course are given below,
·
Object Orientation
·
Objects and Classes
·
Overloading
·
Inheritance
·
Polymorphism
·
Generic Programming
·
Exception Handling
·
Introduction to Design
Patterns
Recommended Text
Book:
C++ How to Program
( Deitel & Deitel )
Reference Books:
By Jacobson,
Christerson, Jonsson, Overgaard
(For object
oriented programming introductory concepts)
By Bjarne
Stroustrup
(For better
c++ understanding)
|
Object-Orientation (OO)
What is Object-Orientation?
It is a technique in which we visualize our programming
problems in the form of objects and their interactions as happens in real life.
Examples:
We have different objects around us in our real
life that interact with each other to perform different operations for example,
Take another example of a School; the
objects in a school are student, teacher, books, pen ,school
bag, classroom, parents, playground and so on… ,
Objects in a School
Suppose we want to develop a fee collection system
for a school for this we will need to find out related objects and their
interactions as happens in real life.
In this way we can say that object orientation makes
it easier for us to solve our real world problems by thinking solution
of the problem in terms of real world objects.
So we can say that in our daily life everything can be taken as an
object that behaves in a certain way and has certain attributes.
In object orientation we move our concentration to
objects in contrast to procedural paradigm in which we simply write our code in
functions and call them in our main program.
A model is an abstraction
of something real or conceptual.
We need models to
understand an aspect of reality.
Model Examples
Highway maps
Architectural models
Mechanical models
In the context of programming models are used to
understand the problem before starting developing it.
We make Object Oriented models showing several
interacting objects to understand a system given to us for implementation.
Example 1– Object Oriented Model
As Object Oriented Models map directly to reality
as we have seen in examples above therefore,
We can easily develop
an object oriented model for a problem.
Everyone can easily understand an object oriented model.
We can easily implement an object oriented model
for a problem using any object oriented language like c++ using its features like classes, inheritance, virtual functions and so on…
An object is,
- Something tangible (Ali, School, House, Car).
- Something conceptual (that can be apprehended intellectually for
example time, date and so on…).
An object has,
- State (attributes)
- Well-defined behavior (operations)
- Unique identity
Examples of Tangible Objects:
Ali is a tangible object, having some
characteristics (attributes) and behavior as given below,
Ali
|
|
Characteristics (attributes)
|
Behaviour (operations)
|
Name
Age
|
Walks
Eats
|
We will identify Ali using his name.
Car is also a tangible object having some
characteristics (attributes) and behavior given below,
Car
|
|
State (attributes)
|
Behavior (operations)
|
Color
Model
|
Accelerate
Start Car
Change Gear
|
We can identify Car using its registration number
Examples of Intangible Objects (also called as conceptual objects):
Time is an intangible (conceptual) object
Time
|
|
State (attributes)
|
Behavior (operations)
|
Hours
Seconds
Minutes
|
Set/Get Hours
Set/Get Seconds
Set/Get Minutes
|
We will assign our own generated unique ID in the
model for Time object
Date is also an intangible (conceptual) object
State (attributes)
Year
Day
Month
|
Behavior (operations)
Set/Get Year
Set/Get Day
Set/Get Month
|
We will assign our own generated unique ID in the
model for Date object.
·
Model is the abstraction of some real word scenario.
It helps us to understand that scenario.
·
Object oriented model of any scenario (problem)
describes that scenario (problem) in the form of interacting objects.
·
We use Object Orientation because it helps us in
mapping real world problem in a programming language.
·
Object Orientation is achieved using objects and their
relationships.
·
Properties of an object are described using its data members and behavior of an object
is described using its functions.
·
Objects may be tangible (physical) or intangible (also
called conceptual or virtual).
·
Generally when we have given a certain problem description,
nouns in that problem description are
candidates for becoming objects of
our system.
·
There may be more than one aspects of an object
·
It is not necessary that every object has a
specific role in implementation of a problem there may be some objects without
any role, like school parking in our school.
It is easier to develop
programs using Object Oriented Programming because it is closer to real life.
Post a Comment
Don't Forget To Join My FB Group VU Vicky
THANK YOU :)