You are on page 1of 165

Systems Analysis

and Design
Romi Satria Wahono
romi@romisatriawahono.net
http://romisatriawahono.net
081586220090

Romi Satria Wahono

SD Sompok Semarang (1987)


SMPN 8 Semarang (1990)
SMA Taruna Nusantara, Magelang (1993)
S1, S2 dan S3 (on-leave)
Department of Computer Sciences
Saitama University, Japan (1994-2004)
Research Interests: Software Engineering,
Intelligent Systems
Founder dan Koordinator IlmuKomputer.Com
Peneliti LIPI (2004-2007)
Founder dan CEO PT Brainmatics Cipta Informati
ka

Learning Design
Educational
Objectives
(Benjamin Bloom)

Criterion
Referenced
Instruction
(Robert Mager)

Cognitive

Competencies

Minimalism
(John Carroll)

Start Immediately
Minimize the
Reading

Affective

Performance
Error Recognition

Psychomotor

Evaluation

Self-Contained

Learning Design
Pretest dan Posttest
untuk Mengukur
Kompetensi Kognifif

Penugasan berbasis
Self-Contained Project
dan Literatur Review

Penyajian Materi
dengan Model
Minimalism berbasis
Konsep Amati-TiruModifikasi

Latihan Secara Iteratif


untuk Meningkatkan
Kompetensi Kognitif dan
Psikomotorik

Textbook

References
1. Alan Dennis et al, Systems Analysis and Design
with UML 4th Edition, John Wiley and Sons, 2013
2. Kenneth E. Kendall and Julie E Kendall, Systems
Analysis and Design 8th Edition, Prentice Hall, 20
10
3. Hassan Gomaa, Software Modeling and Design:
UML, Use Cases, Patterns, and Software Architec
tures, Cambridge University Press, 2011
4. Gary B. Shelly and Harry J. Rosenblatt, Systems A
nalysis and Design 9th Edition, Course Technolog
y, 2011
5. Howard Podeswa, UML for the IT Business Analy
st 2nd Edition, Course Technology, 2009

Pre-Test
1. Sebutkan tahapan pengembangan sistem atau syste
m development life cycle (SDLC)!
2. Sebutkan beberapa metodologi pengembangan siste
m yang anda ketahui!
3. Gambarkan requirement di bawah dengan use case d
SISTEM ELIBRARY
iagram!

Sistem elibrary memungkinkan pengguna untuk


melakukan registrasi dan login
Setelah menjadi member, pengguna dapat memodifikasi
profile, serta mencari dan mendownload koleksi buku
elibrary
Admin sistem elibrary melakukan approval terhadap
registrasi dan menampilkan laporan aktifitas pengguna
secara individual maupun total

4. Buat program yang menampilkan tulisan "Halo Jakart


a" di layar monitor, dengan bahasa pemrograman yan

Course Contents
1.Introduction
2.Project Planning
3.System Analysis
4.System Design
5.System Implementation

1. INTRODUCTIO
N

Learning Objectives
1. Understand the system analysis and design a
nd the term of analyst
2. Understand the system development life cycl
e and its four phases
3. Understand the evolution of system develop
ment methodologies
4. Be familier with the Unified Modeling Langua
ge (UML) version 2.0
5. Understand the characteristics of object-orie
nted paradigm

Key Ideas
More than half of all systems developme
nt projects Fail
(42% - Standish Group, 53% - General Accounting Off
ice)

Canceled before completion


System is never used once finished
Doesn't provide the expected benefits

Most of the ones that don't fail:


Are delivered late
Are over budget
Don't provide the features promised

Recent Significant IT Failures


Company

Year

Outcome

Hudson Bay
(Canada)

2005

Inventory system problems lead to


$33.3 million loss

UK Inland Revenue

2004/
5

$3.45 billion tax-credit overpayment


caused by software errors

Avis Europe PLC


(UK)

2004

Enterprise resource planning (ERP)


system cancelled after $54.5 million
spent

Ford Motor Co.

2004

Purchasing system abandoned after


deployment costing approximately
$400 M

Hewlett-Packard
Co.

2004

ERP system problems contribute to


$160 million loss

AT&T Wireless

2004

Customer relations management


(CRM) system upgrade problems
lead to $100M loss

Is it Possible?

Systems Analyst and Its


Roles

Analyst Related Role


1. Business analyst
2. System analyst
3. Infrastructure analyst
4. Change management analyst
5. Project manager

Role in System Development


Project Manager

Business
Analyst

System
Analyst

Programmer

Tester

Business Analyst
Focuses on business issues surrou
nding the system
The business value of the system
Improvements in business processes
New business processes needed with new
system

