untuk sistem komputer kuliah 6: arsitektur perangkat...

27
Mohammad Iqbal Based-on slide Ivan Marsic Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunak Rekayasa Perangkat Lunak

Upload: dinhnhan

Post on 15-Mar-2019

237 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

Mohammad Iqbal Based-on slide Ivan Marsic

Untuk SISTEM KOMPUTER

Kuliah 6: Arsitektur Perangkat Lunak

Rekayasa Perangkat Lunak

Page 2: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

2

Topik

• Desain Arsitektur Perangkat Lunak

• Keputusan Arsitektural & Key Concerns

• Gaya Arsitektural

• Mendokumentasikan Arsitektur: View

• Struktur masalah vs. Struktur Solusi

Page 3: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

Hirarki Organisasi Software

• Software is not one long list of program statements but it has structure

• The above is a taxonomy of structural parts (abstraction hierarchy), but not representation of relationships between the parts and does not specify the function of each part

3

System or product

Subsystems/Modules

Packages

Classes/Objects

Methods

highest abstraction level

lowest level

Product line (or product family)

Source code

But first, why do we want to decompose systems?

The hierarchy shows a taxonomy of the system parts, but not the procedure for decomposing

the system into parts — how do we do it?

Page 4: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

4

Mengapa kita harus mendekomposisi Sistem

• Menangani kompleksitas dengan “divide-and-conquer”

• Perhatikan jika beberapa bagian telah ada dan dapat di gunakan kembali

• Fokus pada bagian kreatif dan hindari “reinventing the wheel”

• Mendukung fleksibilitas dan evolusi masa depan dengan memisahkan bagian yg tidak berhubungan, sehingga setiap bagian dapat berkembang (“pemisahan konsentrasi”)

• Membuat strategi berkelanjutan

Page 5: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

Defenisi Arsitektur Software

• Software Architecture = a set of high-level decisions that determine the structure of the solution (parts of system-to-be and their relationships) – Principal decisions made throughout the development and evolution

of a software system

– made early and affect large parts of the system (“design philosophy”) — such decisions are hard to modify later

• Decisions to use well-known solutions that are proven to work for similar problems

• Software Architecture is not a phase of development – Does not refer to a specific product of a particular phase of the

development process (labeled “high-level design” or “product design”)

5

Page 6: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

6

Contoh Keputusan Arsitektural

Subsystem

for device

control

Subsystem

for

administration

Subsystem

for remote

data access

On embedded

computer

On office

desktop

On tenant’s

smartphone

(…and Web?)

Safe Home Access System

Decision on mapping

software-to-hardware

Decision on system

decomposition

Such decisions are made early on,

perhaps while discussing the requirements with the customer

to decide which hardware devices will be used for user interaction and device control

Example decisions:

Decision on development

platform or operating system (Android vs. iOS, etc.)

Decision on how to fit

the subsystems together (“architectural style”)

Page 7: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

7

Architectural Decisions —A matter of scope

Product/system A scope Product B scope

Product line scope

Subsystem scope

product or system

architecture decisions

product line

architecture decisions

• Given the current level of system scope, a decision is “architectural” if it can be made only by considering the present scope – I.e. could not be made from a more narrowly-scoped, local perspective

– Architectural decisions should focus on high impact, high priority areas

that are in strong alignment with the business strategy

systemic impact

local impact Class scope

Page 8: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

8

Software Architecture Key Concerns

• System decomposition – how do we break the system up into pieces?

• what functionality/processing or behavior/control to include?

– do we have all the necessary pieces?

– do the pieces fit together? • how the pieces interact with each other and with the runtime environment

• Cross-cutting concerns – broad-scoped qualities or properties of the system

– tradeoffs among the qualities

• Conceptual integrity

• Software architecture provides a set of well-known solutions that are proven to work for similar problems

(Principal decisions to be made)

Page 9: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

9

Arsitektur VS Desain

• Architecture focuses on non-functional requirements (“cross-cutting concerns”) and decomposition of functional requirements

