Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software...

51
Agile Software Agile Software Development Development Methodologies and XP Methodologies and XP Svetlin Nakov Svetlin Nakov National Academy for National Academy for Software Development Software Development

Transcript of Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software...

Page 1: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Agile Software Development Agile Software Development Methodologies and XPMethodologies and XP

Svetlin NakovSvetlin NakovNational Academy for National Academy for

Software DevelopmentSoftware Development

Page 2: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

About MeAbout Me

• Svetlin NakovSvetlin Nakov

• Director training and consulting Director training and consulting activities, National Academy for activities, National Academy for Software Development (NASD)Software Development (NASD)

• 15 15 years of developer experienceyears of developer experience• 8 8 year as a professional software year as a professional software

engineer, trainer and consultantengineer, trainer and consultant

• Author of 4 books, 20 articles, Author of 4 books, 20 articles, and 50 seminar lecturesand 50 seminar lectures

• Lecturer in Sofia University, NBULecturer in Sofia University, NBU

Page 3: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

AgendaAgenda

• Development MethodologiesDevelopment Methodologies

• Agile DevelopmentAgile Development

• Extreme Programming (XP)Extreme Programming (XP)

• How It Works for Me?How It Works for Me?

• Develop Your Own MethodologyDevelop Your Own Methodology

Page 4: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Development Development MethodologiesMethodologies

Page 5: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

What is a Methodology?What is a Methodology?

• A A methodologymethodology is a formalized process is a formalized process or set of practices for creating softwareor set of practices for creating software

• A set of rules you have to followA set of rules you have to follow

• A set of conventions the organization A set of conventions the organization decides to followdecides to follow

• A systematical, engineering approach A systematical, engineering approach for organizing software projectsfor organizing software projects

Page 6: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

The Waterfall The Waterfall Development ProcessDevelopment Process

Page 7: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

The Waterfall ProcessThe Waterfall Process

• The traditional development process:The traditional development process:

SystemRequirements

SoftwareRequirements

Analysis

ProgramDesign

Coding

Testing

Operations

• Or at worst …Or at worst …

• But this always ends up happening!But this always ends up happening!

[Royce, 1970][Royce, 1970]

Page 8: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

SystemRequirements

Formal ProcessesFormal Processes

• Formal efforts to “fix” the problemFormal efforts to “fix” the problem

SoftwareRequirements

Analysis

Coding

Testing

Operations

PreliminaryDesign

Analysis

ProgramDesign Coding

Testing

Usage

PreliminaryDesign

Document

UI Design Document

TestPlan

FinalDesign

PreliminaryDesignSoftware

RequirementsSpecification

Prelim.Revie

w

ProgramDesign

DesignRevie

w

OperatingInstructions

Page 9: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Agile DevelopmentAgile Development

Page 10: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Agile ManifestoAgile Manifesto

““Our highest priority is to satisfy the Our highest priority is to satisfy the

customer through early and continuouscustomer through early and continuous

delivery of valuable software“delivery of valuable software“

[Manifesto for Agile][Manifesto for Agile]

Page 11: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

• IncrementalIncremental• Working softwareWorking software over comprehensive over comprehensive

documentationdocumentation

• CooperationCooperation• Customer collaborationCustomer collaboration over contract over contract

negotiationnegotiation

• StraightforwardStraightforward• Individuals and interactionsIndividuals and interactions over processes over processes

and toolsand tools

• AdaptiveAdaptive• Responding to changeResponding to change over following a plan over following a plan

The Agile SpiritThe Agile Spirit

Page 12: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Agile MethodologiesAgile Methodologies

• eXtreme Programming (XP)eXtreme Programming (XP)

• ScrumScrum

• Crystal family of methodologiesCrystal family of methodologies

• Feature-Driven Development (FDD)Feature-Driven Development (FDD)

• Adaptive Software Development (ASD)Adaptive Software Development (ASD)

• Dynamic System Development Model Dynamic System Development Model (DSDM)(DSDM)

