Object Oriented Analysis & Design With Visio (Day 1)

85

description

Object Oriented Analysis & Design With Visio (Day 1). Dibawakan oleh Indra Sosrodjojo [email protected]. Object Oriented Analysis & Design. Lars Mathiassen, Andreas Munk-Madsen. Perkembangan Metode Analisis dan Desain Sistem. Metode Tradisional Metode Terstruktur - PowerPoint PPT Presentation

Transcript of Object Oriented Analysis & Design With Visio (Day 1)

Page 1: Object Oriented Analysis & Design With Visio (Day 1)
Page 2: Object Oriented Analysis & Design With Visio (Day 1)

Object Oriented Analysis & Design

Lars Mathiassen, Andreas Munk-Madsen

Page 3: Object Oriented Analysis & Design With Visio (Day 1)

Metode Tradisional Metode Terstruktur Metode berorientasi

objek (Object Oriented)

Page 4: Object Oriented Analysis & Design With Visio (Day 1)

Berkembang dari pemrograman tradisional

Kontrol Alur (urutan, keputusan, loop) Sistem Flow Chart Hampir selalu dimulai dengan

pemikiran tentang file secara fisik Tidak berorientasi pada kebutuhan

informasi

Page 5: Object Oriented Analysis & Design With Visio (Day 1)

Dimulai pada tahun 1977 Dimulai dengan mencoba melihat

sistem dari sudut pandang logical Melihat data sebagai sumber proses

MetodeE-R DiagramNormalisasiDFD (control flow, State Transistion diagram)

Page 6: Object Oriented Analysis & Design With Visio (Day 1)

InvoiceInvoice_noCust_nameDate_Purchase

Item_noDescriptionUnit_PriceQuantityTotal

Total_amount

InvoiceInvoice_noCust_nameDate_PurchaseTotal_amount

CustomerCust_noCust_nameCust_addressBalance

Inv_detailInvoice_noItem_noUnit_PriceQuantityTotal

InventoryItem_noUnit_priceQty_on_handQty_purchasedAmnt_purchasedQty_soldAmnt_sold

Page 7: Object Oriented Analysis & Design With Visio (Day 1)

First Normal Form (1 NF)Second Normal Form (2 NF)Third Normal Form (3NF)Boyce-Codd Normal Form (BCNF)Fourth Normal Form (4NF)Fifth Normal Form (5 NF)Domain Key Normal Form (DKNF)

Normalisasi

Page 8: Object Oriented Analysis & Design With Visio (Day 1)

Normalisasi

Keterangan

1 NF Any Relation

2 NF All non key attributes are dependent on all of the keys

3 NF There are no transitive dependencies

BCNF Every determinant is a candidate Key

4 NF There are no multivalue dependencies

5 NF There are no Joint dependencies

DK/NF All constraints on relation are logical consequences of domain and Keys

Page 9: Object Oriented Analysis & Design With Visio (Day 1)

Architecture/Design 10% 30%Detailed design 20% 20%Code/debuging 25% 10%Unit Test 20% 5%Integration 15% 20%System Test 10% 15%

ActivitySmall Project

(2.500 lines of Codes)Large Project

(500.000 lines of Codes)

Mengapa perlu membuat rencana gambar yang jelas dalam pembuatan software ?

Page 10: Object Oriented Analysis & Design With Visio (Day 1)

Mulanya dari OOP (Object Oriented Programming) yang berkembang menjadi OOD (Object Oriented Design) dan akhirnya menjadi OOA (Object Oriented Analysis)

Berhubungan erat dengan E-R Model Keuntungannya dari analisa, design

sampai ke implementasi menggunakan notasi yang sama

Makin banyak organisasi yang mengimplementasikan metoda OO

Page 11: Object Oriented Analysis & Design With Visio (Day 1)

Booch Coad/Yourdon Schaler-Mellor Object Modeling

Technic

Nassi-Schneiderman

Gane-Sarson Jackson Jacobson Use

case

Page 12: Object Oriented Analysis & Design With Visio (Day 1)

Encapsulation Polymorphism Inheritance

Page 13: Object Oriented Analysis & Design With Visio (Day 1)

Merupakan konsep yang umum yang dapat digunakan untuk memodel hampir semua phenomena dan dapat dinyatakan dalam bahasa umum (natural language)› Noun menjadi object atau class› Verb menjadi behaviour› Adjective menjadi attributes