Requires business skills and profes


sional training

System Analyst
The systems analyst is a key person anal
yzing the business, identifying opportuni
ties for improvement, and designing info
rmation systems to implement these ide
as
Focuses on Information System (IS) Issue
s
How IS can improve business processes
Designs new information system
Ensures IS quality standards are maintained

Requires training & experience in design

Infrastructure Analyst
Focuses on interfaces between new
system & existing infrastructure
Makes sure new system follows organizationa
l standards
Identifies required infrastructure changes

Requires experience in network & da


tabase administration
Requires knowledge of hardware sys
tems

Change Management Analyst


Focuses on system installation
Documentation & support for users
Coordinate training of users
Strategies to overcome resistance

Requires experience in organizationa


l behavior
Requires experience in change mana
gement

Project Manager
Responsible for schedule and bud
get
Ensures promised benefits are deli
vered
Manages team members
Responsible for project plan and re
porting progress
Requires project management exp
erience

Systems Development
Life Cycle (SDLC)

Systems Development Life Cycl


e (SDLC)
Planning

Implementati
on

Analysis

Design

Project Phases
1. Planning : Why build the system?

System request, feasibility analysis, project size e


stimation

2. Analysis :

Who, what, when, where will the syste

m be?
Requirement gathering, business process modeli
ng

3. Design :

How will the system work?

Program design, user interface design, data desig


n

4. Implementation :
elivery

System construction and d

Planning
1. Identifying business value (System Req
uest)

Lower costs
Increase profits

2. Analyze feasibility

Technical Feasibility
Economic Feasibility
Organizational Feasibility

3. Estimating the size of project


(System Proposal)

Analysis
1. Requirement gathering by answering t
he questions:

Who will use the system?


What will the system do?
When will it be used?

2. Investigate the current system


3. Identify possible improvements
4. Develop a concept for new system
(Business Process Model)

Design
1. Program Design (UML Diagrams)

What programs need to be written


Exactly what each program will do

2. User Interface Design

How users interact with system


Forms / reports used by the system

3. Data Design (ER Diagrams)

What data is to be stored


What format the data will be in
Where the data will be stored

(System Specification)

Implementation
Construction
New system is built and tested
Often testing is the longest part

Testing
Unit Testing
Integration Testing
System Testing
User Acceptance Test

Installation
Old system is turned off
New system is turned on

Processes and Deliverables


Process

Product

Planning

System Proposal

Analysis
Design

System
Specification

Implementa
tion

New System with


Testing/Maintenance
Plan

SDLC and Deliverables


Planning
(System Proposal)

Implementatio
n
(New System)

Design

(System
Specification)

Analysis

(System
Specification)

Systems Development
Methodologies

What Is a Methodology?
A formalized approach to implementing
the SDLC (series of steps and deliverabl
es)
Writing code without a well-thought-ou
t system request may work for small pro
grams, but rarely works for large ones

Major Methodologies
1. Structured Design
Waterfall method
Parallel development

2. RAD Development
Phased Development
Prototyping
Throw-away Prototyping

3. Agile Development
Extreme Programming (XP)
Scrum

Structured Design Methodology


Projects move methodically from one
to the next step
Generally, a step is finished before th
e next one begins

Waterfall Method

Pros - Cons of the Waterfall Method


Pros
Identifies systems
requirements long
before programming
Begins, it minimizes
change to the
requirements as the
project proceed
(mature)

Cons
Design must be
specified on paper
before programming
begins
Long time between
system proposal and
delivery of new
system
Rework is very hard

Parallel Development
Addresses problem of time gap betw
een proposal and delivery
General process:
1. Breaks project into parallel subproject
2. Integrates them at the end

Parallel Development

Rapid Application Development


1. Phased development

A series of versions

2. Prototyping

System prototyping

3. Throw-away prototyping

Design prototyping

Rapid Application Development


Critical elements to speed up the
SDLC:
CASE tools
Visual programming languages
Code generators

RAD: Phased Development


Break overall system into a series o
f versions
Each version has Analysis, Design,
and Implementation
Output from on version is the inpu
t to the next
Incorporate ideas, issues, lessons l
earned in one version into the next
version

RAD: Phased Development


Pros
Gets useful system
to users quickly
Most important
functions tested
most

Cons
Initial system is
intentionally incomplete
System requirements
expand as users see
versions

RAD: Prototyping
Analysis, Design, Implementation ar
e performed concurrently
Start with a "quick-and-dirty" protot
ype
Provides minimal functionality

Repeat process, refining the protot


ype each time
Stop when prototype is a working s
ystem

RAD: Prototyping

