Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
LESSON # 2
TITLE: OBJECT-ORIENTED PROGRAMMING
Terminologies
OOP – Object-Oriented Programming
OOP – it is a programming standard that uses object to design computer programs.
Object – defined as an instance of a class where attributes and methods are placed under a single
name.
Class – defined as the model or template that can be instantiated to create an object.
Discussion
Object-Oriented Programming
OOP simulates real-world interaction. Real-world contains objects that interact with each other (i.e.
phones, computers, people, etc.) Each of these objects has their own attributes (characteristics) and
operations (function or purpose). These two elements of an object form a cohesive package.
With OOP, a problem will be broken down into a number of units and these units are called objects.
The data elements in the object are called attributes and the procedure or function is called method.
Each object is capable of receiving messages, processing data, and sending message to other
object.
- OOP provides a clear modular structure for programs which makes it good for defining abstract
data types where implementation details are hidden and the unit has a clearly defined
interface.
- OOP is easy to maintain and modify existing code as new objects can be created based on
existing objects.
- OOP provides a good skeleton for code libraries where software components can be easily
adapted and modified by the programmer.
To clearly understand the concepts of class and object, examine the example given below.
A vehicle can be described in terms of the following set of attributes and behaviors:
12”
3”
3” 3” 12”
3”
1. Encapsulation – a programming mechanism that binds together the code and the data that it
manipulates. It keeps both data safe from outside interference and misuse.
2. Inheritance – a programming concept that describes the object capability to acquire the
properties of another object.
3. Polymorphism – from the Greek word, meaning “many forms”, it is the ability of objects of
different types to respond to methods of the same name, each one according to the right type-
specific behavior.