Memberikan informasi yang jelas tentang context dari system

Mengurangi biaya maintenance› Memudahkan untuk mencari hal yang akan diubah› Membuat perubahan menjadi local, tidak bepengaruh

pada modul yang lainnya

Page 14: Object Oriented Analysis & Design With Visio (Day 1)

user

System

Application DomainProblemDomain

Page 15: Object Oriented Analysis & Design With Visio (Day 1)

Problem Domain Application Domain

Payroll System

• Employee• Contracts• Work Schedule

Personal Office

Air Traffic • Plane• Flight Departure• Flight Corridors• Runaway• Flight Position

Part of the air traffic controller’s job

Telephone Signal

• Signal• Line• Transmitter• Receiver

Part of the technical job

Page 16: Object Oriented Analysis & Design With Visio (Day 1)

Kumpulan dari komponen yang mengimplementasikan model dari requirement, function dan interface

Page 17: Object Oriented Analysis & Design With Visio (Day 1)

user

Other system

Interface

Function

Model

system

• Mudah dimengerti• Tidak ada keraguan

Page 18: Object Oriented Analysis & Design With Visio (Day 1)

Model Component

Function Component

Interface Component

Planes, flight departures, flight corridors, position, and the relation among them

Plane change position, system update function, and change the model componen’s state

• Monitors, Printouts, other facilites to interact w/ users

• Connect to other system

Page 19: Object Oriented Analysis & Design With Visio (Day 1)

ArchitecturalDesign

ApplicationDomain

Analysis

Problem Domain

Analysis

Specifications ofcomponents

Model

Requirementsfor use

Specifications ofarchitecture

Siklus Pengembangan Dengan OOAD

ComponentDesign

Page 20: Object Oriented Analysis & Design With Visio (Day 1)

Problem Domainanalysis

Application Domainanalysis

Architecture Design

Component design

•Classes•Structure•Behavior

•Model Component•Function Component•Connected Components

UsageFunctionsInterface

•Criteria•Components•Processes

Page 21: Object Oriented Analysis & Design With Visio (Day 1)

Ada 3 kegiatan•Mencari elemen dari Problem Domain yaitu Objects, classes, dan events

•Buat model berdasarkan hubungan strutural antara class dan objects yang dipilih

•Interaksi antar object dan class serta behaviour dari object dan class

Page 22: Object Oriented Analysis & Design With Visio (Day 1)

System Definition

ClassesBehaviour

Structure

Model

Iterate

Page 23: Object Oriented Analysis & Design With Visio (Day 1)

Activity Content Concepts Classes

Which objects and events are part of the object system?

Class Object Event

Structure

How are classes and objects conceptually tied together?

Generalisation Aggregation Association Cluster

Behaviour

Which dynamic properties do the objects have?

Event sequence Behavioural pattern Attribute

Page 24: Object Oriented Analysis & Design With Visio (Day 1)

Memodel dunia nyata seperti yang akan dilihat oleh pemakai

Buat dahulu secara umum baru ke detil

Page 25: Object Oriented Analysis & Design With Visio (Day 1)

System Definition

ClassesBehaviour

Structure

Model

Page 26: Object Oriented Analysis & Design With Visio (Day 1)
Page 27: Object Oriented Analysis & Design With Visio (Day 1)
Page 28: Object Oriented Analysis & Design With Visio (Day 1)
Page 29: Object Oriented Analysis & Design With Visio (Day 1)

?

Page 30: Object Oriented Analysis & Design With Visio (Day 1)

?

Page 31: Object Oriented Analysis & Design With Visio (Day 1)

Principle: Klasifikasikan object didalam problem domain› Object: suatu entitas yang mempunyai indentitas, state

dan behaviour Need to be able to identify and delimit as independent

entity

› Class: adalah deskripsi dari kumpulan object yang mempunyai struktur, behaviour pattern dan attribute yang sama

Principle : Object diberi karakter sesuai dengan eventnya› Event: Insident yang terjadi seketika yang melibatkan

satu atau lebih object

Page 32: Object Oriented Analysis & Design With Visio (Day 1)

CustomerBank employeeContract description…

Enter into contractContract is terminated…

Agreement

Problem domain

Classes

