Object Oriented Programming

Only available on StudyMode
  • Download(s) : 22
  • Published : March 17, 2013
Open Document
Text Preview
Lecture - 5

Revisiting OOP
CS223
CS223- Object Oriented Programming
Spring 2012
Dr. Fawad Hussain

What we have done so far?
What is object-Oriented Programming?
What is an object?
What is a class?
What are attributes?
What are methods?

How to write a simple class in C++.
Constuctors
Default,
overloaded,
Destructors

But how to identify objects??
2
Ghulam Ishaq Khan Institute – Spring 2012

Todays Lecture

Revisiting OOP
Identifying Objects, basics of OO analysis and Design

3

OOP

Defining the term
“Object-Oriented”

4
Ghulam Ishaq Khan Institute – Spring 2012

What is an Object?
It is something we interact with
It does something, and/or
It knows something

Thinking in Objects
Everything Is an object.
Every object has an Name/Identity.
Every object has a state.
Every object has a behavior.

5
Ghulam Ishaq Khan Institute – Spring 2012

Objects in our Business World

6
Ghulam Ishaq Khan Institute – Spring 2012

My Object is not Your Object
What you recognize as an object may
not be what others recognize as
objects
Different people can come of with
different OO design of the same thing
But there must be some common
features and reasoning

Different applications/softwares might
treat objects differently

7
Ghulam Ishaq Khan Institute – Spring 2012

The world view
Is different depending on who you are
Goes from high level abstraction to low level realizations
The Universe, Solar system, Asia, South Asia, Pakistan, KPK, Topi, GIK, FCSE, LH3
Video Rental Stores, Blockbusters, Inventory, Action Movies, “Terminator”
“Terminator”

Why we care?
We use objects to model the system we are trying to create
Objects allow us to decompose a complex problem into
understandable components
8
Ghulam Ishaq Khan Institute – Spring 2012

What is Object Oriented?
Simplicity through self contained objects
Complexity through integration
Interchangeability through framework

9
Ghulam Ishaq Khan Institute – Spring 2012

Software development
Software development effort consists of four basic
development activities
1.
2.
3.
4.

Establishing the requirements:
Creating a design
Implementing the design
Testing

10
Ghulam Ishaq Khan Institute – Spring 2012

Software Design Process
1.

Requirement
a clear expression of the programming problem
specification of what a program must accomplish

2.

A software design:
indicates how a program will accomplish its requirements.
In an object orientated design, the following is specified:
the classes and objects needed in a program
the interaction of the objects and
the relationships among the classes

11
Ghulam Ishaq Khan Institute – Spring 2012

Software Design Process
3.

Implementation is the process of writing the source code that will solve the problem.
The act of translating the design into a programming language Least Creative part of the development

4.

Testing
Finding the bugs
Ensuring the program solves the problem correctly

12
Ghulam Ishaq Khan Institute – Spring 2012

Identifying Objects
A fundamental part of object-oriented software design is
determining the classes that will contribute to the program. These classes determine the objects that we will manage in the system.
To identify potential classes, identify objects discussed in the program requirements.

13
Ghulam Ishaq Khan Institute – Spring 2012

The Elevator Example
The elevator will close its door before it moves to another
floor.
Procedural Programmer
Concentrates on verbs
Identifies function move

Object Orient Programmer
Concentrates on nouns
Identifies 3 objects: elevator, door, floor

14
Ghulam Ishaq Khan Institute – Spring 2012

Looking for Objects
Objects are generally nouns; the nouns in a problem
description may indicate some of the classes and objects
needed in a program.

15
Ghulam Ishaq Khan Institute – Spring 2012

Example
Consider this...
tracking img