RAD: Prototyping
Pros

Cons

Gets working system


to users quickly

Fast paced. Hard to


conduct careful,
methodical analysis

Reassures users that


the project is
progressing

Initial design
decisions have long
term staying power

Quickly refines true


requirements

Problems may
come to light late in
design, requiring
re-design

RAD: Throw-Away Prototyping


Use prototypes only to understand requ
irements
Example: use html to show UI

Prototype is not a working design


Once requirements are understood, the
prototypes are thrown away
The system is then built using SDLC

RAD: Throw-Away Prototyping

Agile Development
Just a few rules that are easy to learn an
d follow
Streamline the SDLC
Eliminate much of the modeling and documentation
Emphasize simple, iterative application developmen
t

Examples include:
Extreme Programming (XP)
Scrum
Dynamic Systems Development Model (DSDM)

Extreme Programming (XP)


Core Values of XP
1.
2.
3.
4.

Communication All to All


Simplicity KISS, refactoring
Feedback Embrace Change
Courage Quality First, test and efficient c
oding

Extreme Programming (XP)


1. User Stories about system do
2. Code small program using defined s
tandards
Naming conventions
Coding practices

3. User Feedback
4. Repeat

Extreme Programming (XP)

Selecting the Appropriate Meth


odology
1.
2.
3.
4.
5.
6.

Clarity of User Requirements


Familiarity with Technology
System Complexity
System Reliability
Short Time Schedules
Schedule Visibility

Selecting the Right Methodology

Exercise: Selecting Methodolog


y
Suppose you are an analyst for the Roanoke Soft
ware Consulting Company (RSCC), a large cons
ulting firm with offices around the world. The co
mpany wants to build a new knowledge manage
ment system that can identify and track the exp
ertise of individual consultants anywhere in the
world based on their education and the various
consulting projects on which they have worked.
Assume that this is a new idea that never done b
efore been attempted in RSCC or elsewhere. RS
CC has an international network, but the offices
in each country may use somewhat different har
dware and software. RSCC management wants t

The Unified Modelling


Language (UML)

Analysis Design Paradigm and Dia


grams
1. Data-oriented DFD
2. Process-oriented Flowchart
3. Object-oriented (data + process)
UML

Sejarah UML
In the 90s many people Booch, Jacobson, Rumbaugh
creating OO diagramming languages
Three different ones created by Grady Boo
ch, Ivar Jacobson, James Rumbaugh
Joined forces with
Rational (company) to
create Unified Modeling
Langauge (UML)

Sejarah UML
2011

UML 2.4

What is the UML?


UML: Unified Modeling Language
UML can be used for modeling all process
es in the development life cycle and acros
s different implementation technologies (t
echnology and language independent)
UML is the standard language for visualizi
ng, specifying, constructing, and docume
nting the artifacts of a software-intensive s
ystem
UML is a communication tool for the tea
m, and other stakeholders

Why Modeling?
Modeling captures essential parts of the system
(James Rumbaugh)

Business Process

Computer System

Visual Modeling is modeling using


standard graphical notations

The Triangle of Success in Softwar


e Dev.

Notation:
Standard

Process:
CustomerOriented
Methodology

Tools:

Support
Standard and
Process

UML Tools

Rational Rose
Visual Paradigm
Enterprise Architect
Microsoft Visio
Star UML
Netbeans UML Plugin

UML Diagrams
Use-Case
Diagram

Statechart
Class Diagram Diagram

add file

DocumentList

Use Case 1

FileMgr

Actor A

Actor B

Document
add( )
delete( )

fetchDoc( )
sortByName( )

name : int
docid : int
numField : int
get( )
open( )
close( )
read( )
sortFileList( )
create( )
fillDocument( )

Use Case 2
FileList
fList
add( )
delete( )

Writing

add file [ numberOffile==MAX ] /


flag OFF
read() fill the
code..

Openning

close file

Use Case 3

close file

Closing

Reading

rep
Repository
(from Persistence)

File

read( )

Deployment
Diagram

GrpFile

name : char * = 0
readDoc( )
readFile( )

Collaboratio
n Diagram

read( )
open( )
create( )
fillFile( )

9: sortByName ( )

Repository

mainWnd : MainWnd

1: Doc view request ( )

DocumentList

Windows95

Window95

FileManager

Windows95

2: fetchDoc( )

Document

gFile : GrpFile

4: create ( )

.EXE

8: fillFile ( )

Windows
NT

user : Clerk

Solaris

fileMgr : FileMgr

.EXE

GraphicFile

3: create ( )

Alpha
UNIX
.EXE

6: fillDocument ( )

File