• Agile Unified Process (AUP)Agile Unified Process (AUP)

Page 13: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

eXtreme eXtreme ProgrammingProgramming

Page 14: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

The XP Guru: Kent The XP Guru: Kent BeckBeck

• eeXXtreme treme PProgrammingrogramming

• The most prominent agile development The most prominent agile development methodologymethodology

Kent Beck

1st ed. Oct 1999

2nd ed. Nov 2004

Page 15: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

The 12 Key PracticesThe 12 Key Practices

• The Planning GameThe Planning Game• Small ReleasesSmall Releases• MetaphorMetaphor• Simple DesignSimple Design• Test-Driven DevelopmentTest-Driven Development• RefactoringRefactoring• Pair ProgrammingPair Programming• Collective OwnershipCollective Ownership• Continuous IntegrationContinuous Integration• 40-Hour Workweek40-Hour Workweek• On-site CustomerOn-site Customer• Coding StandardsCoding Standards

Page 16: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

1. Metaphor1. Metaphor

• Guide all development and conversations Guide all development and conversations with a simple shared story of how the with a simple shared story of how the whole system works whole system works

• Gives the team a whole picture of Gives the team a whole picture of describing the system, where new parts describing the system, where new parts fit, etc.fit, etc.

• Words used to identify technical entities Words used to identify technical entities should be chosen from the metaphorshould be chosen from the metaphor

• The default metaphor is the business The default metaphor is the business domain, and it’s usually just finedomain, and it’s usually just fine

Page 17: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Metaphors are good ideaMetaphors are good idea

• People should know the business needs People should know the business needs and how their work fits in the projectand how their work fits in the project

Page 18: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

2. Release Planning2. Release Planning

• Requirements via Requirements via User StoriesUser Stories

• Short cards with natural language Short cards with natural language description of what a customer wantsdescription of what a customer wants

• Prioritized by customerPrioritized by customer

• Resource and risk estimated by Resource and risk estimated by developersdevelopers

• Via “The Planning Game”Via “The Planning Game”

• Play the Planning Game after each Play the Planning Game after each incrementincrement

Page 19: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

User StoriesUser Stories

Page 20: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Requirements specification (SRS) is Requirements specification (SRS) is better than user storiesbetter than user stories

• Written documentation works well for Written documentation works well for large projectslarge projects

• I prefer prototyping the user interface as I prefer prototyping the user interface as source of documentationsource of documentation

• Sometimes its is hard to estimate the Sometimes its is hard to estimate the required resourcesrequired resources

• Small releases have less riskSmall releases have less risk

Page 21: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

3. Testing3. Testing

• Test-Driven Development (TDD)Test-Driven Development (TDD)• Write tests before codeWrite tests before code

• Tests are automatedTests are automated

• Often use xUnit frameworkOften use xUnit framework

• Must run at 100% before proceedingMust run at 100% before proceeding

• Acceptance TestsAcceptance Tests• Written with the customerWritten with the customer

• Acts as “contract”Acts as “contract”

• Measure of progressMeasure of progress

Page 22: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Test-Driven Test-Driven DevelopmentDevelopment

• Developers write unit tests before Developers write unit tests before codingcoding

• Motivates codingMotivates coding

• Improves design: cohesion and Improves design: cohesion and coupling coupling

• Provides regression testsProvides regression tests

• Provides specification by exampleProvides specification by example

public void public void TTestMultiplication() {estMultiplication() { Dollar five = Money.dollar(5);Dollar five = Money.dollar(5); AssertEqual(new Dollar(10), five.times(2));AssertEqual(new Dollar(10), five.times(2)); AssertEqual(new Dollar(15), five.times(3));AssertEqual(new Dollar(15), five.times(3));}}

Page 23: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• TDD is good for most projects, not for allTDD is good for most projects, not for all

• The real world is different: you always The real world is different: you always need the functionality "for tomorrow"!need the functionality "for tomorrow"!

• I use unit testing for complex logic onlyI use unit testing for complex logic only

