40
Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Embed Size (px)

Citation preview

Page 1: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Extreme Programming

Alexander Kanavin

Lappeenranta University of Technology

Page 2: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Some background

• Lightweight vs heavyweight methodologies

• Software Engineering Institute Capability Maturity Model (SEI CMM)

• Extreme Programming

Page 3: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Basic ideas

• Was put together as a response to the increasing difficulty of practicing heavyweight methodologies, especially in medium and small projects

• Has very few rules and practices

Page 4: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Rules

• Fall into four categories

• Planning

• Design

• Coding

• Testing

Page 5: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Rules for planning

• User stories are written

• Release planning creates the schedule

• Make frequent small releases

• The project velocity is measured

• The project is divided into iterations

• Iteration planning starts each iteration

Page 6: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Rules for planning 2

• Move people around

• A stand-up meeting starts each day

• Fix XP when it breaks

Page 7: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Planning - user stories

• Like use cases

• Written by the customers as things that the system needs to do for them

• Used for time estimation and release planning

• Avoid specifics (GUI layouts and such

Page 8: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Release planning meeting

• Creation of a release plan document

• Planning of individual iterations

• Estimation of user stories in terms of ideal programming weeks

Page 9: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Release plan

• Specifies exactly which user stories are going to be implemented for each system release and dates for the releases

• Stories are translated into acceptance tests

Page 10: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Make frequent small releases

• For valuable feedback

• Important features are introduced early - more time to fix them

Page 11: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Project velocity

• How many user stories were finished during the iteration

• Allows estimation for future iterations

Page 12: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Iterative development

• Don’t schedule tasks in advance

• Don’t look ahead and add anything that’s not scheduled for this iteration

Page 13: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Iteration planning meeting

• Customer chooses user stories from the release plan, that are most valuable to him

• These are translated into the programming tasks (1 to 3 ideal programming days)

• Project velocity is used to estimate if the iteration is overbooked or not.

Page 14: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Move people around

• Avoiding knowledge loss and coding bottlenecks

• Everyone knows enough about every part of the system

Page 15: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Daily stand up meeting

• Everyone stands up in a circle

• Prevents it from dragging on for too long

• Communications of problems, solutions and promotion of team focus

Page 16: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Design rules

• Simplicity

• Choose a system metaphor

• Use CRC cards for design sessions

• Create spike solutions to reduce risk

• No functionality is added early

• Refactor whenever possible

Page 17: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Simplicity

• Needs no explanation

• Keeping a design simple is hard work, however

Page 18: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Choose a system metaphor

• Allows consistent naming of classes and methods

• Being able to guess how something is named is important (time saver)

Page 19: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

CRC cards

• Class, Responsibilities and Collaboration

• Used to represent objects

• Class written on top

• Responsibilities on the left

• Collaborating classes to the right of each responsibility

Page 20: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Spike solution

• A very simple program to explore potential solutions

• Throw-away program

Page 21: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Never add functionality early

• Avoid the tempation

• Concentrate on what is scheduled for today only

Page 22: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Refactoring

• Rewriting a piece of program so that it does the same thing, but does it better

• Removing redundancy, elimination of unused code, getting rid of obsolete designs

• Helps keep the design simple and keeping code clean and concise

Page 23: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Coding rules

• The customer is always available

• Code must be written to agreed standards

• Code the unit test first

• All code is pair programmed

• Only one pair integrates code at a time

• Integrate often

Page 24: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Coding rules 2

• Use collective code ownership

• Leave optimization till last

• No overtime work

Page 25: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Customer is always available

• To write user stories

• To select user stories

• Developers need to talk with the customer to get enough detail to complete a programming task

• Functional testing

Page 26: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Coding standards

• Self-explanatory

Page 27: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Code the unit test first

• It’s easier to create code after creating tests

• Tests define the requirements

Page 28: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Pair programming

• Sitting side by side in front of the monitor

• One person types and thinks tactically

• The other one thinks strategically

Page 29: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Sequential integration

• Solves problems of parallel integration

• Using a physical token or a dedicated computer

Page 30: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Integrate often

• Every few hours, not more than a day

• Helps detect compatibility problems early, promotes communication

Page 31: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Collective code ownership

• Everyone contributes ideas to all parts of the project (or fixes bugs or refactors)

• No one becomes a bottleneck

• The architecture is distributed among the team

Page 32: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Optimize last

• Don’t try to guess what the bottleneck is going to be

• Make it work right, then make it work fast

Page 33: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

No overtime

• If it requires overtime, it will be late no matter what

• Use a release planning meeting to change the timing

Page 34: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Testing

• All code must have unit tests

• All code must pass unit tests before it can be released

• When a bug is found tests are created

• Acceptance tests are run often and the results are published

Page 35: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Unit tests

• Enables collective code ownership

• Enables refactoring

• Enables frequent integration

Page 36: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Unit testing framework

• A development tool, not a testing tool

• Helps formalize requirements, clarify architecture, debug, optimize and test

• Example: Junit - a unit testing framework for Java,

Page 37: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

When a bug is found

• Create an acceptance test and unit tests to guard against it coming back

Page 38: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Acceptance tests

• Created from user stories

• Black box system tests

• Customer verifies the correctness of the tests

Page 39: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Weaknesses of XP

• Outstanding abilities of the team

• Having customer on site

• Doesn’t work in a large environment, with no contracting customer, few experts or simultaneous hardware development

Page 40: Extreme Programming Alexander Kanavin Lappeenranta University of Technology

Going further

• http://www.extremeprogramming.org

• Books: Amazon, Books.ru