FileList

Windows
NT

IBM
Mainframe

7: readFile ( )
5: readDoc ( )

document : Document

repository : Repository

mainWnd
user

fileMgr :
FileMgr

document :
Document

gFile

1: Doc view request ( )

2: fetchDoc( )

repository

Component
Diagram

3: create ( )

4: create ( )

5: readDoc ( )

6: fi llDocument ( )

7: readFile ( )

8: fillFile ( )

9: sortByName ( )

Sequence
Diagram

Forward
and
Reverse
Engineerin
g

Target
Syste
m

UML 2.0
UML version 2.0 has 14 diagrams in
2 major groups:
1. Structure Diagrams
2. Behavior Diagrams

UML 2.0 Diagram

UML Structure Diagrams


Represent the data and static relatio
nships in an information system
1.
2.
3.
4.
5.
6.

Class Diagram
Object Diagram
Package Diagram
Deployment Diagram
Component Diagram
Composite Structure Diagram

Structure Diagrams
1. Class Diagrams
Common vocabulary used by analyst and users
Represent things (employee, paycheck,)
Shows the relationships between classes

2. Object Diagrams
Similar to class diagrams
Instantiation of a class diagram
Relationships between objects

3. Package Diagrams
Group UML elements together to form higher leve
l constructs

Structure Diagrams
4. Deployment Diagrams

Shows the physical architecture and software co


mponents of system
For example, network nodes

5. Component Diagrams

Physical relationships among software compone


nts
Example Client/Server (Which machines run w
hich software)

6. Composite Structure
Illustrates internal structure of a complex class

UML Behavior Diagrams


Depict the dynamic relationships among t
he instances or objects that represent the
business information system
1.
2.
3.
4.

Activity Diagram
Sequence Diagram
Communication Diagram
Interaction Diagram

5. Timing Diagram
6. Behavior State Machine
7. Protocol State Machine

Behavior Diagrams
1. Activity Diagrams

Model processes in an information system


Example: Business workflows, business logic

2. Interaction Diagrams

Shows interaction among objects

3. Sequence Diagrams

Time-based ordering of the interaction

4. Communication Diagrams

Communication among a set of collaborating objects


of an activity

Behavior Diagrams
5.

6.

7.

8.

Interaction Diagrams
Overview of flow of control of a process

Timing Diagrams
Show how an object changes over time

State Machines
Examines behavior of one class
Models the different states and state transitions an
object can experience

Use-Case Diagrams
Shows interaction between the system and environ
ment
Captures business requirements

UML Problems
UML is modeling notation, it is not a devel
opment process or a methodology
UML driven development process?

UML is too complex, difficult to understan


d quickly
Should we use all UML diagrams?

UML Process (EA Sparx)


1. Display the boundary of a system and i
ts major functions using use cases and
actors
2. Model the organizations business pro
cess with activity diagram
3. Illustrate use case realizations with seq
uence diagrams
4. Represent a static structure of a system
using class diagrams
5. Reveal the physical implementation ar

UML Process (EA Sparx)


1.
2.
3.
4.
5.

Use Cases Diagram


Activity Diagram
Sequence Diagram
Class Diagram
Deployment Diagrams

UML Process (Kendal, 2011)


1. A use case diagram, describing how the system
is used. Analysts start with a use case diagram
2. An activity diagram, illustrating the overall flow
of activities. Each use case may create one acti
vity diagram
3. Sequence diagrams, showing the sequence of
activities and class relationships. Each use cas
e may create one or more sequence diagrams
4. Class diagrams, showing the classes and relatio
nships. Sequence diagrams are used to determ
ine classes
5. Statechart diagrams, showing the state transiti

(Kendall and Kendall, 2011)

UML Process (Barclay, 2004)

System Analysis and Design with


UML
1. System Analysis
1.

Business Process Identification

2.

Use Case Diagram

Business Process Modeling

3.

Activity Diagram or Business Process Modeling Notation (BPMN)

Business Process Realization

Sequence Diagram (Buat untuk setiap use case dengan menggunakan pola Boundary-Co
ntrol-Entity)

2. System Design
1.

Program Design
1.

Class Diagram

(Gabungkan Boundary-Control-Entity Class dan susun story dari sistem ya

ng dibangun)

2.
3.

Package Diagram
(Gabungan class yang sesuai, boleh menggunakan pola B-C-E)
Deployment Diagram (arsitektur software dari sistem yang dibangun)

2. User Interface Design (Buat UI design dari Boundary Class)


3. Entity-Relationship Model (Buat ER diagram dari Entity Class)

Case Study: ATM Syste


m

ATM System

ATM System