Events

Page 33: Object Oriented Analysis & Design With Visio (Day 1)

Object adalah suatu entitas yang memiliki identitas, state, dan behaviour

Class adalah kumpulan dari object yang mempunyai structure, behavioural pattern, dan attributes yang bersamaan

Page 34: Object Oriented Analysis & Design With Visio (Day 1)

Cari candidate Untuk Class

Cari candidateUntuk event

Evaluasi dan pilihSecara sistematis

Event table

Page 35: Object Oriented Analysis & Design With Visio (Day 1)
Page 36: Object Oriented Analysis & Design With Visio (Day 1)

Cari Calon› Jangan membuang terlalu cepat, lebih baik

dievaluasi dengan teliti Model baru atau perbaiki situasi tidak hanya

seperti apa adanya Bagaimana menemukan candidate untuk

Class› Kata benda didalam keterangan atau pembicaraan› Daftar dari tipical object› Cari persamaan dengan sistem komputer› Literatur teknis didalam problem domain

Beri nama Class secara hati hati› Sederhana, mudah dibaca, tepat, tidak

membingungkan, seperti yg digunakan di problem domain

Page 37: Object Oriented Analysis & Design With Visio (Day 1)

Phenomena Class

Thing Car, goods, packaging, materials

People & Role Employee, parent, customer, member

Organisations Company, Department, Group, Project

Places Shelf, parking spot, construction site, city

Concepts Square, currency, quality, parameters, fee

Resources Money, time, energy, labour force, info

Apparatusses Radar, sensor, valve, motor

System Street register, cash register, alarm system

Page 38: Object Oriented Analysis & Design With Visio (Day 1)

Cari event didalam problem domain, bukan didalam sistem komputer

Jika event tidak instanttaneous harus dipecah menjadi event yang lebih kecil

Dimana menemukan candidate events :› Kt kerja didalam penjelasan atau wawancara› Daftar event yang umum atau tipikal type dari

event› Sistem komputer yang sejenis› Literatur teknis didalam problem domain

Page 39: Object Oriented Analysis & Design With Visio (Day 1)

Process EventsWork & Production Engine installed, customer served, order

finished

Transport Shipment received, article sent, car delivered

Consumption Item purchased, budget updated, item rejected

Life Cycle Person created, rejected, conference finished

Career & Education Graduate, job offered, resigned, enrolled

Contract & Exchange Reservation made, schedule agreed

Monitoring & Control Vehicle dispatched, temperature exceeded pump started

Planning & Management Employee allocated, schedule agreed

Decision making Article reviewed, article chosen

Page 40: Object Oriented Analysis & Design With Visio (Day 1)

Evaluate systematically What should be part of the problem domain

and what should not? More difficult with abstract concepts, e.g.

account, but may be helpful to ...› think of as physical object, e.g. box of receipts› think of as what it actually represents, e.g. contract

to allow withdrawal of money deposited Principle: Have an open mind, but select

critically

Page 41: Object Oriented Analysis & Design With Visio (Day 1)

Kebutuhan akan informasi› Masukan classes dan events hanya jika

system function akan menggunakan informasi tersebut

Fokus pada problem domain bukan application domain› Interested in those things that future users will

administrate, monitor, or control Harus relevan pada definisi sistem

› Jika tidak, perlu didiskusikan dengan user› Mungkin perlu mengubah definisi sistem

Page 42: Object Oriented Analysis & Design With Visio (Day 1)

Dapatkah mengidentifikasikan object dari class› Perlu dapat mengidentifikasikan object secara jelas

Apakah class mempunyai informasi yang unik› Dapatkah informasi diturunkun dari class lain

Apakah class dapat menurunkan banyak object ?› Jika hanya satu instance, biasanya hampir tidak

diperlukan Apakah class mempunyai jumlah event yang

cocok dan dapat di manage ?› Terlalu banyak event bisa menunjukkan butuh class lagi

Page 43: Object Oriented Analysis & Design With Visio (Day 1)

Apakah event itu instant ?› Jika tidak, maka kita perhatikan dengan mulai

dan berhentinya suatu event, dan mungkin event diantaranya

Apakah event atomic?› Jika mempunyai sub-event, gantikan event

utama dengan sub-event Apakah event dapat diidentifikasi pada

