You are on page 1of 14

Object Oriented Analysis and Design

 Fokus pada object dimana sistem dibagi ke dalam beberapa object


yang ada di dalamnya.
 Function (behavior) dan data (state) yang berhubungan ke suatu
object tunggal adalah self-contained atau encapsulated pada satu
tempat.

 Keuntungan object-oriented:
 Reusability
 Modularity
 Maintainability

Object adalah suatu abstraksi dari sesuatu dalam suatu domain masalah,
menyatakan kemampuan sistem untuk :
 menyimpan informasi tentang object tsb,
 berinteraksi dengan object tsb,
 atau keduanya

Object adalah entitas suatu sistem software yang menyatakan kejadian


(instances) dari real-world an entitas sistem

Object Class
Class adalah deskripsi dari sekumpulan object yang membagi (share)
attributes, methods, relationship dan semantic yang sama;
Object class adalah template untuk object, yang dapat digunakan untuk
membuat object,
Object menyatakan suatu kejadian khusus tertentu dari suatu class

Contoh:
Class Object
name: string name: John
address: string 3 address: M Street No.23
dateOfBirth: date dateOfBirth: 02/10/65
employeeNo: integer employeeNo: 324
socialecurityNo: string socialecurityNo:E342545
department: string department: Sale
manager: string manager: Employee1
salary: real salary: 2340
status: {current, left, retired} status:current
taxCode: integer taxCode: 3432
Join( ) Eployee16.join(02/05/1997)
Retire( ) Eployee16.retire(03/08/2005)
ChnageDetail( ) Eployee16.changeDetail(“X Street
9559883.doc 1
No. 12”)
Inheritance
 Object classes dapat menurunkan atribut dan services dari object
class yang lain,
 Inheritance menyatakan suatu generalisasi suatu class,

Generalisasi

Employee

Ma nager Programmer

budgetsControlled project
progLanguage
dateAppointed

Project De pt. Strategic


Ma nag er Ma nager Ma nag er
projects dept responsibilities

Library Class Hierarchy

Library item
Catalogue number
Acquisition date
Cost
Type
Status
Number of copies
Acquire ()
Catalogue ()
Dispose ()
Issue ()
Return ()

Published item Recorded item


Title Title
Publisher Medium

Book Magazine Film Computer


program
Author Year Director
Edition Issue Date of release Version
Publication date Distributor Platform
ISBN

9559883.doc 2
Keuntungan Inheritance:

 Merupakan mekanisme abstraksi yang dapat digunakan untuk


mengklasifikasikan entitas
 Merupakan mekanisme re-use pada tahap perancangan dan
pemrograman
 Grafik Inheritance adalah suatu bentuk gambaran tetang organisasi
pada suatu domain dan sistem

Multiple Inheritance

Book Voice recording


Author Speaker
Edition Duration
Publication date Recording date
ISBN

Talking book
# Tapes

 Suatu object class dapat pula dibentuk dari turunan beberapa super-
class,
 Akan memberikan dampak konflik semantic dimana atribut/service
dengan nama yang sama pada super-class yang berbeda memiliki
semantic yang berbeda
 Membentuk hierarchy yang lebih kompleks

Masalah dengan Inheritance

 Object class tidak self-contain, sehingga tidak dapat diketahui tanpa


referensi ke super-classnya
 Perancang memiliki tendensi untuk melakukan reuse terhadap
graph inheritance yang sudah dibuat sehingga dapat menimbulkan
ketidak efisiensian yang signifikan

Object Agregasi
Model agregasi menunjukkan bagaimana class-class dibentuk dari class
yang lainnya
Similar dengan relasi: part-of dalam model data semantic

9559883.doc 3
Study pack
Course title
Number
Year
Instructor

1 1 1 1

1 1 1 0
Assignment OHP slides Lecture Videotape
notes
Credits Slides Text Tape ids.

1 1

1 1
Exercises Solutions
#Problems Text
Description Diagrams

Encapsulation

 Private: attributes dan methods dienkapsulasi dalam class sehingga


dapat diakses oleh clien akses tersebut -> hanya dapat diakses oleh
member class tersebut.
 Public: metode mendefinisikan inteface sebagai sarana mengakses
class dari clint-nya.Dapat diakses oleh object manapun.
 Protected: hanya dapat diakses oleh object-class turunannya

Customer
- numCustomers = 0
private attributes - MIN_BUDGET = 200
- name: String
- address: String
- budget: int

public methods + printNumCustomer( ): void