Layar

Kotak Uang

Kotak Kartu
Kotak Kuitansi

Masukkan PIN:

Kotak Uang

Kotak Kartu
Kotak Kuitansi

Menu Utama
1. Melihat Saldo
2. Mentransfer Uang
3. Mengambil Uang
4. Logout
Kotak Uang

Kotak Kartu
Kotak Kuitansi

Menu Melihat Saldo

1. Saldo anda adalah .


Kotak Uang

Kotak Kartu
Kotak Kuitansi

Menu Mentransfer Uang

1. No Account Penerima:
Kotak Uang

Kotak Kartu
Kotak Kuitansi

Menu Mentransfer Uang

1. Jumlah uang yang dikirim:


Kotak Uang

Kotak Kartu
Kotak Kuitansi

Menu Mentransfer Uang

1. Uang berhasil terkirim


Kotak Uang

Kotak Kartu
Kotak Kuitansi

Menu Mengambil Uang

1. Jumlah uang yang diambil:


Kotak Uang

Kotak Kartu
Kotak Kuitansi

Menu Mengambil Uang

Uang berhasil diambil


Kotak Uang

Kotak Kartu
Kotak Kuitansi

Use Case Diagram

Use Case Diagram (Alternatif)

Activity Diagram: Memasukkan K


artu

Activity Diagram: Memasukkan P


IN

Activity Diagram: Mengecek Sal


do

Activity Diagram: Mentransfer U


ang

Activity Diagram: Mengambil Ua


ng

Activity Diagram: Melakukan Lo


gout

Sequence Diagram: Memasukkan


Kartu

Type of Class
1. Boundary Class

Class yang berhubungan dengan actor


(user interface)

2. Control Class

Class yang berhubungan dengan pemr


osesan, komputasi, penghitungan, dsb

3. Entity Class

Class yang berhubungan dengan data


(flat file or database)

Sequence Diagram: Memasukkan


PIN

Sequence Diagram: Mengecek S


aldo

Sequence Diagram: Mentransfer


Uang

Sequence Diagram: Mengambil


Uang

Sequence Diagram: Melakukan L


ogout

Class Diagram

Deployment Diagram (2 Tier)

Data Model

User Interface Design

User Interface Design (Netbean


s)

Object-Oriented Par
adigm

Konsep Dasar Pemrogr


aman Berorientasi Obj
ek

Class , Object, Method, Attribute

Berorientasi Objek?
Attribute:
Topi, Baju, Jaket,
Tas Punggung,
Tangan, Kaki,
Mata
Behavior:
Cara Jalan ke
Depan
Cara Jalan Mundur
Cara Belok ke Kiri
Cara Memanjat

Berorientasi Objek?
Attribute (State):

Ban, Stir, Pedal Rem, Pedal Gas,


Warna, Tahun Produksi

Behavior:
Cara Menghidupkan Mesin
Cara Manjalankan Mobil
Cara Memundurkan Mobil