saat terjadi ?› Bagaimana kita tahu bahwa events tersebut

sudah terjadi ?

Page 44: Object Oriented Analysis & Design With Visio (Day 1)

System Definition

ClassesBehaviour

Structure

Model

Page 45: Object Oriented Analysis & Design With Visio (Day 1)

Dimulai dengan class dan event yang ada pada event table

Tentukan struktur object dan struktur class

Hubungkan antar class Hasilnya adalah class diagram

Page 46: Object Oriented Analysis & Design With Visio (Day 1)

Customer

Employee Day Schedule

Time Slot

OtherFreeWork

Apprentice Assistant

1

1..*

0..*

1

1

1..*

1

0..*

Appointment

1

1

Page 47: Object Oriented Analysis & Design With Visio (Day 1)

Car Person0..*

1..*Ownership

Name is optional,but recommended

Anywhere from zero to many

Anywhere from one to many

Page 48: Object Oriented Analysis & Design With Visio (Day 1)

4..*

1..*1

11 11

1

Body Motor Wheel

Cam Shaft Cylinder

Car

12..*

Assembly sideComponent side (min and max)

One and only one

Anywhere fromfour to many

Page 49: Object Oriented Analysis & Design With Visio (Day 1)

Passenger Car

Private CarTaxi

Account

LoanCheckingBank book

ServicePerson

EmployeeCustomer

Group under onegeneralisation

Multiple inheritance

Classwithoutobjects

Taxi “is a”passenger car orTaxis are a subset ofpassenger cars

Page 50: Object Oriented Analysis & Design With Visio (Day 1)

«cluster»Cars

OwnerCar

Passenger CarMotor

TaxiCylinder

Clerk

«cluster»People

Page 51: Object Oriented Analysis & Design With Visio (Day 1)

Find candidatesfor structure

Event table

Class diagram

Evaluate systematically

Explore patterns

Page 52: Object Oriented Analysis & Design With Visio (Day 1)

Coba temukan secara sistematis› Clusters:

Cluster biasanya dilakukan yang terakhir Kelompokan Class untuk memberikan kejelasan lebih

baik

› Generalisation: Periksa setiap pasangan class untuk struktur

generalisasi antar class, atau cari common class Periksa masing masing class untuk spesialisasi

(inheritance) yang relevan

Page 53: Object Oriented Analysis & Design With Visio (Day 1)

› Aggregation: Periksa setiap pasangan class untuk (1) whole-part,

container-content, atau association-member relationships antar class, dan untuk (2) a common whole yang menghubungkan mereka

Periksa setiap class untuk (3) components yang relevan

› Association: Periksa setiap pasangan class untuk needed

association(s) Tetapi, jangan hanya membuat structure

karena anda dapat› Apakah mereka relevan atau berguna› Apakah mereka dapat di representasikan

dengan lebih sederhana ? Mungkin perlu melacak ulang ke class

Page 54: Object Oriented Analysis & Design With Visio (Day 1)

Pola memberikan sumber inspirasi dan patokan untuk bagaimana memodel situasi

Pola yang umum termasuk …› Role pattern: object dengan multiple

roles› Relation pattern: relationship dengan

attributes › Hierarchy pattern: › Item-descriptor pattern:

Page 55: Object Oriented Analysis & Design With Visio (Day 1)

Person

CustomerEmployee

Customer-Employee

Person

CustomerRole

EmployeeRole

Shouldn’t dynamically change object from customer class or employee class to customer-employee class or vice versa

Page 56: Object Oriented Analysis & Design With Visio (Day 1)

Person

Role

Employee Customer

11..*

Person

Role

Role1 Rolen

10..*

Role2 ...

Generic Pattern

Page 57: Object Oriented Analysis & Design With Visio (Day 1)

Person

Ownership

1

0..*

Car1..* 1

Person CarOwns1..* 1 But … What if need attributes

for the owns relationship?E.g., date_purchased

Party1

Relation

10..*

Party20..* 1

Generic Pattern

Page 58: Object Oriented Analysis & Design With Visio (Day 1)

University

Division

11..*

School

11..*

Leveln

Leveln-1

11..*

Level1

11..*

...

GenericPattern

Book

Chapter

11..*

Section

11..*

...

Page 59: Object Oriented Analysis & Design With Visio (Day 1)

Book

