You are on page 1of 13

Object

Oriented Programming COMP 313


Lecture I Introduc8on February 26, 2011

Object Oriented Approach

Introduc3on

So@ware Crisis
Huge pile up of code Same or similar code repeatedly in di. project implementa8ons More and more failure in so@ware development projects So@ware crisis How to:

Reduce the eort, complexity, and cost of development and maintenance of so@ware systems. (eciency) Keep pace with rapidly growing demand for more error-free and ecient so@ware React quicker to changes (Flexibility, reusability). Increase the reliability of the system.

So@ware Crisis
So@ware projects costs are going up and hardware costs are going down. So@ware development 8me is geUng longer and maintenance costs are geUng higher. So@ware errors are geUng more frequent as hardware errors become almost non-existent. Too many projects have serious failures (Budget, 8me, errors).

So@ware evolu8on
Problem iden8ca8on
Understanding the true nature of the problem Represen8ng the problem in comprehensible manner.

Requirement analysis
dening the boundaries or interface of the so@ware. data are collected in available les, decision points, and transac8ons.

Design
Technical specica8ons (engineers blueprints) Output/input are outlined (sample) Required database is designed Program construc8on, tes8ng and complete documenta8on Documenta8on and evalua8on of the es8mated impact

Implementa8on
Coding, tes8ng and installa8on User training, site prepara8on and data migra8on

Maintenance
Change is inevitable Users priori8es, changes in organiza8onal requirements, or environmental factors

Procedure-oriented Programs

Rela3onship of Data and Func3ons in POP

Characteris8cs of POP
Less emphasis on data and its behavior Emphasis is on doing things (algorithms). Large programs are divided into smaller programs known as func8ons. Most of the func8ons share global data. Data move openly around the system from func8on to func8on. Crea8ng new data types is dicult.

Object-Oriented Programs (OOP)


Only a method of designing and implemen8ng so@ware Has nothing to do with any programming language Enables programmers to build high-quality programs Models be_er the real world objects Thinking in terms of objects rather than func8ons

Basic Concepts
A problem is viewed in terms of the following concepts: 1. Objects
the basic run-8me en88es

2. Classes
a set of related objects

3. Data abstrac8on
the act of represen8ng essen8al-features without including the background details or explana8ons.

4. Data encapsula8on
wrapping up to data and func8ons into a single unit (class)

5. Inheritance 6. Polymorphism
the process by which objects of one class acquire the proper8es of objects of another class the ability to take more than one form

7. Dynamic binding 8. Message passing


linking of a procedure call to the code to be executed in response to the call a request for execu8on of a procedure, and therefore will invoke a func8on in the receiving object that generates the desired result

Benets of OOP
Provides greater programmer produc8vity, be_er quality of so@ware and lesser maintenance cost. The advantages are:
We can eliminate redundant code and extend the use of exis8ng classes. (inheritance) Reusability (saving of development 8me and higher produc8vity) To build secure programs. (data hiding) Mul8ple instances of an object to co-exist without any interference. (polymorphism) Map objects in the problem domain to those objects in the program. Easy par88on the work in a project based on objects. (manageability) Capture more details of a model in implementable form. Easily upgradability from small to large systems. (scalability) Makes the interface descrip8ons with external systems much simpler. (message passing) Manage so@ware complexity easily.

Object-Oriented Languages
Object-based programming languages
Data encapsula8on. Data hiding and access mechanisms. Automa8c ini8aliza8on and clear-up of objects. Operator overloading E.g. ADA

Object-oriented programming
Object-based features + inheritance + dynamic binding. E.g. C++, Java, C# etc.

Review Ques8ons
Write a note on various problems faced by the so@ware industry. Write a note on so@ware evolu8on. What do you mean by object oriented programming? What are its benets? What do you mean by dynamic binding? What is the dierence between data abstrac8on and data encapsula8on? Name some language that support object-oriented paradigm.
Deadline: Next class Format : A4 paper, Hand wri_en
N.B. Name, ID Number, Section and Date must be clearly included at the top margin of the paper

You might also like