Agile Development (Extreme Programming)
Study note of the book Agile Principles, Patterns, and Practices in C#, Section I by 弱菜逆铭
Values
Individuals + Interactions > Processes + Tools
Working Well With Others + Communicating + Interacting > Raw Programming Talent
Working Software > Comprehensive Documentation
Documentation
Short Rationale
Structure Document
Short: One or two dozen pages at most
Salient
Overall Design Rationale
Only the Highest-level Structures in System
Code & Team - Best "Documents" to New Comers
No Document Unless Its Need Immediate & Significant
Responding to Change > Following a Plan
Ability to Respond to Change - Decisive!
Better Planning Strategy
Next Week: Detailed Plans
Next 3 Months: Rough Plans
Beyond: Extreme Crude Plans
Principles
Highest Priority: Satisfy the Customer Through Early & Continuous Delivery of Valuable Software.
Less Functional in Initial → Higher Quality in Final
Welcome Changing Requirements - Even Late in Development.
Deliver Working Software Frequently.
Businesspeople and Developers Must Work Together Daily Throughout the Project.
Build Projects Around Motivated Individuals. People are the most important success factor.
Convey Information Through Face-to-face Conversation - Most Efficient & Effective.
Working Software is the Primary Measure of Progress.
Not documents or infrastructure code
Sustainable Development: Be Able to Maintain Constant Pace Indefinitely.
Continuous Attention to Technical Excellence & Good Design Enhances Agility.
Simplicity is Essential: Take the Simplest Path Consistent with the Goals.
Self-organizing Teams → Best Architectures, Requirements & Designs.
Responsibilities communicated to the team as a whole.
Team determines the best way to fulfill those responsibilities.
Reflect on How to Become More Effective at Regular Intervals, Then Tune & Adjust Behavior Accordingly.
Practices
Whole Team: Work Closely
Customers
Customer Can't be Close by: find someone else who
can be close by
is willing & able to represent true customer
Managers
Developers
User Stories
A Mnemonic Token
Conversation with Customer: Get Sense of Details of Requirements
No Need to Catch Specific Details
Customer
Write Some Words as Reminder of Conversation on an Index Card
Developer
Write an Estimate on the Card Concurrently
A Planning Tool
Schedule the Implementation of a Requirement
Based on
Priority
Estimated Cost
Short Cycles
Iteration
Usually 2 weeks in length
Plan(see "Planning")
Stories Can't be Changed Once the Iteration Starts (neither description nor priority)
Minor Delivery
Demonstrate to Stakeholders to Get Feedback
May or May Not Be Put into Production
Release
Usually 3 months in length (6± iterations)
Plan(see "Planning")
Stories Can be Changed at Any Time (cancel, add new or change priority)
Major Delivery
Can Usually be Put into Production
Test-Driven Development
White box tests
Knows and depends on internal structure of the module being tested
All Production Code is Written to Make a Failing Unit Test Pass
Simple Rules
Don't write any production code until you have written a failing unit test.
Don't write more of a unit test than is sufficient to fail or fail to compile.
Don't write any more production code than is sufficient to pass the failing test.
Effects
Every single function has tests that verify its operation
Backstop for further development: Help to ensure nothing has broken when making small changes
Greatly Facilitates Refactoring
View the program from the vantage point of a caller
Design the software to be conveniently callable
Design the program to be testable
Decouple the software
Compilable and executable documentation for the internals of the system
Doesn't verify system works properly as a whole (that's what acceptance tests do)
Tool
NUnit
Acceptance Tests
Black box tests
Does not know or depend on the internal structure of the module being tested
Writing the Tests
Written by folks who do not know the internal mechanisms of the system
Business Analysts
Quality Assurance Specialists
Testers
Written Immediately Preceding or Concurrently with the Implementation of the Story
Written in Scripting Language
Readable and writable by relatively nontechnical people
Run Automatically & Repeatedly
Passing Acceptance Tests
Once an Acceptance Test Passes
Add to the Body of Passing Acceptance Tests
Never Allowed to Fail Again
Run Every Time the System is Built (several times a day)
If an Acceptance Test Fails, the Build is Declared a Failure. (thus implemented requirements never break)
System is Never Allowed to go Unworking for Longer than a Few Hours
Effects
Profound effect on the architecture
System has to be decoupled at high architecture level to be testable
Compilable and executable documentation for the features of the system
Specifies the Detailed Operation of Stories to Implement
The Final Authority on Judging the Implementation
Tool
FitNesse
Pair Programming
The Roles
One Member Types on Keyborad
The Other Member Watches, Finding Errors and Improvements
Roles Change Frequently
Resultant Code is Designed and Authored by Both. (neither can take more than half the credit.)
Pair Membership Changes Frequently (at least once per day)
Every programmer works in several different pairs each day
Over the Crouse of an Iteration Every Team Member Should Have:
Worked with Every Other Member of the Team
Worked on Just About Everything in the Iteration
Advantages
Dramatically Increases the Spread of Knowledge throughout the Team
Specialties pair with nearly everyone else to spread the specialty throughout the team Other team members can fill in for the specialists in a pinch
Significantly Reduce the Defect Rate
Does Not Reduce the Efficiency
Collective Ownership
A pair has the right to check out any module and improve it
No programmers are individually responsible for any one particular module or technology.
Doesn't mean that XP denies specialties. You are not confined to your specialty.
Continuous Integration
Programmers check their code in and integrate several times per day.
Rule
The first one to check in wins
Everybody else merges
Nonblocking Source Control
Programmers are allowed to check any module out at any time.
When checking module back in after modifying, programmer must be prepared to merge it with any changes.
To avoid long merge sessions, the members of the team check their modules very frequently.
Check-in Procedure
Make sure all the tests run.
Integrate new code into the existing code base.
If there is a merge to do, do it.
If necessary, consult with the programmers who beat them to the check-in.
Build the new system.
Run every test in the system. (including all currently running acceptance tests)
If anything used to work is broken, fix it.
Once all the tests run, finish the check-in.
Planning Game
The Essence: the Division of Responsibility Between Business & Development
Businesspeople & customers decide how important a feature is
Developers decide how much that feature will cost to implement
Initial Exploration
Developers & customers have conversations to identify all the significant features in mind
Don't try to identify all features. More will be discovered as the project proceeds
Break features into user stories
Write stories on index cards or their equivalent.
Not much is written on the card except the name.
Dont't try to capture details at this stage.
Just reminders of the coversation about the features
Developers estimate the stories
Estimates are relative, not absolute
Write a number of "points" on a story card to represent the relative cost
Oversized/Undersized stories are easily misestimated
Developers tend to underestimate large stories and overestimate small ones.
Split oversized stories Merge undersized stories
A story should be reestimated after being split or merged (not simply add or subtract the estimate)
Velocity
The sum of the estimates of the completed stories in a week
Tracking Velocity: one of the most important management tools
Release Planning
Developers & Customers agree on a date for the 1st release
Usually 24± months in the future
Customers pick stories to implement in the release and the rough order of implementation.
Consider Both Priority & Cost
Can't exceed the current velocity
Since the velocity is initially inaccurate, this selection is crude.
Release plan can be adjusted as velocity becomes more accurate
Iteratrion Plan
Developers & customers choose an iteration size (usu 1 or 2 weeks)
Customers pick stories to implement
Can't exceed the current velocity
Can't change stories in the iteration once it has begun
Developer decide order of implementation
Half way through the iteration, the team holds a meeting.
Half of the stories scheduled for the iteration should be complete
Stories, not tasks
If half the stories aren't complete, the team tries to reapportion tasks and responsibilities
If can't find such reapportionment, customers may pull a task or story from the iteration, or at least name the lowest-priority tasks and stories so that developers avoid working on them
Iteration ends on the specified date, even if all the stories aren't done.
Customers estimate, provide feedback
Defining "Done": A story is not done until all its acceptance tests pass.
Total the estimates of all completed stories to calculate the velocity of the iteration
The planned velocity for each iteration is the measured velocity of the previous iteration
Keeps the planning in sync with the team
Task Planning
Developers break stories into tasks
At the start of a new iteration
A task is sth. one developer can implement in 416 hours
Create Task List (with the customers' help)
Enumerate tasks as completely as possible
Task Selection
Estimate each task in arbitrary task points
"Perfect programming hours" can be used
Each developers sign up for the tasks they want to implement
Developer's budget can't be exceeded
Developers may sign up for any kind of task
Let knowledge of the project to spread throughout the team, irrespective of specialty.
Selection continues until either all tasks are assigned or all developers have used their budgets
If tasks remain, developers negotiate with each other, trading tasks, based on their various skills.
If this doesn't make enough room to get all the tasks assigned, the developers ask the customers to remove tasks or stories from the iteration.
If all the tasks are signed up and the developers still have room in their budgets for more work, they ask the customers for more stories.
Tracking
Velocity Chart
Burn-down Chart
Sustainable Pace
A team is not allowed to work overtime.
The only exception is that in the last week in a release, a team can work overtime if otherwise they wouldn't finish it.
Open Workspace
Team works together in an open room.
Tables are set up with 2 or 3 workstations on them. 2 chairs are in front of each workstation. Walls are covered with status charts, task breakdowns, Unified Modeling Language (UML) diagrams, and so on. The sound in this room is a buzz of conversation. Each pair is within earshot of every other pair. Each has the opportunity to hear when another is in trouble. Each knows the state of the other.
Programmers are in a position to communicate intensely.
Increases Productivity
Simple Design
Try to find the simplest possible design option for current stories.
Consider only the current stories.
Don't worrying about stories to come.
Fist of all, get the first stories working in the simplest way possible.
Add the infrastructure only when a story comes along that forces it to.
Don't tolerate duplication of code.
Wherever find duplication, eliminate it.
Ways to Elimate Duplication
Create a Function with Duplication Code in It
Use Base Class
Use Template Method Pattern
Create Abstractions (reduce coupling at the same time)
Refactoring
Three functions of a module
The function it performs while executing
Reason for the module's existence
Afford change
Communicate to its readers
Reserve code degradation through frequent refactoring.
Doesn't alter the external behavior
Make a series of tiny transformations that improve the structure
Each trivial
Together combine into significant
After each tiny transformation, run the unit tests to make sure that system is not broken.
Keep the system working while transforming its design.
Refactoring is done continuously & frequently (every hour or every half hour)
Metaphor
The Vision of the System
Ties the whole system together
Makes the location and shape of all the individual modules obvious
Often Boils Down to a System of Names
Provides a vocabulary for elements in the system
Helps to define the relationships between elements
Agile Development (Extreme Programming)
Added: 2009-07-04 10:02:41
From: (Joined 2008-11-20 11:29:51)
2928 views |239 downloads
Agile Development (Extreme Programming)