Copy

10..*

Descriptor

Item

10..*

Generic Pattern

Logical

Physical

Page 60: Object Oriented Analysis & Design With Visio (Day 1)

Tetapi, bagaimana dengan student dari semester yang lama ?

Bagaimana mendapatkan daftar student dari unit ?

Tetapi masih dapat diketahui unit yang mana yang mempunyai syarat apa ?

Student UnitEnrolls in

0..* 0..*

Page 61: Object Oriented Analysis & Design With Visio (Day 1)

Gunakan item-descriptor untuk mengembangkan unit class

StudentUnit

OfferingEnrolls in

0..* 0..*

• Tetapi bagaimana kita dapat menyimpan nilai atau tanggal pendaftaran unit ?

Unit

1

0..*

Unit title, numberPrerequisites,etc.

Semester, Year, Instructor, etc.

Page 62: Object Oriented Analysis & Design With Visio (Day 1)

Unit Enrolment Example

• Gunakan relation pattern untuk mengembangkan enroll dengan association dan student class

UnitEnrolment Enrolls in

0..* 0..*

Unit

1

0..*

UnitOffering

1

0..*

Student

1

Name,Student #,

Address,etc.

Enrol Date,Unit Mark,

etc.

Page 63: Object Oriented Analysis & Design With Visio (Day 1)

Evaluate systematically› Structure types must be used correctly

aggregation vs association

› Structures must be conceptually true› Structures must be simple

Another golden rule› Structures must increase clarity

Page 64: Object Oriented Analysis & Design With Visio (Day 1)

Study abstract, static relationships between classes

Study concrete, dynamic relationships between objects

Model only the necessary structural relationships› focus on important aspects› include only a minimal number

Page 65: Object Oriented Analysis & Design With Visio (Day 1)

Individually, identify a list of candidate structures from the case description. › Remember to check each pair of classes,

etc.› Remember to check for all kinds of

structures.› Be sure that the “is a kind of” and “a part

of” semantics are applied correctly

Page 66: Object Oriented Analysis & Design With Visio (Day 1)

System Definition

ClassesBehaviour

Structure

Model

Page 67: Object Oriented Analysis & Design With Visio (Day 1)

Event Trace› Urutan dari event yang terjadi pada suatu

object Behavioural Pattern

› Daftar kemungkinan event traces yang terjadi pada semua object didalam class

Attribute› Keterangan property dari class atau event

Page 68: Object Oriented Analysis & Design With Visio (Day 1)

Describeattributes

Event table and class diagram

Behavioural patterns with attributes

Consider structuresand classes

Describe behavioural patterns

Explore patterns

Page 69: Object Oriented Analysis & Design With Visio (Day 1)

Perlu dibuat untuk setiap class Coba buat typical behaviour (event trace)

terlebih dahulu, baru kemudian ditambahkan behaviour yang ada

Hasilnya adalah behavioural pattern› Kumpulan pola event dari kemungkinan urutan

event untuk object didalam class Ditampilkan dengan menggunakan statechart Dapat ditampilkan dalam bentuk lain

› regular expression› state table

Page 70: Object Oriented Analysis & Design With Visio (Day 1)

a

Urutan

a

T1

b

T2

z

Pilihan

T

b

Iterasi

T

az

zT1 T2

b

a

a

Event

State

Perpindahan ke State berikutnya

Page 71: Object Oriented Analysis & Design With Visio (Day 1)

Waiting

Article

Letter of intent submitted(date of submission, title)

Article submitted(date)

Received

Decision announced(date of decision)

Deadline passed

authortitlestatus

StatesEvent

Attributes associated with event

End point

Start point

A choice of events

Page 72: Object Oriented Analysis & Design With Visio (Day 1)

Open

Account

owneraccount #balance

amount withdrawn(date, amount)

account closed(date)

account opened(date)

amount deposited

(date, amount)

Closedaccount opened

(date)

A multi-stateiteration

Single-stateiterations

Page 73: Object Oriented Analysis & Design With Visio (Day 1)

S1 S2 Sn

a b z

terminateterminate

terminate

a

terminate

S1 S2 Sn

b zaS

Page 74: Object Oriented Analysis & Design With Visio (Day 1)

The Stepwise Relation Pattern› Digunakan untuk associations dengan

