software engineering i (02161)
TRANSCRIPT
Software Engineering I (02161)Week 7
Assoc. Prof. Hubert Baumeister
DTU ComputeTechnical University of Denmark
Spring 2013
Contents
Layered Architecture: Persistence Layer
Software Development Process
Project planning
Exam Project Planning
Layered Architecture: Persistency Layer for the libraryapplication
Persistency Layer
Presentation Layer
Application/Domain Layer
LibraryUI
LibraryAppMedium
UserBook Cd
PersistentObject
PersistencyLayer
Address
I Data stored in two files users.txt& media.txt; address has no file
I A bookdtu.library.app.Bookb01some book authorsome book titleMar 13, 2011<empty line>
I A userdtu.library.app.Usercpr-numberSome [email protected]<empty line>
Persistency Layer
LibraryApp
PersistencyLayer...clearDatabase()createMedium(m:Medium)createUser(u:User)readMedium(sig:String):MediumreadUser(cpr:String):UserupdateMedium(m:Medium)updateUser(m:User)deleteMedium(sig:String)deleteUser(cpr:String)getUsers(): List<User>getMedia(): List<Medium>...
1
User......getKey():StringstoreOn(out:PrintWriter)readFromReader(r:Buff.Read. ol:PersistencyLayer)
PersistentObject
storeOn(out:PrintWriter)getKey():String
key:String0..1cache_users
key:String0..1cache_media
Medium......getKey():StringstoreOn(out:PrintWriter)readFromReader(r:Buff.Read. ol:PersistencyLayer)
{ return getSignature();}
{ return getCprNumber();}
*borrowedMedia
Layered Architecture: Persistency Layer for the libraryapplication
PersistencyLayercache_userscahce_mediumclearDatabase()createMedium(m:Medium)createUser(u:User)readMedium(sig:String):MediumreadUser(cpr:String):UserupdateMedium(m:Medium)updateUser(m:User)deleteMedium(sig:String)deleteUser(cpr:String)getUsers(): List<User>getMedia(): List<Medium>...
I CRUD: Create, Read, Update, Delete
I clearDatabase
I removes the text files tocreate an emptydatabase
I Used with tests in@Before methods:Independent tests
Issues: Object identity
PersistencyLayer pl = new PersistencyLayer();User user1 = pl.readUser("12345");User user2 = pl.readUser("12345");assertNotSame(user1,user2) // ?assertSame(user1,user2) // ?
Solution: Qualified Associations / Maps
Map<String,PersitentObject> cacheUsers =new HashMap()<String,PersistentObject>
Map<String,PersitentObject> cacheMedia =new HashMap()<String,PersistentObject>
UML Notation
PersistencyLayer......
PersistentObject
storeOn(out:PrintWriter)getKey():String
key:String0..1cache_users
key:String0..1cache_media
public User readUser(String key) {if (cacheUsers.contains(key)) { return cacheUsers.get(key); }User user = readObjectFromFile(String key);if (user != null) { cacheUsers.put(key,user); }return user;
}
Map<K,V> Interface
I Dictionary (table): keys of type K , values of type VI Implementation class: HashMap<K,V>I Operations
I m.put(aK,aV)I m.get(aK)I m.containsKey(aK)
I Propertiesm.put(aK,aV);assertTrue(m.containsKey(aK));assertSame(aV,m.get(aK));
assertFalse(m.containsKey(aK));assertNull(m.get(aK));
Exercise tasks:
1) Implement the persistency layer (tests provided)2) Intergrate persistentcy layer in the library application (tests
have to be written)I Additional informationhttp://www2.imm.dtu.dk/courses/02161/2013/slides/pe_persistency.pdf
Contents
Layered Architecture: Persistence Layer
Software Development Process
Project planning
Exam Project Planning
Software Development Challenges
I Challenges of Software DevelopmentI On timeI In budgetI No defectsI Customer satisfaction
Software Development Process
I Activities in Software DevelopmentI Understand and document what the customer wants:
Requirements EngineeringI How to build the software: DesignI Build the software: ImplementationI Validate: Testing, Verification, Evaluation
→ Set of techniques: Use cases, CRC cards, refactoring,test-driven development, . . .
I How to apply the techniques:→ Different software development processes: Waterfall,
Iterative processes, agile, lean, . . .
Agile processes and Lean Software Development
Functionality
TimeAD IT
AD ITR
AD ITR
F 1
F 2
F 3
F 4
F 5
F 6
F 7
1. Iteration
Agile processes and Lean Software Development
1. Iteration
Functionality
TimeAD IT
AD ITR
AD ITR
AD IT
R
F 1
F 2
F 3
F 8
F 4
F 5
F 6
Agile processes and Lean Software Development
Functionality
TimeAD IT
AD ITR
AD ITR
AD IT
R
AD IT
R
AD IT
R
F 1
F 2
F 3a
F 8
F 4
F 5
F 6
RAD IT
1. Iteration
Agile Processes and Lean Software Development
I Agile processes: eXtreme Programming (XP), Scrum,Feature Driven Development (FDD), Lean SoftwareDevelopment
I Common characteristicsI Short iterationsI Focus on marketable features (Lean/Kanban) / user stories
(XP) / product backlog items (Scrum)I New, extreme practicesI Applying values and principles from Lean Production
User stories
I Introduced with Extreme ProgrammingI Focus on features
I ”As a customer, I want to book and plan a single flight fromCopenhagen to Paris”.
I Recommended, but not exclusive: ”As a <role>, I want<goal/desire> so that <benefit>”
I Difference to Use Cases: User stories can be defined fornon-functional requirements
I ”The search for a flight from Copenhagen to Paris shall takeless than 5 seconds”
I Documented by user story cards, i.e. index cards
Example of a User story card
Kent Beck, Extreme Programming, 1st ed.
I User story card: A contract between the customer and thedevloper to talk about the user story
User stories and requirements engineering
I Requirements engineering is done in parallel with thedevelopment of the system
I Requirements engineeringI Epics
→ coarse level user storiesI User story cards
→ not too much detailsI User stories are assigned to iterations→ priority for the customer
I In an iterationI refine user stories→ provide detail
→ Compare with waterfallI Requirement phase: as detailed as possible
Comparision: User Stories / Use Cases
Use StoryI one concrete
scenario/featureI concrete data
I requirements of relevancefor the user
I functiional: e.g. usecase scenario
I non-functional
Use CasesI several abstract scenarios
with one goalI only functional
requirements
Scrum
Working incrementof the software
Sprint Backlog SprintProduct Backlog
30 days
24 h
file:///Users/huba/Desktop/Scrum_process.svg
1 of 1 /18.3.13 24:16
Wikipedia
Lean Software Development
I Lean Production:I Reduce the amount of wasteI Generate flow
I Waste: resources used with does not produce value for thecustomer
I time needed to fix bugsI time to change the system because it does not fit the
customers requirementsI time waiting for approvalI . . .
Cycle timeI Increase feedback: Reduce time it takes to go through the
process: cycle time
Cycle time
cycle time =number of features
feature implemantion rate
Software: 250 features, 50 weeks, feature implementation rate= 5 features/week
I Waterfall: cycle time = 250 / 5 = 50 weeks→ 1 cycle
Reducing the cycle timeI Agile: cycle time = 1 / 5 = 8 hours→ 250 cycles→ Process improvement: incease in features / week
Cycle timeI Increase feedback: Reduce time it takes to go through the
process: cycle time
Cycle time
cycle time =number of features
feature implemantion rate
Software: 250 features, 50 weeks, feature implementation rate= 5 features/week
I Waterfall: cycle time = 250 / 5 = 50 weeks→ 1 cycle
Reducing the cycle timeI Agile: cycle time = 1 / 5 = 8 hours→ 250 cycles→ Process improvement: incease in features / week
Generating flow using Pull and Kanban
A I TWork Item DoneDQueue WIP Queue QueueQueue WIP WIP WIP
Login1Composite
Leaf Assembly3Blah5
13245
A T I DComposite
Leaf Assembly1
1
1
Login3
3
Composite
Leaf Assembly2Login4
Login2
Software Engineering: Flow through Pull with Kanban
I Process controlling: local rulesI Load balancing: Kanban cards and Work in Progress
(WIP) limitsI Integration in other processes: e.g. Scrum + Kanban =
ScrumbanI www.targetprocess.com: Electronic kanban board
usefull for your projectFigure from David Anderson www.agilemanagement.net
Contents
Layered Architecture: Persistence Layer
Software Development Process
Project planningIntroductionClassical DevelopmentProject estimation techniquesAgile Planning
Exam Project Planning
Project Planning
I Project planI Defines:
I How work is doneI Estimate
I Duration of workI Needed resources→ Price
I Project planningI Proposal stage
→ Price→ Time to finish
I Project start-upI During the project
I Progress (tracking)I Adapt to changes
Processes
I Waterfall
I milestones/deliverables: systemspecification, designspecification, . . .
I Typical tasks: Work focused onsystem components
I Iterative Development (e.g. RUP)
I Milestones/deliverables: Eachphase: go ahead to next phase
I Typical tasks: Work focused onsystem components
Project estimation techniques
I Experienced basedI XP: story pointsI Comparision with similar tasks
I Algorithmic basedI e.g. COCOMO, COCOMO II, . . .
Algorithmic cost modeling: COCOMO
I Constructive Cost Model (COCOMO) by Bary Boehm etal., 1981
I based on empirical studiesI Effort: in person months: PM = a ∗ LOCb
I Lines of code (LOC)I 2.4 ≤ a ≤ 3.6: type of softwareI 1 ≤ b ≤ 1.5: cost drivers: platform difficulty, team
experience, . . .I Project duration: TDEV = 3 ∗ PM0.33+0.2∗(b−1.01)
I Staffing: STAFF = PM/TDEV
Planning Agile Projects
I fixed general structure→ quarterly cycle / weekly cycle practices in XP
...
1w−4w 1w−4w (but fixed)
Release 1
3m−6m
...
Iteration 1Pl. Pl. Iteration nPlanning
ReleasePl.
Release m
...Iteration 1 Pl. Iteration nPlanning
Release
I Releases (quarterly cycle)I make (business) senseI user stories / themes
I Iterations with releasees (weekly cycle)I user stories
I time boxingI fixed: release dates and iterationsI adjustable: scope
Planning game
I Customer defines:I user storiesI priorities
I Developer define:I costs, risksI suggest user stories
I Customer decides: is the user story worth its costs?→ split a user story→ change a user story
Project estimation and monitoring
I Estimation: two possibilities1) Estimate ideal time (e.g. person days / week) + load factor2) Estimate relative to other user stories: story points
I Monitoringad 1) New load factor : total iteration time / user story time
finishedad 2) velocity : Number of points per iteration
→ What can be done in the next iteration (yesterdaysweather)
I Important: If in trouble focus on few stories and finish them
Contents
Layered Architecture: Persistence Layer
Software Development Process
Project planning
Exam Project Planning
Process to be used for the exam project
1. Create a use case diagram2. Select the most important use case scenarios and define
user stories for them3. Determine a basic architecture5. Create a project plan5. Repeat:
I 2 people take a user story/task due (highest priority first)a) detail use case scenariob) acceptance testsc) (contribution to systematic tests)d) CRC cards for the designe) report any design issues in the reportf) test-driven implementation of the scenariog) (create sequence diagram for the scenario)
I Meet often to coordinate the designI Don’t forget to update your plan as you learn
6. Collect the material you have written and finish the report
Example Plan
I Remark: report structure 6= project structureI Report structure: waterfall (by technique)I Project structure: agile (by user story)
Project plan for a MUD game
number of persons hours a week per person hours a week no. of weeks
4 8 32 5 160
User Story/Tasks Ideal man hour Total hours in week Total hours
Week 1 Creating the base structure of the report 1 2 2 2
Player starts game 2 4 6 6
Player looks into a room 2 4 10 10
Player moves to adjacent room 2 4 14 14
Writing about the use cases 2 4 18 18
Player advances to next level 2 4 22 22
Player finishes game 2 4 26 26
Player takes up object 2 4 30 30
Syst. tests for the use cases in this iteration 2 4 34 34
Week 2 Players lays down object 2 4 6 38
Player registers successful for the game 2 4 10 42
Player registers, but name is already used 2 4 14 46
Writing the introduction 2 4 18 50
Writing about the design 2 4 22 54
Syst. tests for the use cases in this iteration 2 4 26 58
… … … … …
hours for the whole project
man hour with load factor