• Design focuses on implementing the functional requirements

– Note: The border is not always sharp!

Page 10: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

10

Architectural Decisions Often Involve Compromise

• The “best” design for a component considered in isolation may not be chosen when components considered together or within a broader context – Depends on what criteria are used to decide the “goodness”

of a design

– E.g., car components may be “best” for racing cars or “best” for luxury cars, but will not be best together

• Additional considerations include business priorities, available resources, core competences, target customers, competitors’ moves, technology trends, existing investments, backward compatibility, …

Page 11: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

11

How to Fit Subsystems Together: Some Well-Known Architectural Styles

• World Wide Web architectural style: REST (Representational State Transfer)

• UNIX shell script architectural style: Pipe-and-Filter

• Client/Server

• Central Repository (database)

• Layered (or Multi-Tiered)

• Peer-to-Peer

• Model-View-Controller

Development platform (e.g.,

Web vs. mobile app, etc.)

may dictate the architectural

style or vice versa…

Page 12: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

12

Gaya Arsitektural – Bagian Konstituen

1. Components – Processing elements that “do the work”

2. Connectors – Enable communication among components

• Broadcast Bus, Middleware-enabled, implicit (events), explicit (procedure

calls, ORBs, explicit communications bus) …

3. Interfaces – Connection points on components and connectors

• define where data may flow in and out of the components/connectors

4. Configurations – Arrangements of components and connectors that form an

architecture

Page 13: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

13

Gaya Arsitektural : Pipe-dan-Filter

• Components: Filters transform input into output

• Connectors: Pipe data streams

• Example: UNIX shell commands

filter filter filter pipe pipe

% ls folder-name | grep –v match-string | more

Page 14: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

Gaya Arsitektural : Client/Server

• A client is a triggering process; a server is a reactive process. Clients make requests that trigger reactions from servers.

• A server component, offering a set of services, listens for requests upon those services. A server waits for requests to be made and then reacts to them.

• A client component, desiring that a service be performed, sends a request at times of its choosing to the server via a connector.

• The server either rejects or performs the request and sends a response back to the client

14

Page 15: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

Gaya Arsitektural : Layered

• A layered system is organized hierarchically, each layer providing services to the layer above it and using services of the layer below it

• Layered systems reduce coupling across multiple layers by hiding the inner layers from all except the adjacent outer layer, thus improving evolvability and reusability

15

User

Interface Layer

User Interaction User Authentication

Control of

Sensors and Devices

Archiving

Communicating alerts

about intrusion

Domain Logic Layer

(Business Rules)

Technical Services

Layer

a.k.a. Tiered Software Architecture

Page 16: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

16

Gaya Arsitektural : Model-View-Controller Model: holds all the data, state and application logic.

Oblivious to the View and Controller. Provides API to retrieve state and send notifications of state changes to “observer”

View: gives user a presentation of the Model. Gets data directly from the Model

Controller: Takes user input and figures out what it means to the Model

user

input device

display

View

Controller

Model

5. I need your state (to display)

1. The user did something

2. Change your state

3. Change your display

4. I have changed

Page 17: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

17

Model-View-Controller

Controller

View

Input

device events

Event

Interpreter

Domain

model action

Domain

Model

Model

Visualizer

Notification

about the effects of the

action

Visual feedback

of the altered model

User

User Interface

Model

14

26

31 14

26 31

versus Model: array of numbers [ 14, 26, 31 ]

Different Views for the same Model:

Page 18: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

REST: Representational state transfer

18

Client Server

User interface Data storage

Web resources

Stateless: no memory about past requests by

a given client

Session state: memory about

past and current

requests

Request (e.g., HTTP) contains

all the information

describing the desired resource

or service, identified by URI Intermediary

Response caching

Web resource: Identified using URI;

Arbitrary representation

internal to server

Response: representation of

resource in standard

text format (HTML, XML, JSON, …);

includes hyperlinks to other Web resources

user

… text text text link text text …