• Testing simple logic is overheadTesting simple logic is overhead

Page 24: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

4. Pair Programming4. Pair Programming

• Two software engineers work on one Two software engineers work on one task at one computertask at one computer

• The driverThe driver has control of the keyboard and has control of the keyboard and mouse and creates the implementationmouse and creates the implementation

• The navigator The navigator watches the driver’s watches the driver’s implementationimplementation

• Identifies defects and participates in on-Identifies defects and participates in on-demand brainstormingdemand brainstorming

• The roles of driver and observer are The roles of driver and observer are periodically rotatedperiodically rotated

Page 25: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Pair ProgrammingPair Programming

• Pairs produce higher quality codePairs produce higher quality code

• Pairs complete their tasks fasterPairs complete their tasks faster

• Pairs enjoy their work morePairs enjoy their work more

• Pairs feel more confident in their work Pairs feel more confident in their work productsproducts

Page 26: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Pair programming is great for complex Pair programming is great for complex and critical logicand critical logic

• When developers need good When developers need good concentrationconcentration

• Where quality is really importantWhere quality is really important

• Especially during designEspecially during design

• Reduces time wasting, e.g. ICQ chattingReduces time wasting, e.g. ICQ chatting

• Trivial tasks can be done aloneTrivial tasks can be done alone

• Peer reviews instead pair programming is Peer reviews instead pair programming is often alternativeoften alternative

Page 27: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

5. Refactoring5. Refactoring

• Improve the design of existing code Improve the design of existing code without changing its functionalitywithout changing its functionality• Relies on unit testing to ensure the code Relies on unit testing to ensure the code

is not brokenis not broken

• Bad smells in code:Bad smells in code:• Long method / classLong method / class• Duplicate codeDuplicate code• Methods does several different things Methods does several different things

(cohesion)(cohesion)• Too much dependencies (coupling)Too much dependencies (coupling)• Complex / unreadable codeComplex / unreadable code

Page 28: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Delivering working software faster is Delivering working software faster is important!important!

• You can write the code to run somehowYou can write the code to run somehow

• With simple designWith simple design

• With less effortWith less effort

• Later you can refactor the code if Later you can refactor the code if necessarynecessary

• Refactoring is not a reason to Refactoring is not a reason to intentionally write bad code!intentionally write bad code!

• Good coding style is always important!Good coding style is always important!

Page 29: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

6. Simple Design6. Simple Design

• No Big Design Up Front (BDUF)No Big Design Up Front (BDUF)

• Reduces the overheadReduces the overhead

• Ship working functionality faster and Ship working functionality faster and get feedback earlyget feedback early

• ““Do The Simplest Thing That Could Do The Simplest Thing That Could Possibly Work”Possibly Work”

• Later use refactoring to change itLater use refactoring to change it

• Not too much formal documentationNot too much formal documentation

Page 30: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Simple design does not mean "no Simple design does not mean "no design"design"

• It is about establishing prioritiesIt is about establishing priorities

• It's a set of tradeoffs you makeIt's a set of tradeoffs you make

• If something is important for this If something is important for this release and for the whole system, it release and for the whole system, it should be designed wellshould be designed well

• Don't lose time to design something Don't lose time to design something you will not use soon!you will not use soon!

Page 31: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

7. Collective Code 7. Collective Code OwnershipOwnership

• Code to belongs to the project, not to an Code to belongs to the project, not to an individual engineer!individual engineer!

• Any engineer can modify any codeAny engineer can modify any code

• Better quality of the codeBetter quality of the code

• Engineers are not required to work Engineers are not required to work around deficiencies in code they do not around deficiencies in code they do not ownown

• Faster progressFaster progress

• No need to wait for someone else to fix No need to wait for someone else to fix somethingsomething

Page 32: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Collective Code Collective Code Ownership?Ownership?

Page 33: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Collective code ownership is Collective code ownership is absolutely indispensableabsolutely indispensable

• You need to fight the people who don't You need to fight the people who don't agree with this!agree with this!

