Professional Documents
Culture Documents
CIS601: Object-Oriented Programming in C++: Lesson #1
CIS601: Object-Oriented Programming in C++: Lesson #1
CIS601: Object-Oriented Programming in C++: Lesson #1
Programming in C++
Lesson #1
Note: CIS 601 notes were originally developed by H. Zhu for NJIT DL Program. The notes were subsequently revised by M. Deek.
Contact Information
Email: maura.a.deek@njit.edu
Web: www.ccs.njit.edu/maura
Object Oriented
programming
To further develop your C++ skills
Course Coverage
Fundamentals of object-oriented
programming
*Data abstraction
*Encapsulation
*Inheritance
*Dynamic binding
*Polymorphism
Prerequisites
Working knowledge of
C/C++
Familiarity
Lectures
1. Introduction to Object-Oriented
Programming
Lectures cont.
Thinking Methodology
Induction
From
specialization to generalization
to
10
Thinking Methodology
Deduction(infer)
From
generalization to specialization
From
DOG
11
Design Methodologies
12
Functional decomposition
The System
Function1
Desk
13
Function2
Studying
Table top
Function3
... ...
... ...
Function11
Function12
Left drawer
Design Methodologies
14
Functional composition
The System
Function1
Desk
15
Function2
Studying
Table top
Function3
... ...
... ...
Function11
Function12
Left drawer
Functional (De)Composition
Modules
Object-Orientation
A thinking methodology
Everything
is an object.
Any system is composed of objects (a system
is also an object).
The evolution and development of a system
is caused by the interactions of the objects
inside/outside a system.
17
Everything is an object
18
A student, a professor
A desk, a chair, a classroom, a building
A university, a city, a country
The world, the universe
A subject such as CS, IS, Math, History,
19
An educational system
An economic system
An information system
A computer system
Inside NJIT
staff
Board
governance
State governance
...
20
Outside NJIT
Design Methodologies
Object-Orientation is a design
methodology(OOA/OOD)
Objects
21
Design Methodologies
Object-orientation
needs tools
22
supports
needs programmers
Design Methodologies
Object-orientation
Top-down:
supports
classes
Bottom-up: from sub-classes to a
super-class
23
Programming Techniques
The
evolution of programming
techniques is
to
24
25
Abstraction
to understand a problem by
separating necessary from
unnecessary details
To define the interface to a data
abstraction without specifying
implementation detail.
26
Abstraction
Problem
Model
27
Properties of ADT
With abstraction, you create a welldefined entity
These entities define the data
structure as a set of items.
For
28
Properties of ADT(Cont.)
29
ADT
Abstract
Data Type
Operations
30
Definition (ADT)
It exports a type.
2. It exports a set of operations.
3. Operations of the interface are the only
access mechanism to the data structure.
4. Axioms and preconditions define the
application domain of the type.
31
32
List
33
Encapsulation
Combines the data and the operations
Encloses both variables and functions
Keeps details of data and operations
from the users of the ADT
34
Encapsulation (cont.)
Allows for modularity
Controls access to data
Separates implementation from
interface
Extends the built-in types
35
Object-Oriented Programming
36
Object1
Data1+Procedures1
Object2
Data
Data
Data12
2 + Procedures
Object3
Data3 + Procedures3
Object4
Data4 + Procedures4
37
Object-Oriented Programming
Each
object is responsible to
initialize and destroy itself.
Therefore, there is no need to
explicitly call a creation or
termination procedure.
38
39
40
Inheritance(Hierarchy)
Expresses commonality among objects
Allows code reusability
Highlights Generalization/Specialization
relationships
41
Polymorphism
The
ability of objects to
respond differently to the same
message or function call.
42
Object-Orientation Evolution
Modules
Information
hiding
Data encapsulation
Abstract data types
Objects
43
Remember:
Encapsulation (Data & Operations)-- A
technique for Information Hiding. The
users of the objects do not need to
know the details of the data and
operations of the objects.
Data Abstraction -- the procedure to
define a class from objects.
Abstract Data Type-- Class.
44
Object view
Makes
45
46
Reading
47