+ placeOrder( ): void
Customer class

9559883.doc 4
Komunikasi dalam object

 Object berkomunikasi dengan object lain melalui pengiriman pesan


(messages)
o Suatu pesan adalah suatu metode call dari suatu object
pengirim-pesan ke suatu object penerima pesan
o Suatu pesan terdiri dari: Object referensi yang
mengindikasikan penerima pesan, nama method dan
parameter (argumen dari method)
 Object penerima pesan disebut server ke object pengirim pesan, dan
objek pengirim pesan adalah client dari server.

message

name = “Alex”
takeOrder(“sofa”, name, name = “Lawrence”
address = employeeNo =15
address, “120799”)
“1 Robinson Rd”
commission = 200
budget = 2000
19
placeOrder( ): void 9 takeOrder( ): int
return value
alex lawrence
message

lawrence.takeOrder(“sofa”, “Alex”,“1 Robinson Rd”, “120799”)

object reference method name parameters

Object Cohesion dan Coupling


Cohesion suatu komponen adalah ukuran tentang hubungan antara
komponen suatu object class. Setiap operasi menyediakan fungsi untuk
mengubah, melihat, atau menggunakan atribut object sebagai layanan
dasar,

Coupling adalah suatu indikasi kekuatan interkoneksi antara program


units. Sistem dengan coupling yg kuat memiliki interkoneksi yang kuat
sehingga setiap program unit sangat ketergantungan dengan yang lainnya
(mis.: shared variables, interchange control function). Sistem dengan
couple yang lemah tidak memiliki ketergantungan yang kuat antar
program units.

9559883.doc 5
Polymorphism
 Kemampuan object yang berbeda untuk menjalankan method yang
sesuai untuk merespon ke pesan yg sama
 Pemilihan method yang sesuai tergantung pada class yg digunakan
untuk membuat object
name
Shape getName( )
calculateArea( )

radius side
Circle Square
calculateArea( ) calculateArea( )

Contoh:
class Shape {
private String name;
public Shape(String aName) { name=aName; }
public String getName( ) { return name; }
public float calculateArea( ) { return 0.0f; }
} // End Shape class
class Circle extends Shape {
private float radius;
public Circle(String aName) { super(aName); radius = 1.0f; }
public Circle(String aName, float radius) {
super(aName); this.radius = radius;
}
public float calculateArea() { return
(float)3.14f*radius*radius; }
} // End Circle class
class Square extends Shape {
private float side;
public Square(String aName) { super(aName); side = 1.0f; }
public Square(String aName, float side) {
super(aName); this.side = side;
}
public float calculateArea() { return (float) side*side; }
} // End Square class
public class ShapeDemoClient {
public static void main(String argv[ ]) {
Shape c1 = new Circle("Circle C1");
Shape c2 = new Circle("Circle C2", 3.0f);
Shape s1 = new Square("Square S1");
Shape s2 = new Square("Square S2", 3.0f);
Shape shapeArray[ ] = {c1, s1, c2, s2};
for (int i = 0; i < shapeArray.length; i++) {
System.out.println("The area of " + shapeArray[i].getName( )
+ " is " + shapeArray[i].calculateArea( )
+ " sq. cm.");
}
} // End main

9559883.doc 6
} // End ShapeDemoClient1 class

OO Analysis: mencari kebutuhan dari perpektif class dan object yang ditemukan
dalam suatu vocabulary dari domain masalah. Dengan kata lain, world (system)
dimodelkan dalam bentuk object dan class,
OO Design: Dekomposisi OO dan suatu notasi untuk menggambarkan model
system pada tahap pengembangan. Struktur dibentuk setelah object yang
berhubungan dengan system sudah didefinisikan.

OO-Analisis:

 Menganalisa domain masalah


 Menggambarkan proses system
 Identifikasi object
 Spesifikasi atribut
 Mendefinisikan Operation
 Inter-object Communication

Identifikasi Suatu Object


 Entitas luar (mis.: system lain, alat, orang) yang menghasilkan /
menggunakan informasi yang digunakan system
 Benda (mis.: laporan, tampilan, surat, signal) yang merupakan bagian
informasi
 Peran (mis: manager, engineer, salesperson) yang dimainka oleh orang yang
berinteraksi dengan system,
 Tempat(mis.: ruangan) yang menyediakan konteks permasalah dan fungsi
keseluruhan system,
 Unit organisasi (mis.: divisi, group, team) yang relevan ke aplikasi,

Student to Catalog
Staff

