• MACHINE LANGUAGE
(FIRST GENERATION OF PROGRAMMING LANGUAGES)
•
•
•
• ASSEMBLY LANGUAGE
(SECOND GENERATION OF PROGRAMMING LANGUAGES)
•
•
•
• PROCEDURAL LANGUAGES (HIGH LEVEL LANGUAGES)
(THIRD GENERATION LANGUAGES)
•
•
• WHAT HOW
• NONPROCEDURAL LANGUAGE
(FOURTH GENERATION LANGUAGES)
•
•
•
• WHAT NOT HOW
• NATURAL LANGUAGE PROGRAMMING LANGUAGES
(FIFTH GENERATION (INTELLIGENT) LANGUAGES)
•
•
• VISUAL PROGRAMMING LANGUAGES
•
•
•
• HYPERTEXT MARKUP LANGUAGE (HTML)
•
•
• OBJECT-ORIENTED PROGRAMMING LANGUAGES (OOP)
•
•
•
•
•
•
•
•
• ONE PLACE
ONE PROGRAM CODE INCREASES
PROBLEMS
•
•
•
• USELESS LARGE PROJECT
•
FUNCTIONS EASIER MANAGE
RE-USE
•
STRUCTURED vs. OO PROGRAMMING
STRUCTURED PROGRAMMING:
MAIN PROGRAM GLOBAL DATA
FUNCTION FUNCTION 2 FUNCTION 3
1
FUNCTION 4 FUNCTION 5
10
•
•
•
Object 2
Object 1
Data Data
Function Function
Object 3
Data
Function
12
Basic terminology
OBJECT
- usually a person, place or thing (a noun)
METHOD
- an action performed by an object (a verb)
ATTRIBUTE
- description of objects in a class
CLASS
- a category of similar objects (such as
automobiles)
- does not hold any values of the object’s attributes
13
OBJECT ORIENTED PROGRAMMING
Objects have both data and methods
Objects of the same class have the same data elements
and methods
Objects send and receive messages to invoke actions
Key idea in object-oriented:
The real world can be accurately described as a
collection of objects that interact.
15
•
•
•
•
•
• •
• •
• •
•
Object-Oriented Programming
We can think of an object
as a collection of properties
and the methods that are
used to manipulate those
properties.
Properties
Methods
•
•
•
18
•
19
•
20
Abstraction
Focus only on the important facts about the
problem at hand to design, produce, and describe
so that it can be easily used without knowing the
details of how it works.
Analogy:
When you drive a car, you don’t have to know how
the gasoline and air are mixed and ignited.
Instead you only have to know how to use the
controls.
•
22
Inheritance
Inheritance—a way of organizing classes
Term comes from inheritance of traits like eye
color, hair color, and so on.
Classes with properties in common can be
grouped so that their common properties are only
defined once.
Superclass – inherit its attributes & methods to the
subclass(es).
Subclass – can inherit all its superclass attributes
& methods besides having its own unique attributes
& methods.
23
An Inheritance Hierarchy
Superclass
Vehicle
Subclasses
Automobile Motorcycle Bus
Sedan Sports Car Luxury Bus School Bus
What properties does each vehicle inherit from the types of vehicles above it
in the diagram?
24
•
•
25