• Fire people writing unreadable and Fire people writing unreadable and unmaintainable codeunmaintainable code

• Don't allow somebody to own some Don't allow somebody to own some module and be irreplaceablemodule and be irreplaceable

Page 34: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

8. Continuous 8. Continuous IntegrationIntegration

• Pair writes up unit test cases and code Pair writes up unit test cases and code for a task (part of a user story)for a task (part of a user story)

• Pair unit tests code to 100%Pair unit tests code to 100%

• Pair integratesPair integrates

• Pair runs ALL unit test cases to 100%Pair runs ALL unit test cases to 100%

• Pair moves on to next task with clean Pair moves on to next task with clean slate and clear mindslate and clear mind

• Should happen once or twice a dayShould happen once or twice a day

Page 35: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Integrating often is really valuableIntegrating often is really valuable

• Sometimes you cannot finish a task for Sometimes you cannot finish a task for one day and integrate itone day and integrate it

• For small projects with small teams For small projects with small teams integration is not an issueintegration is not an issue

• For large and complex projects it's For large and complex projects it's crucialcrucial

• Think of automated build environmentThink of automated build environment

Page 36: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

9. On-Site Customer9. On-Site Customer

• Customer available on siteCustomer available on site

• Clarify user storiesClarify user stories

• Make critical business decisionsMake critical business decisions

• Developers don’t make assumptionsDevelopers don’t make assumptions

• Developers don’t have to wait for Developers don’t have to wait for decisionsdecisions

• Face to face communication minimizes Face to face communication minimizes the chances of misunderstandingthe chances of misunderstanding

Page 37: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• On-site customer actually does not On-site customer actually does not work!work!

• Customers are busyCustomers are busy

• Meetings every day is working betterMeetings every day is working better

• Customers are not competent!Customers are not competent!

• Customers always say "Yes, this is Customers always say "Yes, this is what I want"what I want"

• You need to think instead of themYou need to think instead of them

• Use prototypingUse prototyping

Page 38: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

10. Small Releases10. Small Releases

• TimeboxedTimeboxed

• As small as possible, but still As small as possible, but still delivering business valuedelivering business value

• No releases to ‘implement the database’No releases to ‘implement the database’

• Get customer feedback early and oftenGet customer feedback early and often

• Do the planning game after each Do the planning game after each iterationiteration

• Do they want something different?Do they want something different?

• Have their priorities changed?Have their priorities changed?

Page 39: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Small releases are really valuableSmall releases are really valuable

• Manage the risk of delivering something Manage the risk of delivering something wrongwrong

• Helps the customer to define better the Helps the customer to define better the requirementsrequirements

• Release every few weeksRelease every few weeks

• Large projects are not so flexibleLarge projects are not so flexible

• Try to release something, even you Try to release something, even you know that it will be changedknow that it will be changed

Page 40: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

11. Forty-Hour Work 11. Forty-Hour Work WeekWeek

• Kent Beck says, “ . . . fresh and eager Kent Beck says, “ . . . fresh and eager every morning, and tired and satisfied every morning, and tired and satisfied every night”every night”

• Burning the midnight oil kills Burning the midnight oil kills performanceperformance

• Tired developers make more mistakesTired developers make more mistakes

• Slows you down more in the long runSlows you down more in the long run

• If you mess with people’s personal If you mess with people’s personal lives (by taking it over), in the long run lives (by taking it over), in the long run the project will pay the consequencesthe project will pay the consequences

Page 41: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• 40 hours a week or 40 hours without a 40 hours a week or 40 hours without a sleep?sleep?

• Come back to the real world!Come back to the real world!

• Overtime is not recommendable but Overtime is not recommendable but often can not be avoidedoften can not be avoided

• Better planning can helpBetter planning can help

• Highly skilled senior engineers always Highly skilled senior engineers always suffer of overtime and high pressuresuffer of overtime and high pressure

• That's how the business works!That's how the business works!

Page 42: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

12. Coding Standards12. Coding Standards

