basics of object oriented programming

12
- ANKITA KARIA REVISION

Upload: abhilash-nair

Post on 22-May-2015

687 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Basics of Object Oriented Programming

- A N K ITA K A R IA

REVISION

Page 2: Basics of Object Oriented Programming

TOPICS TO COVER:-

BACKGROUND.

Difference between Structured & Object

Oriented Programming

Basic OOPs Concepts.

History of JAVA.

JAVA Buzzwords (FEATURES).

Page 3: Basics of Object Oriented Programming

BACKGROUND

Since the invention of the computer, many programming

approaches have been tried. These include techniques such as:-

Structured Programming. * Modular

Programming

Object Oriented Programming * Top-Down &

Bottom-Up.

The primary motivation in each case has been the concern to

handle the increasing complexity of programs.

Page 4: Basics of Object Oriented Programming

BACKGROUND (Contd..)

PASCAL & C are 3rd Generation Languages which use

sequential code, global data, local data & sub-programs.

They follow STRUCTURED PROGRAMMING

Modular Programming

Supports

• Follows TOP-DOWN Approach..

• Failed when programs grew larger, Didn't gave bug-free programs.

SO CAME Object Oriented ProgrammingOOPS

Page 5: Basics of Object Oriented Programming

Object-Oriented Programming

Is an approach which attempts to eliminate some of the pitfalls of conventional methods by incorporating the best of structured programming features with several new concepts .

Languages that support OOPs features

include:-

Simulate, Ada, Smalltalk;

C++, Bjarne Stroustrup, 1980 AT&T Bell Labs,

USA

Java, James Gosling, 1996 Sun Microsystems,

USA

C#, Anders Hejlsberg, 2000 Microsoft, USA

Page 6: Basics of Object Oriented Programming

Difference between STRUCTURED & OOPs

STRUCTURED PROGRAMMING

OBJECT-ORIENTED PROGRAMMING

Top-down approach is followed.

Bottom-Up approach is followed.

Program is divided into a number of sub-modules or functions or procedures.

Program is organized by having a number ofclasses and objects.

Function call is used. Message passing is used.

Software reuse is not possible.

Helps in software reuse.

No encapsulation. Data and functions are separate.

Data and functionalities are put together in a single entity.

Page 7: Basics of Object Oriented Programming

BASIC OOPs CONCEPTS

OBJECT:- Is anything having crisply defined conceptual boundaries.

Represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem domain.

OrAn "object" is anything to which a concept

applies.Contains DATA and METHODS

An object is like a black box.

The internal details are hidden.

Daria

BANKACCOUNT

Page 8: Basics of Object Oriented Programming

BASIC OOPs CONCEPTS (Continued…….)

CLASSES:- A class is the blueprint from which individual objects are created.

A class defines features of objects.A feature may be DATA or OPERATION

Variables Functions or methods.

OBJECTS

VEHICLE

CLASS

Model_Type.Manufacture_Date.Speed etc….

Change_Gear.Brake. Etc….

Model_Type.Manufacture_Date.Speed etc….Change_Gear.

Brake. Etc….

Page 9: Basics of Object Oriented Programming

BASIC OOPs CONCEPTS (Continued…….)

Example: class Vehicle { int Model_Type; int Man_Date; int speed;

void change_gear(); void brake();

}

VEHICLE

CLASS

Change_Gear.Brake. Etc….

Model_Type.Manufacture_Date.Speed etc….

DATA

Operations OR functions

CREATING OBJECTS:-Vehicle alto; Declares objectAlto = new Vehicle(); -- Allocates Space.Vehicle alto = new vehicle(); - Does Both.

Page 10: Basics of Object Oriented Programming

CLASS OBJECT

Class is a data type Object is an instance of class.

It generates objects It gives life to CLASS

Does not occupy memory location

It occupies memory location.

It cannot be manipulated because it is not available in memory

It can be manipulated.

Difference betweenObjects &Classes

Page 11: Basics of Object Oriented Programming

ENCAPUSLATION:- The wrapping up of data and methods into a

single unit (called class) is known as ENCAPUSLATION.

Encapsulation makes it possible for objects to be treated like

“black boxes” ,each performing a specific task without any

concern for internal implementation..

ABSTRACTION:- Abstraction is a design technique that focuses

on the essential attributes and behaviour. It is a named collection of

essential attributes and behaviour relevant to programming

BASIC OOPs CONCEPTS (Continued…….)

Page 12: Basics of Object Oriented Programming

Explain basic concepts of Object Oriented

Programming?

Distinguish between:-

◦Object oriented and Procedure oriented

programming.

◦Objects and Classes.

QUESTIONS