… text text text text link text …

… text link text text text text …

Web resource

Web resource

Web resource

Application state

Application state

Application state State transition

(HTTP operation)

State transition (HTTP operation)

Web application: A network of Web resources (a virtual state-machine), where the user by following the links

requests the transfer of next resource (“state”).

Conceptual model: hypermedia as the engine of application state

Physical model

Page 19: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

19

Subsystem

for device

control

Subsystem for

administration

Subsystem

for remote

data access

Application

server

Web

browser Web server

- Valid keys

- Access history

- Tenant profiles

- …

Central Repository

Architectural Style

Real System is a Combination of Styles

Tiered Architectural Style

Page 20: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

20

Menyatukan semua Bagian

• Specifying semantics of component interfaces – Serves as a contract between component providers

and clients, interfaces must be

• fully documented

• semantics, not just syntax

• understandable, unambiguous, precise

• Adding semantics – informal description

– design models (e.g., UML interaction diagrams)

– pre/post conditions

Page 21: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

21

Dokumentasi Arsitektur Software : Architecture Views

• Views are different kinds of “blueprints” created for the system-to-be

• E.g., blueprints for buildings: construction, plumbing, electric

wiring , heating, air conditioning, …

(Different stakeholders have different information needs)

1. Module/Subsystem Views

2. Component and Connector Views

3. Allocation Views

Page 22: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

22

Module/Subsystem Views

• Decomposition View – Top-down refinement (e.g., simple “block diagram”)

• Dependency View – How parts relate to one another

• Layered View – Special case of dependency view

• Class View – “domain model” in OOA and “class diagram” in OOD

Page 23: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

23

Component and Connector Views

• Process View – Defined sequence of activities?

System represented as a series of communicating processes

• Concurrency View

• Shared Data View – …

• Client/Server View – E.g., in Web browsing

Page 24: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

24

Allocation Views

• Deployment View – Software-to-hardware assignment

• Implementation View – File/folder structure – “package diagram”

• Work Assignment View – Work distribution within the development team

Page 25: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

25

Problem Structure

Subsystems derived from the requirements (“bottom-up” approach or induction)

Page 26: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

26

Typical Software Eng. Problems 1. User works with computer system

(problem domain is “virtual”, not physical)

2. Computer system controls the (physical) problem domain

(user not involved)

3. Computer system intermediates between

the user and the problem domain

User

User System Problem domain

User Repository

User System Problem domain

User System Problem domain

IN doc

1.a) System transforms input document to output document

1.b) User edits information stored in a repository

3.a) System observes the problem domain and displays information

3.b) System controls the problem domain as commanded by the user

REQ-2: Allow repository editing, where

“repository” is a collection of data

REQ-3: Autonomously control

a physical object/device

REQ-5: Monitor and display

information about an object

REQ-4: Interactively control

a physical object/device

System Problem domain

REQ-1: Map input data to output

data as said by given rules

User System Problem domain

System

OUT doc User System

Page 27: Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat Lunakmohiqbal.staff.gunadarma.ac.id/Downloads/files/60919/mohiqbal+lec... · Untuk SISTEM KOMPUTER Kuliah 6: Arsitektur Perangkat

27

Controlling

subsystem

Controlled

subsystem 3.b) Commanded behavior:

Operator

Monitoring

subsystem

Monitored

subsystem 3.a) Information display:

Display

Software (i.e., Solution) Structure

2. Required behavior: Controlling

subsystem

Controlled

subsystem

Feeding

subsystem

Transformation

subsystem

Receiving

subsystem 1.a) Transformation:

Data

editor

Data repository

1.b) Simple editing:

User

SYSTEM

SYSTEM

SYSTEM

SYSTEM

SYSTEM

REQ-1: Map input data to output data as said by given rules

REQ-2: Allow repository editing, w here “repository” is a collection of data

REQ-3: Automatically control a physical object/device

REQ-5: Monitor and display information about an object

REQ-4: Interactively control a physical object/device