• Ingen resultater fundet

02291: System Integration Week 9 Hubert Baumeister

N/A
N/A
Info
Hent
Protected

Academic year: 2022

Del "02291: System Integration Week 9 Hubert Baumeister"

Copied!
52
0
0

Indlæser.... (se fuldtekst nu)

Hele teksten

(1)

02291: System Integration

Week 9

Hubert Baumeister huba@dtu.dk

DTU Compute Technical University of Denmark

Spring 2018

(2)

Contents

Principles of Good Design Software Development Process Project Introduction

(3)

DRY principle

DRY principle Don’t repeat yourself

”Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.”

The Pragmatic Programmer, Andrew Hunt and David Thomas

I code

I documentation

I build stystem

(4)

Example: Code Duplication

(5)

Example: Code Duplication

Company n a m e c-address-street c-address-city printAddress

Address street c i t y printAddress

Company n a m e Person

n a m e cpr-number

works at

home address

address Person

n a m e cpr-number home-address-street home-address-city printAddress

works at

(6)

DRY principle

I Techniques to avoid duplication

I Use appropriate abstractions

I Delegation

I Inheritance

I Classes with instance variables

I Methods with parameters

I Refactor to remove duplication

I Generate artefacts from a common source. Eg. Javadoc

(7)

KISS principle

KISS principle

Keep it short and simple(sometimes also:Keep it simple, stupid)

I simplest solution first

I Striveforsimplicity

I Takes time!!

I refactor forsimplicity

Antoine de Saint Exup ´ery

”It seems that perfection is reached not when there is nothing left to add, but when there is nothing left to take away”.

(8)

YAGNI principle

YAGNI principle

You ain’t gonna needed it

I Focus on the task at hand

I E.g. using the observer pattern because itmightbe needed

→ Twodifferent kinds of flexibility

I make your design changeable

I tests, easy to refactor

I design for change

I Use good OO principles

I High cohesion, low coupling

I Decentralized control

→ Both are needed, but focus on the first before introducing not needed constructs for the second

(9)

Low Coupling

High coupling

A B

D E

C

F

Low coupling

A

B

D

E

C

F

(10)

Low Coupling

High coupling

A B

D E

C

F

Low coupling

A

B

D

E

C

F

(11)

High Cohesion

Low Cohesion

Person name cpr-number companyName work-address-street work-address-city home-address-street home-address-city

High Cohesion

Address street

city

Company name

Person name

cpr-number

works at

home address

address

(12)

High Cohesion

Low Cohesion

Person name cpr-number companyName work-address-street work-address-city home-address-street home-address-city

High Cohesion

Address street

city

Company name

Person name

cpr-number

works at

home address

address

(13)

Law of Demeter

Law of Demeter

I ”Only talk to your immediate friends”

I Only method calls to the following objects are allowed

I the object itself

I its components

I objects created by that object

I parameters of methods

I Law of Demeter =low coupling

→ delegate functionality

→ decentralised control

(14)

Computing the price of an order

Order calculate price calculate base price calculate discounts

Product name price

Customer name discount info

OrderLine quantity

*

1 1

(15)

Computing the price of an order

Order calculate price calculate base price calculate discounts

Product name price get price for quantity

Customer name discount info calculate discount

OrderLine quantity calculate price

*

1 1

(16)

Layered Architecture

Eric Evans, Domain Driven Design, Addison-Wesley, 2004

(17)

Example Vending Machine

Two different presentation layers

I Swing GUI

I Command line interface Current Money: DKK 5

0) Exit

1) Input 1 DKK 2) Input 2 DKK 3) Input 5 DKK 4) Select banana 5) Select apple 6) Cancel

Select a number (0-6): 5 Rest: DKK 2

Current Money: DKK 0 Dispensing: Apple

(18)

Architecture

«abstract»

Observable VendingMachineUI VendingMachineTextUI

«enumeration»

Fruit APPLE BANANA VendingMachine

dispensedItem : Fruit currentMoney : int totalMoney : int restMoney : int input(money : int) select(f : fruit) cancel() ...

Observable

Presentation Layer Presentation Layer

Application Layer

«delegate»

Observer

«delegate»

«delegate»

Observer

(19)

Contents

Principles of Good Design Software Development Process Project Introduction

(20)

Success rate for software projects 2000—2008

Sheet1

Page 1

2000 2002 2004 2006 2008

succeeded 28% 34% 29% 35% 32%

failed 23% 15% 18% 19% 24%

challenged 49% 51% 53% 46% 44%

2000 2002 2004 2006 2008

0%

20%

40%

60%

80%

100%

120%

challenged failed succeeded

CHAOS Summary 2009 Report

I Succeeded: 32%

I Failed: 20%

I Challenged: 48% (over time, over budget, lots of defects, low customer satisfaction. . . )

Failed or challenged

