Download presentation
Presentation is loading. Please wait.
Published byAnderson Giffin Modified over 10 years ago
1
When is Orientated Programming NOT? Mike Fitzpatrick
2
Types of “OOP” OOP focuses on programming with objects Sending data and commands to objects Reading data and receiving messages from objects Two Main Types Object/event based programming Usually focuses on visible objects Uses pre-defined objects Object orientated programming – ‘based’ plus Objects are designed and built Program design focuses on creation of objects
3
What is an OBJECT? Object are actual entities Visible Objects on the screen Invisible Objects, code and data only, used to store and process data Objects receive commands, and receive and send data Objects are Instances of pre-defined classes They can be selected from a list of components Classes are definitions that Specify representation and behavior Contain data and methods to process the data
4
What is an OBJECT? (cont.) Objects have properties/attributes – descriptive data and event handlers Attributes of objects can be read and changed when the instance of the object is created, or using code in a program Event handlers activate procedures/functions that are internal to the object
5
INSIDE Objects (1) Objects use Information Hiding The EXTERNAL behaviour of the object is separated from the INTERNAL implementation – Data Abstraction The programmer only needs to ‘see’ the external behaviour of the object when using the object
6
INSIDE Objects (2) Encapsulated Data A ‘black box’ has PRIVATE (Internal/Local) Attributes - data/variables Methods – procedures/functions Communication with an object is with PUBLIC Properties Attributes Methods ALL fields and methods are attached to an object NO ‘Independent’ Global Variables NO ‘Independent’ Procedures/Functions
7
INSIDE Objects (3) Class Inheritance A new class of objects is usually based on another class Can add, change and delete methods/attributes Provides genuine and easy reusability of programming components Can be added to library of components for later use; or full libraries purchased – no need to re- enter code and debug
8
INSIDE Objects (4) Polymorphism The inherited public attribute or method of a new class of object can changed so that Is called the same BUT Activates a different method
9
INSIDE Objects (5) Object Name Public Methods and Attributes Private Methods and Attributes Graphical Design of an Object
10
First OOP Steps - Analysis Identify objects, or classes, in the problem description (NOUNS) Identify processes or methods associated with each object (VERBS) Specify the attributes of each object (ADJECTIVES) Separate into Public and Private
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.