1. object oriented programming.pptx

13
Object Oriented Programming

Upload: brandon-bryan

Post on 07-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1. Object Oriented Programming.pptx

Object Oriented

Programming

Page 2: 1. Object Oriented Programming.pptx

OOPOOP has two key elements:

• Classes: Objects of the same type.

• Objects: Model or representation of real-world objects.

And Methods

Page 3: 1. Object Oriented Programming.pptx

OOPObjects are represented in the same way the user perceive it:

• Objects have attributes and characteristics. The attributes define the object.

• You can make operations with and to the object. Behavior (Methods).

Page 4: 1. Object Oriented Programming.pptx

Structured Programming

Structured programming

• Tasks to be performed• Complex problem divides into modules.• Functions do a specific task.• Functions can call other functions.• Unlimited access to global and local variables

Separates data and the functions that manipulate the data.

Make a poor model of real-life objects.

Page 5: 1. Object Oriented Programming.pptx

OOPOBJECTS

Page 6: 1. Object Oriented Programming.pptx

OOP

Objects have their own attributes or characteristics:

People :

Dog:.

Car :

The attributes or characteristics become the data of the object, or instance variables.

OBJECTS

Page 7: 1. Object Oriented Programming.pptx

OOP

Behavior: Is the action on the object depending on a stimulus.

Dog : barking, fetching, wagging tail.Car : changing gear, changing pedal cadence, applying brakesPerson:

The behavior of an object will be the functions or procedures of the object.

OBJECTS

Page 8: 1. Object Oriented Programming.pptx

OOP

The main idea of OOP is combining data and functions that modify the data in the same unit.

The unit is an object.

In OOP a program divides not in modules but in models of physical objects.

When you program using OOP you are creating a model of some part of the world.

OBJECTS

Page 9: 1. Object Oriented Programming.pptx

OOP

Identifying the attributes and behavior for real-world objects is a good way to begin thinking in terms of object-oriented programming

OBJECTS

Page 10: 1. Object Oriented Programming.pptx

OOP

Identifying the attributes and behavior for real-world objects is a good way to begin thinking in terms of object-oriented programming

OBJECTS

Page 11: 1. Object Oriented Programming.pptx

OOP

There may be thousands of cars in existence, all of the same make and model. Each car was built from the same blueprint and contains the same components. In object-oriented terms, we say that one of this cars is an instance of the class of objects known as car. A class is the blueprint from which individual objects are created.

Instance

Page 12: 1. Object Oriented Programming.pptx

OOP

All the functions or procedure of a class are named methods in OOP.

Methods work an modify an object's internal state and are the primary mechanism for object-to-object communication.

Methods

Page 13: 1. Object Oriented Programming.pptx

OOP

Individual software objects provides :

• Modularity: The source code for an object can be written and maintained independently of the source code for other objects.

• Information-hiding: By interacting only with an object's methods, the details of its internal implementation remain hidden from the outside world.

• Code re-use: If an object already exists (perhaps written by another software developer), you can use that object in your program. This allows specialists to implement/test/debug complex, task-specific objects, which you can then trust to run in your own code.

• Plug ability and debugging ease: If a particular object turns out to be problematic, you can simply remove it from your application and plug in a different object as its replacement.

OBJECTS