I Amanda

I Rejsekortet

I Obamacare Website

I German road toll system

I Denver airport baggage system

I . . .

(21)

Scaling software development

Small hut

I one person

I no special knowledge

Skyscraper

I not possible with one person

I special knowledge: static, electricity, water, waste, elevator, . . .

(22)

Types of software (Lehmann)

I s-type: mathematical function, sorting: complete specfication

I p-type: real world problems, e.g., chess: modelling the real world

I e-type: embeded into socio-technical systems.

Requirements change as the environment changes.

System changes the environment: e.g., operating system

I Continuing Change

I Increasing Complexity

I Conservation of Organisational Stability (invariant work rate)

I Continuing Growth

I Declining Quality

(23)

Activities in Software Development

I Understand anddocument what thecustomerwants:

Requirements Engineering

I How to build the software: Design

I Build the software: Implementation

I Validate:Testing,Verification,Evaluation

→ Waterfall

(24)

Waterfall process

I 1970: Winston W. Royce hownot to develop software

I 1985: Waterfall was required by the United States Department of Defence

(25)

Example: Empire State Steel Construction

From The Empire State Building by John Tauranac

From Building the Empire State by Willis, 1998

I Kept the budget I Was finishedbefore

deadline

I Built in21 month(from conception to finished building) (1931)

Basic design in 4 weeks

I Fast-trackconstruction

Begin the construction before the design is complete

create a flow

(26)

Delays in waterfall processes

D I T

A

Time Features

Release date

Implementation by layers and not functionality

(27)

Costs of changing requirements: Waterfall

I Changed / new requirements change the design and implementation

I Cost of change not predictable

Avoid changing/new requirements if possible

→ Good for s-type projects, not applicable to p-type and e-type projects

(28)

Iterative Processes: E.g. Rational Unified Process

(1996)

(29)

Agile Software Development Methods (1999)

I Extreme Programming (XP) (1999), Scrum (1995–2001), Lean Software Development (2003), . . .

I Kanban (2010): not a method;tool to improve processes

Functionality

Time

A DTI A DTI

R A DTI

R A DTI

R

A DTI R

A DTI

R

F 1 F 2 F 3a F 8 F 4 F 5 F 6

A DTIR

1. Iteration

Database / Infrastructure Layer Presentation Layer

Application Layer

Domain Layer

User Story

User Story User Story

I Highest priority user story first

I If delayed: important features are implemented

(30)

Problem in Software Engineering (Recap)

I Liggesmeyer 1998

(31)

Changing Requirements: Agile Methods

Scott Ambler 2003–2014http://www.agilemodeling.com/artifacts/userStory.htm

I Cost of change

I New / changed requirements not done yet: zero costs

I Changed requirements already done: the cost of a requirement that can not be implemented

(32)

Resource Triangle

Plan Driven

D I T

A

Time Features

Release date

Agile

Database / Infrastructure Layer Presentation Layer

Application Layer

Domain Layer

User Story

User Story User Story

(33)

eXtreme Programming (XP)

I Kent Beck 1999

I 12 Practices

Kent Beck, Extreme Programming 1st ed.

(34)

Scrum

Working increment of the software

Sprint Backlog Sprint

Product Backlog

30 days 24 h

file:///Users/huba/Desktop/Scrum_process.svg

1 of 1 /18.3.13 24:16

Wikipedia

I Robert Martin (Uncle Bob) about ”The Land that Scrum Forgot”

http://www.youtube.com/watch?v=hG4LH6P8Syk

History about agile methods, the agile manifesto, and Scrum and its relationshop to XP

(35)

Lean Software Development

I Lean Production:

I Value for the customer

I Reduce the amount ofwastein the production process

I Generateflow

I Waste: resources used which do not produce value for the customer

I time needed to fix bugs

I time to change the system because it does not fit the customers requirements

I time waiting for approval

I . . .

(36)

Generating flow using Pull and Kanban

WIP = Work in Progress Limit

1 3 2

4

A T I

Work Item D Done

Queue WIP Queue WIP Queue WIP Queue WIP

8 7

9 10 5

6

Blah Composite

Leaf4Assembly 2 3

3 3 3 3

(37)

Flow through Pull with Kanban

I Process controlling: local rules

I Load balancing: Kanban cards andWork in Progress (WIP) limits

I Integration in other processes

Figure from David Andersonwww.agilemanagement.net

(38)

Online Kanban Tool: Trello

I www.trello.com: Electronic Kanban board useful for your project

I Kanban board the exam project examplehttps:

//trello.com/b/CqzwTiRT/02291-example-lean

I Anotherhttps:

//trello.com/b/4wddd1zf/kanban-workflow

(39)

Process for the exam project

1. Create workflows

2. Create use case diagrams 3. Select 6 use cases

4. Determine basic (intended) architecture 5. Pair modelling: 2 people work together

