Professional Documents
Culture Documents
Subbahasan
Paradigma Pengembangan PL
Prinsip Dasar Orientasi Objek
Paradigma Pengembangan PL
Functional Composition
Logic Programming
Structured Development
Object Orientation
Functional Composition
A problem is expressed in termed of a set
of mathematical functions.
Logic Programming
Consists of a problem description only.
e.g. Factorial(0) = 1.
Factorial(N) = N x Factorial(N -1).
Doesnt describe how to solve the
problem.
Languages Prolog & Lisp support this
paradigm.
Structured Development
Also called SASD, SADT & Functional
Decomposition.
Breaks the system into processes &
decomposes them.
Data independent from program
Languages C, Fortran, Pascal, Cobol, Basic
and a lot more support this paradigm.
By far the most popular paradigm.
Didik Dwi - Teknik Elektro UM
Object Orientation
Most recent paradigm.
Treats a problem as a collection of objects.
Becoming very popular now.
More and more languages support this
paradigm now.
Paradigma Pengembangan PL
Prinsip Dasar Orientasi Objek
Basic Principles of OO
Hierarchy
Modularity
Encapsulation
Abstraction
Object Orientation
What is abstraction?
Salesperson
Not saying
Which
salesperson
just a
salesperson
in general!!!
Customer
Product
Manages Complexity
Didik Dwi - Teknik Elektro UM
10
What is Encapsulation?
Hide implementation from clients
Clients depend on interface
Improves Resiliency
Didik Dwi - Teknik Elektro UM
11
What is Modularity?
The breaking up of something complex
Order Processing
System
Order
Entry
Order
Fulfillment
Billing
Manages Complexity
Didik Dwi - Teknik Elektro UM
12
What is Hierarchy?
Levels of abstraction
Asset
Increasing
abstraction
BankAccount
Security
SavingsChecking Stock
Decreasing
abstraction
RealEstate
Bond
13
Hierarchy
furniture (superclass)
table
chair
desk
"chable"
subclasses of the
furniture superclass
instances of chair
14
The OO Mindset
objects
problem domain
15
Paradigma Pengembangan PL
Prinsip Dasar Orientasi Objek
16
Basic Concepts of OO
classes and class hierarchies
instances
inheritance
abstraction and hiding
objects
attributes
Methods
polymorphism
Messages
Component
Package
Subsystem
Relationships
17
Classes
object-oriented thinking begins with the
template
pattern
blueprint ... describing a collection of similar
items
OO Principle: Abstraction
Didik Dwi - Teknik Elektro UM
18
Representing Classes
A class is represented using a
compartmented rectangle
a + b = 10
Professor
Professor Clark
19
Class Compartments
A class is comprised of three sections
Operations
Professor
name
empID
create( )
save( )
delete( )
change( )
20
Building a Class
21
Objects
An object is an instance of a class
An object is something that has:
State
Behavior
Identity
22
object
23
Class
Objects
Professor
Professor Smith
Professor Mellon
Professor Jones
24
What is an Attribute?
25
Methods
A.k.a Operations, Services
An executable procedure that is
Class
Operation
addStudent
deleteStudent
getStartTime
getEndTime
26
What is Polymorphism
The ability to hide many different
Manufacturer A
Manufacturer B
Manufacturer C
OO Principle:
Encapsulation
Didik Dwi - Teknik Elektro UM
27
Messages
28
What is a Component?
A non-trivial, nearly independent, and
<<DLL>>
Component
Name
Component Interface
OO Principle: Encapsulation
Didik Dwi - Teknik Elektro UM
29
What is a Package?
A package is a general purpose mechanism
Package Name
OO Principle:
Modularity
Didik Dwi - Teknik Elektro UM
30
What is a Subsystem?
A combination of a package (can contain
Subsystem
<<subsystem>>
Subsystem Name
Interface
Interface
31
Design Model
<<subsystem>>
Component Name
Component
Interface
Implementation Model
Component
Name
Component
Interface
32
Relationships
Association
Aggregation
Composition
Dependency
Generalization
Realization
33
Relationships: Association
Models a semantic connection among
classes
Association
Name
Professor
Works for
Association
Class
University
Role Names
University
Professor
Employee Employer
34
Relationships: Aggregation
A special form of association that models a
35
Relationships: Aggregation
Contoh:
Whole
Part
Body
Car
Aggregation
36
Relationships: Composition
A form of aggregation with strong
Whole
Chapter
Book
Aggregation
Didik Dwi - Teknik Elektro UM
37
participate in a relationships
Associations and aggregations are bidirectional by default, but it is often
desirable to restrict navigation to one
direction
Bi-direction
One direction
38
Association: Multiplicity
Unspecified
Exactly one
Zero or more (many, unlimited)
One or more
Zero or one
Specified range
Multiple, disjoint ranges
1
0..*
*
1..*
0..1
2..4
2, 4..6
39
Multiplicity
Student
0..*
Schedule
Navigation
40
Relationships: Dependency
A relationship between two model
Class
Package
ClientPackage
Supplier
Dependency
relationship
Client
SupplierPackage
41
Relationships: Generalization
Defines a hierarchy of abstractions in
Single inheritance
Multiple inheritance
of
42
Relationships: Generalization
One class inherits from another
Ancestor
Account
balance
name
number
Superclass
(parent)
Withdraw()
CreateStatement()
Generalization
Relationship
Subclasses
Checking
Savings
Withdraw()
GetInterest()
Withdraw()
Descendents
Didik Dwi - Teknik Elektro UM
43
classes
FlyingThing
Animal
multiple
inheritance
Airplane
Helicopter
Bird
Wolf
Horse
44
Relationships: Realization
One classifier serves as the contract that
Component
Subsystem
Interface
Interface
Interface
Elided form
Canonical form
Use Case
Didik Dwi - Teknik Elektro UM
Use-Case Realization
45
Tools for OO
Rumbaugh (OMT)
Coad-Yourdon
Booch
UML
46
Stability
47
Studi Kasus
Identifikasi masing-masing tiga contoh
hubungan:
Association
Aggregation
Composition
Dependency
Generalization
sebangku
48
Conclusion
Paradigma pengembangan PL:
Fungsional, Logic, Structured, dan OO
Prinsip dasar orientasi objek:
Abstraksi, enkapsulasi, modularity, dan
hierarki
Konsep dasar orientasi objek:
Kelas dan Objek
Messages, Component, Package, Subsystem
Relationships
Didik Dwi - Teknik Elektro UM
49