• Use coding conventionsUse coding conventions

• Rules for naming, formatting, etc.Rules for naming, formatting, etc.

• Write readable and maintainable codeWrite readable and maintainable code

• Method commentingMethod commenting

• Self-documenting codeSelf-documenting code

• Don't comment bad code, rewrite it!Don't comment bad code, rewrite it!

• Refactor to improve the designRefactor to improve the design

• Use code audit tools (FxCop, TFS)Use code audit tools (FxCop, TFS)

Page 43: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How It Works for Me?How It Works for Me?

• Coding standards are importantCoding standards are important

• Enforce good practices to whole the Enforce good practices to whole the team – tools, code reviews, etc.team – tools, code reviews, etc.

• Standards should be simpleStandards should be simple

• Complex standards are not followedComplex standards are not followed

• Standards should be more strict for Standards should be more strict for larger teamslarger teams

• Developers don't like utter rules like Developers don't like utter rules like ""comment any class membercomment any class member""

Page 44: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

The 13The 13thth Practice? Practice? The Stand Up MeetingThe Stand Up Meeting

• Start day with 15-minute meetingStart day with 15-minute meeting

• Everyone stands up (so the meeting Everyone stands up (so the meeting stays short) in circlestays short) in circle

• Going around the room everyone says Going around the room everyone says specifically:specifically:

• What they did the day beforeWhat they did the day before

• What they plan to do todayWhat they plan to do today

• Any obstacles they are experiencingAny obstacles they are experiencing

• Can be the way pairs are formedCan be the way pairs are formed

Page 45: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

People Communicate Most People Communicate Most Effectively Face-to-FaceEffectively Face-to-Face

Richness of communication channelRichness of communication channel

Co

mm

un

icat

ion

Eff

ecti

ven

ess

Co

mm

un

icat

ion

Eff

ecti

ven

ess

2 people at2 people atwhiteboardwhiteboard

2 people 2 people on phoneon phone

2 people2 peopleon email on email

VideotapeVideotape

PaperPaper

Page 46: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

How XP Solve Some How XP Solve Some SE ProblemsSE Problems

ProblemProblem SolutionSolution

Slipped scheduleSlipped schedule Short development cyclesShort development cycles

Cancelled projectCancelled project Intensive customer presenceIntensive customer presence

Cost of changesCost of changes Extensive, ongoing testing, Extensive, ongoing testing, system always runningsystem always running

Defect ratesDefect rates Unit tests, customer testsUnit tests, customer tests

Misunderstand the Misunderstand the businessbusiness Customer part of the teamCustomer part of the team

Business changesBusiness changes Changes are welcomeChanges are welcome

Staff turnoverStaff turnover Intensive teamworkIntensive teamwork

Page 47: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

So What does XP So What does XP Apply to?Apply to?

• Domains with changing requirementsDomains with changing requirements

• High-risk projects (including those with High-risk projects (including those with high schedule risk)high schedule risk)

• Small project team: 2 – 12 programmersSmall project team: 2 – 12 programmers

• Cannot use with a large staffCannot use with a large staff

• Extended development teamExtended development team

• Developers, managers and customerDevelopers, managers and customer

• Co-locatedCo-located

• Automated testabilityAutomated testability

Page 48: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Your Own Development Your Own Development Process?Process?

Page 49: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Mix-and-MatchMix-and-Match

• The practices in different agile methods The practices in different agile methods can be extracted and combinedcan be extracted and combined

• Establish your own processEstablish your own process

• Build it step-by-stepBuild it step-by-step

• Adapt good practices one by oneAdapt good practices one by one

• ExamplesExamples

• Pair programming and its variationPair programming and its variation

• Daily 15-minutes meetingDaily 15-minutes meeting

• Test-driven developmentTest-driven development

Page 50: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Agile Development Agile Development and XPand XP

Page 51: Agile Software Development Methodologies and XP Svetlin Nakov National Academy for Software Development.

Are You Agile?Are You Agile?