Got to Book Student

Got to Loaned
Book Charge

Return Magazine

Give Journal
List of
Check Loaned
Book

Check
Check
Late Loaned
Returne
Warned to Process
return book the Loan
Pay the Appr
9559883.doc 7
Get the
Class Fitting

Student Staff

ID ID
Name Name
dateOfBirth dateOfBirth
…. Department:

Join ( )
Register( )
ChangItems( ) AssignDept( )
…. ….

Object Relations

loan
Student Book

Checked / served by
loanedBook
Staff
BookID
loanDate
studentID
Package
LoanProces
Studen searc B
addLoanedBoo
loanedBoo

9559883.doc 8
Unified Modelling Language
The Unified Modeling Language (UML) is a standard
language for writing software blueprints.
The UML may be used to visualize, specify, construct,
and document the artifacts of a softwareintensive system.

Building Blocks
Things
Relationships
Diagrams

Things:
Structural things
classes, interfaces, collaborations, use cases, active classes, components,
nodes.
Behavioral things
 interactions, state machines.
Grouping things
 packages.
Annotational things
 notes.

Sha pe
origin

mov e()
resize()
display ()

Class Inheritance
< <Cl ass Mo dul e>>
Shape
origin : Variant

move()
resize()
display()

Rectangle Circle Po lygon


corner : Point radius : Double point : List

Square

9559883.doc 9
Class - Dependencies
A change in specification of one thing may effect another thing that
uses it

FilpClip
name

playOn() Channel
start()
stop()
reset()

Class – Association
A structural relationship that specifies that objects of one thing are
connected to objects of another.
Name: name of association
Role: a specific role of class in an association
Multiplicity, an association represent a structural relationship
among objects: zero to one(0..1), many(0..*) or one or more (1..*)
Aggregation: a plain association between two classes represents
a structural relationship “whole-a-part”
Association, Multiplicity, Aggregation and Role

0
ha Department
Scho s
ol 1 1 1
1 1

Assigns
memb
to
er 1
* 1 1 chairper
attend teac Instructo
Stude s Cours
nt * * e r

9559883.doc 10
Structural Things – Use Case
Specifies the behavior of a system or a part of a system and is a description
of a set of sequences of actions, including variants, that a system performs
to yield an observable result of value to an actor.

Process Loan
LoanOf fic er

Use Case Diagram


One of the five diagrams (activity diag., statechart diag.,
sequence diag., collaboration diag.) in the UML for modeling the
dynamic aspects of systems.
Central to modeling the behavior of a system, a subsystem, or a
class,

Use Case Diagram

Pe rform Card Transa ct ion

RetailInstitution

Process Customer Bill

Customer

Reconcile Transaction
Sponsoring
Financial

Manage Customer Account

Statechart Diagram
A statechart diagram shows a state machine, consisting of states,
transitions, events, and activities.

9559883.doc 11
S tart

Meminta Memberi
Informasi Informasi

Melen gkapi
Persyara tan

Menyerahkan
Persyarat

Cek Persyaratan

[Tidak Lengkap]

[L engkap]

Mencatat
Pendafta ran

End

Activity Diagram
An activity diagram is a special kind of a statechart diagram that
shows the flow from activity to activity within a system.

Prepare Text
TO Visaul

Read Text

Generate
Ge sture Generate
Phoneme

Gene rate
Speech Generate Lip
Articulation

Syn c Mouth and


Gesture Stream Audio

Clean Buffer

9559883.doc 12
Sequence Diagram
A sequence diagram is an interaction diagram that emphasizes the
timeordering of messages.

: Petugas : Layar Utam a Sis tem : Mem buat : Form ulir Pendaftaran : Pendaftaran
Loket Pendaftaran Pendaftaran Baru
1 : Pen daftaran Baru( ) Baru

2: Pendaftaran Baru( )

3: Jalankan Form ulir Pendaftaran( )

4: Tam pilkan Form Pendaftaran( )

5: Masukan Pendaftaran( )

6: Buat Pendaftaran( )

7: Tam bahka n Penda ftaran( )

Component Diagram
Component diagram shows an organization and dependencies of
a group of components.

Deployment Diagram
Deployment diagram shows the configuration of run-time node
processing and its components.

9559883.doc 13
Server SIMTAP <<network>> Komputer Pej abat
WAN SOPD

<<network>>
LAN

Komputer Bupati
Komputer Loket Komputer Loket Komputer Sekreteris
Pendaftaran Penyerahan

9559883.doc 14

You might also like