Attribute Variable(Member
Behavior Method(Fungsi)

Perbedaan Class dan Object


Class: konsep dan deskripsi dari sesuatu
Class mendeklarasikan method yang dapat digunaka
n (dipanggil) oleh object

Object: instance dari class, bentuk (conto


h) nyata dari class
Object memiliki sifat independen dan dapat digunaka
n untuk memanggil method

Contoh Class dan Object:


Class: mobil
Object: mobilnya pak Joko, mobilku, mobil berwarna
merah

Perbedaan Class dan Object


Class seperti cetakan kue, dimana kue y
g dihasilkan dari cetakan kue itu adalah
object
Warna kue bisa bermacam-macam mesk
ipun berasal dari cetakan yang sama (ob
ject memiliki sifat independen)

Class = Method + Variable


Class
Sepeda

gir

kecepatan

variabl
e

tampilkan kecepatan
ubah gir

metho
d

Object = Method + Variable yg Memil


iki Nilai
Object
Sepedaku

gir = 3

kecepatan = 10km/jam

instance
variable

tampilkan kecepatan ()
kecepatan = 10 km/jam
ubah gir (2)
gir = 5

instanc
e
method

Attribute
Variable yang mengitari class, dengan nilai dat
anya bisa ditentukan di object
Variable digunakan untuk menyimpan nilai yan
g nantinya akan digunakan pada program
Variable memiliki jenis (tipe), nama dan nilai
Name, age, dan weight adalah atribute (variab
el) dari class Person

Membuat Class, Object dan Memanggil Atr


ibut
public class Mobil {
String warna;
int tahunProduksi;

Mobil.java

}
public class MobilBeraksi{
MobilBeraksi.java
public static void main(String[] args){
// Membuat object
Mobil mobilku = new Mobil();
/* memanggil atribut dan memberi nilai */
mobilku.warna = "Hitam";
mobilku.tahunProduksi = 2006;
System.out.println("Warna: " + mobilku.warna);
System.out.println("Tahun: " + mobilku.tahunProduksi);
}
}

Method
Method adalah urutan instruksi yang m
engakses data dari object
Method melakukan:
1. Manipulasi data
2. Perhitungan matematika
3. Memonitor kejadian dari suatu event

Method

Membuat dan Memanggil Method


public class Mobil2{
String warna;
int tahunProduksi;

Mobil2.java

void printMobil(){
System.out.println("Warna: " + warna);
System.out.println("Tahun: " + tahunProduksi);
}
}
public class Mobil2Beraksi{
public static void main(String[] args){
Mobil2 mobilku = new Mobil2();
mobilku.warna = "Hitam";
mobilku.tahunProduksi = 2006;
mobilku.printMobil();
}
}

Mobil2Beraksi.java

Latihan
Buat class Handphone yang berisi empa
t method:
1. hidupkan()
2. lakukanPanggilan()
3. kirimSMS()
4. matikan()
.Isi masing-masing method dengan tampilan
status menggunakan System.out.println()

Buat class HandphoneBeraksi, dan pang


gil method-method diatas dalam class te

Latihan: Hasil Tampilan


Handphone hidup
Kring, kring, kring panggilan dilakukan
Dung, dung sms berhasil terkirim
Handphone mati

Jenis Method: Mutator dan Acce


ssor

Parameter
Sepeda akan berguna apabila ada object lain yang
berinterasi dengan sepeda tersebut
Object software berinteraksi dan berkomunikasi de
ngan object lain dengan cara mengirimkan messag
e atau pesan
Pesan adalah suatu method, dan informasi dalam p
esan dikenal dengan nama parameter

Pengiriman Pesan dan Paramete


r

1. You

object pengirim

2. YourBicycle
3. changeGears
dijalankan
4. lowerGear
method

object penerima
pesan berupa method yang
parameter yang dibutuhkan
(pesan) untuk dijalankan

Sepeda.java
public class Sepeda{
int gir;
// method (mutator) dengan parameter
void setGir(int pertambahanGir) {
gir= gir+ pertambahanGir;
}
// method (accessor)
int getGir() {
return gir;
}
}

SepedaBeraksi.java
public class SepedaBeraksi{
public static void main(String[] args) {
// Membuat object
Sepeda sepedaku = new Sepeda();
// Memanggil method dan menunjuk nilai parameter
sepedaku.setGir(1); // menset nilai gir = 1
System.out.println(Gir saat ini: + sepedaku.getGir());
sepedaku.setGir(3); // menambahkan 3 pada posisi gir saat
ini (1)
System.out.printl
n(Gir saat ini: + sepedaku.getGir());
}
}

Latihan: Class Matematika dan Para


meter
Buat Class bernama Matematika, yang berisi m
ethod dengan dua parameter:
pertambahan(int a, int b)
pengurangan(int a, int b)
perkalian(int a, int b)
pembagian(int a, int b)

Buat Class bernama MatematikaBeraksi, yang


mengeksekusi method dan menampilkan:
Pertambahan: 20 + 20 = 40
Pengurangan: 10-5 = 5
Perkalian: 10*20 = 200
Pembagian: 21/2 = 10

Variasi Tampilan
pertambahan(int a, int b){
System.out.println(a + + + b + = + (a+
b))
}
pertambahan(int a, int b){
System.out.println(Hasil = + (a+b))
}
pertambahan(int a, int b){
int hasil = a + b;
System.out.println(Hasil = + hasil)
}

Konstruktor -1 Method yang digunakan untuk memberi n


ilai awal pada saat object diciptakan
Dipanggil secara otomatis ketika new digu
nakan untuk membuat instan class
Sifat konstruktor:
Nama konstruktor sama dengan nama class
Tidak memiliki nilai balik dan tidak boleh ada
kata kunci void

Konstruktor -2public class Mobil {


String warna;
int tahunProduksi;
public Mobil(String warna, int tahunProduksi){
this.warna = warna;

Mobil.java

this.tahunProduksi = tahunProduksi;
}
public void info(){
System.out.println("Warna: " + warna);
System.out.println("Tahun: " + tahunProduksi);
}
}
public class MobilKonstruktor{
MobilKonstruktor.java
public static void main(String[] args){
Mobil mobilku = new Mobil(Merah, 2003);
mobilku.info();
}
}

Kata Kunci this


Digunakan pada pembuatan class dan dig
unakan untuk menyatakan object sekarang
public class Mobil{
String warna;
int tahunProduksi;

public class Mobil{


String warna;
int tahunProduksi;

void isiData(String
aWarna,
int
aTahunProduksi){

void isiData(String
warna,
int
tahunProduksi){

warna = aWarna;
tahunProduksi =
aTahunProduksi;

this.warna = warna;

this.tahunProduksi =
tahunProduksi;

Latihan
1. Buat class Bank

Buat konstruktor class Bank dengan parameter:


saldo
Buat method: simpanUang, ambilUang, dan get
Saldo

2. Buat class BankBeraksi, tetapkan saldo awa


l lewat konstruktur Rp. 100000, jalankan 3
method di atas, dan tampilkan proses seba
gai berikut:
Selamat Datang di Bank ABC
Saldo awal: Rp. 100000
Simpan uang: Rp. 500000

Karakteristik Pemrogra
man Berorientasi Obje
k

Abstraction, Encapsulation,
Inheritance, Polymorphism

Abstraction
Cara kita melihat suatu sistem dalam bentu
k yang lebih sederhana, yaitu sebagai suat
u kumpulan subsistem (object) yang saling
berinteraksi.
Mobil adalah kumpulan sistem pengapian, siste
m kemudi, sistem pengereman

Alat meng-abstraksikan sesuatu adalah cla


ss
Object bersifat modularity. Object dapat di
tulis dan dimaintain terpisah (independen)
dari object lain

Encapsulation
Mekanisme menyembunyikan suatu proses dan
data dalam sistem untuk menghindari interferen
si, dan menyederhanakan penggunaan proses it
u sendiri
Tongkat transmisi (gigi) pada mobil
Tombol on/off/pengaturan suhu pada AC

Class access level (public, protected, privat) ada


lah implementasi dari konsep encapsulation
Enkapsulasi data dapat dilakukan dengan cara:
1. mendeklarasikan instance variable sebagai private
2. mendeklarasikan method yang sifatnya public untuk
mengakses variable tersebut

Encapsulation dan Access Modif


ier
Modifier

Dalam
Class
yang
Sama

Dalam
Package
yang Sama

Dalam Dalam
SubCla Package
ss
Lain

private

tanpa
tanda

protected

public

Encapsulation
Enkapsulasi data juga dapat dilakukan deng
an cara:
1. mendeklarasikan instance variable sebagai priva
te
2. mendeklarasikan method yang sifatnya public u
ntuk mengakses variable tersebut

Sepeda.java
public class Sepeda{
int gir;
void setGir(int pertambahanGir) {
gir= gir+ pertambahanGir;
}
int getGir() {
return gir;
}
}

SepedaBeraksi.java
public class SepedaBeraksi{
public static void main(String[] args) {
Sepeda sepedaku = new Sepeda();
sepedaku.setGir(1);
/* Variabel bisa diubah atau tidak sengaja diubah.
Hal ini berbahaya dan sering menimbulkan bug.
Berikan access modifier private pada instance variabl
e */
sepedaku.gir = 3;
System.out.println(Gir saat ini: + sepedaku.getGir());
}
}

Sepeda.java
public class Sepeda{
private int gir; // access modifier private pada instance va
riable

void setGir(int pertambahanGir) {


gir= gir+ pertambahanGir;
}
int getGir() {
return gir;
}
}

Inheritance (Pewarisan)
Suatu class dapat me
wariskan atribut dan
method kepada class
lain (subclass), serta
membentuk class hie
rarchy
Penting untuk Reusa
bility
Java Keyword:
extends

Sepeda.java
public class Sepeda{
private int gir;
void setGir(int pertambahanGir) {
gir= gir+ pertambahanGir;
}
int getGir() {
return gir;
}
}

Class SepedaGunung Mewarisi Class


Sepeda
public class SepedaGunung extends Se public class SepedaGunungBeraksi {
public static void main(String[] args) {
peda{
SepedaGunung sg=new SepedaGunung();

private int sadel;

sg.setGir(3);
System.out.println(sg.getGir());

void setSadel (int jumlah) {


sadel = getGir() - jumlah;
}
int getSadel(){
return sadel;
}

sg.setSadel(1);
System.out.println(sg.getSadel());
}
}

SepedaGunung.java

SepedaGunungBeraksi.java

Latihan: Inheritance Matematika


1. Buat class MatematikaCanggih yang meru
pakan inherit dari class Matematika
1. Tambahkan method modulus(int a, int b) yang
menghitung modulus dari a dan b
2. Operator modulus adalah %

2. Buat class MatematikaCanggihBeraksi yan


g memanggil method pertambahan, perka
lian dan modulus

Polymorphism
Kemampuan untuk memperlakukan o
bject yang memiliki perilaku (bentuk)
yang berbeda
Implementasi konsep polymorphism:
1. Overloading: Kemampuan untuk menggun
akan nama yang sama untuk beberapa met
hod yang berbeda parameter (tipe dan ata
u jumlah)
2. Overriding: Kemampuan subclass untuk m
enimpa method dari superclass, yaitu deng
an cara menggunakan nama dan paramete

Polymorphism Overloading
class Mobil {
String warna;
int tahunProduksi;

public class MobilKonstruktor{


public static void main(String[]
args){
Mobil mobilku = new Mobil(Merah,
2003);

public Mobil(String warna, int tahunProdu


ksi){
this.warna = warna;
this.tahunProduksi = tahunProduksi;
}
public Mobil(){
}
void info(){
System.out.println("Warna: " + warna);
System.out.println("Tahun: " + tahunProduks
i);

}
}

mobilku.info();
Mobil mobilmu = new Mobil();
mobilmu.info();
}
}

Polymorphism Overloading
class Lingkaran{
void gambarLingkaran(){
}
void gambarLingkaran(int diameter){
...
}
void gambarLingkaran(int diameter, int x, int y){
...
}
void gambarLingkaran(int diameter, int x, int y, int warna, S
tring namaLingkaran){
...
}
}

Polymorphism - Overriding
public class Sepeda{
protected int gir;
void setGir(int pertambahanGir) {
gir= gir+ pertambahanGir;
}
int getGir() {
return gir;
}
}

Polymorphism - Overriding
public class SepedaGunung extends Se public class SepedaGunungBeraksi {
public static void main(String[] args) {
peda{
SepedaGunung sg=new SepedaGunung();

void setGir(int pertambahanGir)


{
super.setGir(pertambahanGi
r);
gir = 2*getGir();
}
}

SepedaGunung.java

sg.setGir(2);
System.out.println(sg.getGir());
sg.setGir(3);
System.out.println(sg.getGir());
}
}

SepedaGunungBeraksi.java

Latihan: Overloading pada Mate


matika
1.
2.

3.

4.
5.

Kembangkan class Matematika, MatematikaC


anggih dan MatematikaBeraksi
Lakukan overloading pada Method yang ada
(pertambahan, pengurangan, perkalian, pem
bagian, modulus)
Tambahkan method baru bertipe data doubl
e (pecahan) dan memiliki 3 parameter: doubl
e a, double b, double c
Uji di kelas MatematikaBeraksi dengan para
meter pecahan: 12.5, 28.7, 14.2
Misalnya:
pertambahan(12.5, 28.7, 14.2)

pertambahan(12,

Matematika.java
public class Matematika{
void pertambahan (int a, int b){
int hasil= a + b;
System.out.println(hasil: + hasil);
}
void pertambahan (double a, double b, double c){
int hasil= a + b + c;
System.out.println(hasil: + hasil);
}
...
}

Summary -1 The systems analyst is a key person ana


lyzing the business, identifying opportu
nities for improvement, and designing i
nformation systems to implement these
ideas
There are five major team roles:
Business analyst
Systems analyst
Infrastructure analyst
Change management analyst
Project manager

Summary -2 The Systems Development Lifecycle co


nsists of four stages: Planning, Analysis,
Design, and Implementation
The major development methodologie
s:
1. Structured design

Waterfall method
Parallel development

2. RAD development

Phased Development
Prototyping
Throw-away Prototyping

3. Agile development
Extreme Programming

Summary -3 UML is the standard language for visualiz


ing, specifying, constructing, and docum
enting the artifacts of a software-intensiv
e system
UML version 2.0 has 14 diagrams in 2 gr
oups:
1. Structure Diagrams
2. Behavior Diagrams

UML concepts are based on objectoriented paradigm

Referensi
1. Alan Dennis et al, Systems Analysis and Design
with UML 4th Edition, John Wiley and Sons, 2013
2. Kenneth E. Kendall and Julie E Kendall, Systems
Analysis and Design 8th Edition, Prentice Hall, 20
10
3. Hassan Gomaa, Software Modeling and Design:
UML, Use Cases, Patterns, and Software Architec
tures, Cambridge University Press, 2011
4. Gary B. Shelly and Harry J. Rosenblatt, Systems A
nalysis and Design 9th Edition, Course Technolog
y, 2011
5. Howard Podeswa, UML for the IT Business Analy
st 2nd Edition, Thomson Course Technology, 200

You might also like