Object Oriented Programming Concepts
Object Oriented Programming Concepts
08
1. Introduction: OOP Concepts
Programming Paradigms
OOP
Concepts
Structured Programming
Imperative Programming
3 4
5 6
Language syntax
– Modules are associated to data types
7 8
struct vector {
Entrada Entrada double x;
double y;
};
Salida Salida }
9 10
11 12
class MainClass {
public static void main (String args []) {
Vector u = new Vector (4, -2);
System.out.println (u.module ());
}
}
15 16
17 18
19 20
21 22
23 24
Person x
Employee y = create Employee
division name off company
p y
Employee
l Customer Manager z = create Manager Employee
l Customer
gross salary contact phone number
x=y
x=z
Manager category Manager
25 26
Modularity
y calculate
net salary Employee
l Customer
calculate show show
net salary personal Employee Customer personal
data data
inheritance show
personal Administrative Manager
show data
calculate personal
net salary Manager
data
27 28
y y
B C D obj = create D
t z
Graduate
Student obj . x
obj . y
year of graduation
specialty D
qualifications
year x
courses y
register (course) z
t
29 30
31 32
33 34
f (B x) f (A x)
A A B D
f (B x)
B b = create B
? b . f (b) C
?
B f (A x)
C c = create C
D d = create D
d . f (c)
35 36
Person Computer
OO Analysis and Design:
Diagram
Class
name : String 1..* Uses 0..* name : String
Unified Modeling Language (UML) birth : Date memory : Integer
Class Object
Attributes Attributes Interface User1 : Person Serer7 : Computer
name = "John"
John name = "Andromeda"
Andromeda
Operations Operations birth = 21/07/76 memory = 256
Object Diagram
Dependence
User2 : Person PC12 : Computer
Generalization
name = "Louis" name = "Anubis"
Asociation age = 21/07/85 memory = 128
Aggregation
37 38
Figure
{abstract}
Formed by * position : Point * Formed by
Canvas
draw ( ) {abstract}
area ( ) : Integer {abstract}
39