agregation multiple level The Stepwise Role Pattern

› Digunakan untuk lifecycle yang menambah peran baru

The Composite Pattern› Digunakan ketika part dapat

ditambahkan secara rucursive

Page 75: Object Oriented Analysis & Design With Visio (Day 1)

Stepwiserelationpattern

(example)

Semester

Class

10..*

Group

10..*

Student

1

10..*

0..*

0..*

Class

assignedto

semester

assignedto class

assignedto group

Student pattern(partial)

1

Assigning

student assignedto class

Class pattern(partial)

Page 76: Object Oriented Analysis & Design With Visio (Day 1)

StepwiseRole

Pattern(example)

Sale

Offer DeliveryOrder

10..1

10..1

10..1

Negotiating

Arranging

Awaiting

offerrequested

offeraccepted

orderreceived

delivery made

salecancelled

Sale pattern(partial)

offerrequested

offeraccepted

offerrejectedOffer pattern

(partial)Offer

Page 77: Object Oriented Analysis & Design With Visio (Day 1)

Assembly

CompositePattern

(all three parts needed)

1

Part

Simple Composite

1..* Part patternassembly ofpart started

part mountedin composite

Ready

part at hand

Simple part pattern

Ready

Assembly

part mountedin compositepart at hand

assembly ofpart started

this part mountedinto another composite

Composite part pattern

part mountedinto this composite

Page 78: Object Oriented Analysis & Design With Visio (Day 1)

Subclass harus mempunyai semua events dari superclass

Subclass harus mengikuti behavioural patterns dari superclassnya, tetapi dapat menambahkan constrain dari behaviournya subclass

Dengan multiple inheritance, menurunkan event dan behaviour dari kedua superclassnya

Jika event dan behaviour dari superclass tidak consisten perlu mencari struktur generalisasinya

Page 79: Object Oriented Analysis & Design With Visio (Day 1)

Jika dua atau lebih object mempunyai event yang sama, kemungkinan mempunyai hubungan aggregation atau association

Sebaliknya juga sama, pada saat membuat atau menghapus hubungan ?

Jika event yang sama terjadi pada dua class, kemungkinan satu class adalah generalisasi dari yang lainnya.› Events dari subclass harus menjadi bagian dari

yang lainnya Jika event yang sama terjadi pada dua

class, class yang ketiga diperlukan untuk menjadi superclassnya.

Page 80: Object Oriented Analysis & Design With Visio (Day 1)

Memerlukan beberpa peran dari class bila urutan event saling bekerja bersamaan atau paralel

Contoh seperti pendidikan dan karir seseorang› Keduanya terjadi bersamaan disetiap saat› Masing masing mempunyai progress masing

masing› Mungkin saling berinteraksi antar sesama› Dapat memodel seperti dua peran untuk satu

orang, jadi dua peran class membentuk aggregation kedalam class person

Page 81: Object Oriented Analysis & Design With Visio (Day 1)

1

1..*

Customernameaddress

Accountbalance

Open

Amount withdrawn

Account closed(date)

Account opened(date)

Amount deposited

Active

Amount withdrawn

Account closed(date)

Account opened(date)

Amount deposited

Account opened(date)

Account closed(date)

Page 82: Object Oriented Analysis & Design With Visio (Day 1)

Adalah nama dari keterangan properti dari class atau event

Diturunkan dari class’s behavioural pattern

Hampir semua data dihubungkan pada event

Beberapa data tidak dihubungkan pada single events yang menunjukkan state atau object seperti account balance

Page 83: Object Oriented Analysis & Design With Visio (Day 1)

Apakah karakteristik umum dari Class Bagaimana data diterangkan di dalam

problem domain Data dasar apa yang harus diambil

tentang object dari class ? Hasil dari event trace yang mana

yang harus diambil

Page 84: Object Oriented Analysis & Design With Visio (Day 1)

Kapan event ini terjadi?› Tanggal, Jam› Perbedaan antara bila terjadi dan bila

ditemukan tentang event? Angka atau nilai mana yang

diperhatikan oleh event?› Seperti Jumlah uang, jumlah barang terjual

Page 85: Object Oriented Analysis & Design With Visio (Day 1)

Buat behavioural pattern dari event traces

Create behavioural patterns from event traces.

Study common events. Derive class attributes from

behavioural patterns.