→ https:

//trello.com/b/CqzwTiRT/02291-example-lean

I Meet often to coordinate the design

I Update your plan, use cases, detailed use cases, acceptance tests, etc. as needed

→ Important for grading: models have to be consistent with each other

6. Check the acceptance tests and use case realization for all use case scenarios

(40)

Important!

Report structure6=project structure

I Report structure: waterfall (by technique)

I Project structure: agile (by user case scenario)

(41)

Contents

Principles of Good Design Software Development Process Project Introduction

Description of the toll system Task

Organization

(42)

Exam Project: Model of a Toll System

I Report

I 45 min group presentation

A detailed project description can be found on CampusNet

(43)

Toll Lane

Toll Lane

Cash Register

Credit Card Reader Printer Single Ticket Reader

Toll Lane Computer Touchscreen

Bank

))) (((

Antenna

1) 1)

1)

1)

3) 2)

1) Only normal check-in lane 2) Only normal check-out lane

3) Only express lane (check-in and check-out)

Barrier

1,2,3)

1)

(44)

Toll Station

Toll Lane Toll Station

Toll Lane

Toll Lane

Toll Lane :

: Station Server Station Client

(45)

Enterprise

Toll Station Enterprise

Toll Station

Toll Station

Toll Station :

: Enterprise Server

Enterprise Client

Webserver

(46)

Functionality

I Check-in

I Express Lane withtoll tag

I Normal Lane using asingle ticket withcash / credit card

I Check-out

I Express Lane withtoll tag

I Normal Lane using aticket

I Buy Toll Tag

I Show Reports

I Change Rate

I Notify Customers

I Adminstration

(47)

Tasks

I Tasks

I Analyse the requirements

I Acceptance tests

I Design the system: Components, Interfaces, PSM’s, Classes, LSM’s, OCL constraints

I Use case realizations as sequence diagrams

I General remarks

I Abstract from any physical implementation, e.g. embedded system, communication protocol, . . .

I Abstract away from any concrete user interface representation: Application layer functionality

I Focus on the 6 use cases you have chosen

(48)

Evaluation Criteria

Evaluation Criteria

How well are the learning objectives in the course description accomplished by each participant.

I Danish law: Be able to evaluate everybody individually

I Two aspects:

a) to give a fair evaluation to each of you b) to be able to detect possible differences

→ For each section, diagram etc. name who did it (at most two names)

I Make sure that everybody did something of everything

I In the project presentation: Everybody should have

I read the project report

I be able to explain each part of the model

(49)

Evaluation Criteria (cont.)

I Correct use of UML diagrams and OCL constraints

I Understandability of the design

I Correct use case realizations that are consistent with the LSM’s, PSM’s, classes, interfaces, etc.

I Correct implementation of components

I Correct object life cycle state machine

I Appropriate abstraction level of the design

(50)

Organization

I Start: Today

I End: Wednesday 2.5

I Upload the reportas PDF and with the correct name on Campus Net using the assignment module

I Project presentations

I Mon 28.5—Tue 29.5

I 45 min: around 10 min slides presentation; rest is Q&A

I Teaching assistants and I are available for questions / clarifications

I More detailed specification of the problem is on CampusNet

I Lectures continue

I No specific exercises, but exercise session 8:15—10:00 will be kept for questions

(51)

Project: Rules on Cheating

Rules for Quoting (from Study Handbook Sect. 3.9)

”. . . The rules regarding citations and references to sources in written assignments are thatcitationsmust be indicated by quotation marksat the start and end of the citation and the source of the citationmust be referred to either in parentheses or in a note to the text. When not citing directly butbasing the discussionon a specific source, thesourcemust be referred to either in parenthesis or a note to the text. . . . ”

→ Usual rules for referencing sources:sources must be named

(52)

Course

I 2 more lectures

I Week 10: Model-driven architecture (MDA) and Agile modelling

I Week 11: Verification of models: Model checking

I Week 12: No lecture

I Week 13: No lecture

Referencer

RELATEREDE DOKUMENTER

I new velocity: story points of finished user stories per iteration. → What can be done in the

∗ Typical situation: Moving between User Cases, Sequence Diagrams / State Machines / Activity Diagrams, Class Diagrams, User Interface flow diagram, GUI mock ups. – Quality work –

→ Different software development processes: Waterfall, Iterative processes, agile,... Iterative

I Two classes: simple drawing tools and meta-model based modelling tools. I

– When the target class of an associations is not shown in the diagram – With datatypes / Value objects.. ∗ Datatypes consists of a set of values and set of operations on

Example Execution (Secret Panel Controller)... Example Execution (Secret

I Unified Modeling Language User Manual by Grady Boo, James Rumbaugh, and Ivar Jacobson, available

then create a table representing the association and create foreign keys in the new table referring to table A and to table B else