CSC/ECE 517 Fall 2012/ch2a 2w8 vp

From Expertiza_Wiki
Jump to navigation Jump to search

Extreme programming (XP)

This chapter focuses on explaining below points. Describe what extreme programming is. Concepts of XP. Four values in XP. Aspects in key practices such as pair programming, collective code ownership, stories, automated testing, small releases and continuous integration. Advantages and Disadvantages with XP. Comparison with waterfall model

What is extreme programming

Extreme Programming (XP) is a software development methodology created by Kent Beck during his work on the Chrysler Comprehensive Compensation System (C3) payroll project. Extreme Programming is intended to improve software quality and responsiveness to changing customer requirements. It is a one of the several types of agile software development processes. Extreme Programming is successful because it stresses customer satisfaction. Instead of delivering everything you could possibly want on some date far in the future this process delivers the software you need as you need it. Extreme Programming empowers developers to confidently respond to changing customer requirements, even late in the life cycle. Back to top

Concepts of XP

Goals

Extreme Programming is a software-development discipline that organizes people to produce higher quality software more productively. The main goals are:

  1. Attempt to reduce the cost of changes in requirements by having multiple short development cycles
  2. Changes are a natural and a desirable aspect of software-development projects, and should be planned for in advance.

Activities

XP describes four basic activities that are performed within the software development process: designing, coding, testing, listening as described below:

Coding

The guiding principle of XP is that without code, there is no working product. Hence, importance is given to code rather than documentation for various aspects.

Coding can also help to communicate thoughts about problems. A programmer dealing with a complex programming problem, might prototype it in a simplified manner and use it to demonstrate what he or she means. Code is always clear and concise and makes the problem unambiguous.

Testing

Extreme programming's approach is that a lot of testing can eliminate many flaws in the product.

Unit tests are performed to determine whether a given unit of the product works as intended. A programmer writes as many automated tests as they can think of that might "break" the code. Only if all tests run successfully, then the coding is complete. Every piece of code that is written is tested before moving on to the next feature. Acceptance tests verify that the components delivered the programmers satisfy the customer's actual requirements.

Listening

The Programmers must listen to what the customer requirements are clearly, and what business logic is needed and give feedback about the technical aspects of how the problem might be solved, or cannot be solved. Effective communication between the customer and the development team is essential to get the product working as intended. Hence, listening is a very important aspect of XP.

Designing

Creating a design structure organizes the components of the system. Good design will avoid lots of dependencies within a system and will focus on low Coupling and high Cohesion. Without a proper design the system becomes too complex and the dependencies within the system cease to be clear.

Four values in XP

  • Simplicity: Keeping code simple makes changing code easier as the requirements inevitably change. Simple solutions to today's problems minimizes the cost of change over time. For example it is ten times harder to fix a mistake of requirements when you are in the design phase, and 100 times harder to make changes late in a project during the coding phase. simple designs minimizes the risk of spending a long time designing sophisticated frameworks that the customer may not use/want.

One important point to note is that XP approach recognizes that the cost of change generally increases like one would expect, but this increase is not always increasing. If the code is refactored and kept simple, we can avoid ever-increasing complexity.

  • Communication: With respect to programmers, code communicates best when it is simple else once should strive to simplify it. Another form of communication is Unit Tests, Unit tests exercise the classes and methods in your application,Unit tests communicate the design of a class effectively.Programmers communicate to with one another because they program in pairs(Pair Programming).There is no set observer in a pair. XP requires an on-site customer to convey the requirements to the team. The customer decides which features are most important, and is always available to answer questions.
  • Feedback: On-site customer the means to get immediate feedback about the project status. There are short release cycles, where the customer is able to evaluate each new feature as it is developed, minimizing the necessity to rework and helping the programmers focus on what is most important to the customer. The customer always defines which features are the most important, so the most valuable features are delivered early in the project. Customers can cancel the project at any time and have a working system with the features as per the last release.
  • Courage: For managers, the concept of pair programming can be hard to accept—it seems like productivity will drop by 50%, because only half of the programmers are writing code at any given time. It takes courage to trust that pair programming improves quality without slowing down progress. It takes courage to implement the feature the customer is asking for today using a simple approach, because you probably want to build in flexibility to account for tomorrow's features, as well.Everyone gives and feels the respect they deserve as a valued team member. Everyone contributes value even if it's simply enthusiasm. Developers respect the expertise of the customers and vice versa. Management respects our right to accept responsibility and receive authority over our own work.

Back to top

Aspects in key practices

There are 19 key practices:

  • Joint
  • Common Vocabulary
  • Iterations
  • Open Workspace
  • Retrospectives
  • Development
  • Test-First Development
  • Pair Programming
  • Refactoring
  • Collective Ownership
  • Continuous Integration
  • Just-In-Time Design
  • Customer
  • Storytelling
  • Release Planning
  • Acceptance Tests
  • Frequent Releases
  • Management
  • Accepted Responsibility
  • Air Cover
  • Quarterly Review
  • Mirror
  • Sustainable Pace

Lets understand some of the practices in more detail.

Pair-Programming:
XP teams work in pairs where they share a single computer, keyboard, and mouse.

Flow:

  • Programmer picks a User Story.
  • Programmer1 asks for help from another Programmer2.
  • Programmer1 and Programmer2 work to implement the functionality.
  • After the immediate task is completed, programmer1 picks another partner to complete the remaining task or offers help to someone else.

Advantage:

  • Partners rotate frequently and hence facilitate communication.
  • Paring with experienced programmers beginners gain valuable coding experience.
  • While one person writes programs other gets time to think about the problem at higher level of abstraction.

Collective Ownership:

  • Every team member can work on any part of code in the application. There is constant shuffling and change of roles.
  • Collective code ownership works because any team member can ask for help when he/she works on unfamiliar classes.
  • It’s easier to catch errors when you have a set of unit cases to rely on. If a new change introduced by a partner breaks the code, it can be easily tracked before the code is integrated.
  • Shared ownership model avoids the problem situations where the entire team depends on the one person who understands a part of code.
  • It encourages high design quality because every functionality is subject to continuous refactor and modification.

User – Stories:

  • Used to estimate for the release planning meeting.
  • Easy to comprehend as compared to large requirement documents.
  • Very intuitive since they reflect what customers expect hence drive the creation of acceptance test.
  • User stories provide enough detail to make a low risk estimate of the time the story will take to implement.
  • Each story will be 1, 2 or 3 week estimate in "ideal development time" which is the time it would take to implement the story in code if there were no distractions and the programmers know what to do. If its more than 3 weeks then the stories need to be broken down into simpler stories.
  • Avoid details of technology, data base layout, and algorithms being used.

Automated – Testing:

XP is highly dependent on unit testing. Testing provide the safety net enabling pairs of programmers to make changes to any piece of code with courage. In this way programmers are more responsible for the code they create. Also each class have a suite of automated unit test. So before any changes are made to the code below procedure (Test Driven Development.) is followed.

Testing new feature: XP teams write tests before each new feature is added to the system. Here is the test-driven process:

  1. Run the suite of unit tests for the entire project, ensuring that they all pass.
  2. Write a unit test for the new feature.
  3. You probably have to stub out the implementation in order to get your test to compile.
  4. Run the test and observe its failure.
  5. Implement the new feature.
  6. Run the test again and observe its success.

Also Acceptance Testing is done to test high-level application functionality. This kind of test involves and is driven by the customer. When you need to test high-level application functionality, turn to acceptance testing. This sort of testing is driven by the customer, although they will probably need help from a programmer to implement the tests. Acceptance tests should be designed to pass or fail, and they should be as automated as possible. Unlike unit tests, however, acceptance tests do not have to pass at 100%.

Small Releases:

Below are the activities which involve small release planning:

  1. Prioritize the work. Arrange tasks by difficulty. Assign a low value to a simple task
  2. Make a plan.
  3. Customers, managers and developers must be involved.
  4. Define task from specification into user-stories
  5. Break down large tasks if possible
  6. Estimate how much time is needed. Can measure absolutely or relatively in terms of Hours or Story Points
  7. Important questions to ask, What should be completed first? Are tasks not necessary? Will the tasks take too long?
  8. Customer feedback important
  9. Developers can also decide what tasks are important.
  10. Decide what will be done in each iteration
  11. Velocity: Amount of work per iteration Also, if velocity is unknown estimate or do a test iteration.
  12. Each release plan has some sprints(one to two weeks long). We assign features to each sprint

Then we determine the velocity in terms of story points per sprint.

Back to top

Advantages of XP

  • Built-In Quality
  • Overall Simplicity
  • Programmer Power
  • Customer Power
  • Synergy Between Practices
  • Coding Standards – Reduces the amount of time developers spend reformatting other peoples’ code. Reduces the need for internal commenting. Call for clear, unambiguous code
  • On-Site Customer - Can give quick and knowledgeable answers to real development questions. Makes sure that what is developed is what is needed. Functionality is prioritized correctly
  • 40-Hour Week – Most developers lose effectiveness past 40-Hours. Value is placed on the developer’s well-being. Management is forced to find real solutions
  • Continuous Integration - Reduces to lengthy process. Enables the Small Releases practice
  • Collective Ownership - Helps mitigate the loss of a team member leaving. Promotes developers to take responsibility for the system as whole rather than parts of the system
  • Pair Programming – Two heads are better than one. Focus Two people are more likely to answer the following questions: Is this whole approach going to work? What are some test cases that may not work yet? Is there a way to simplify this?
  • Refactoring – Prompts developers to proactively improve the product as a whole. Increases developer knowledge of the system
  • Testing – Unit testing promote testing completeness. Test-first gives developers a goal. Automation gives a suite of regression test
  • Simple Design – Time is not wasted adding superfluous functionality. Easier to understand what is going on. Refactoring and collective ownership is made possible. Helps keeps programmers on track
  • Metaphor – Encourages a common set of terms for the system. Reduction of buzz words and jargon. A quick and easy way to explain the system
  • Small Releases – Frequent feedback. Tracking. Reduce chance of overall project slippage
  • The Planning Game – Reduction in time wasted on useless features. Greater customer appreciation of the cost of a feature. Less guesswork in planning

Back to top

Disadvantages of XP

  • Informal, little, or no documentation
  • Scalability
  • Contract Issues
  • Misconception on the cost of change
  • Tailoring
  • Coding Standards – Degrading the quality of inline documentation
  • On-Site Customer – Difficult to get an On-Site Customer. The On-Site customer that is given may not be fully knowledgeable about what the company may not have authority to make many decisions. Loss of work to the customer’s company.
  • 40-Hour Week - The underlying principle is flawed. 40-Hours is a magic number. Some may like to work more than 40-Hours
  • Continuous Integration – The one day limit is not always practical. Reduces the importance of a well-thought-out architecture
  • Collective Ownership - Loss of accountability. Limitation to how much of a large system that an individual can practically “own”
  • Pair Programming – Many tasks really don’t require two programmers. A hard sell to the customers. Not for everyone
  • Refactoring – Not everyone is capable of refactoring. Refactoring may not always be appropriate. Would upfront design eliminate refactoring?
  • Testing – Automated unit testing isn’t for everything. Reliance on unit testing isn’t a good idea. A test result is only as good as the test itself
  • Simple Design – What is “simple?”. Simple isn’t always best
  • Metaphor – Often the metaphor is the system. Another opportunity for miscommunication. The system is often not well understood as a metaphor
  • Small Releases – Not easy for all projects. Not needed for all projects. Versioning issues.
  • The Planning Game – Customer availability. Is planning this often necessary?

Back to top

Comparison with waterfall model

Waterfall approach emphasizes on clear definition from the beginning of project. Its strengths are ability to analyse potential changes easily, large and distributed teams are well-coordinated, predictable budgets, and only needs small involvement from subject matter experts. But there are some clear disadvantages also. For example lack of flexibility, difficulty in predicting actual needs for the software, the loss of intangible knowledge between phases, discouragement of team cohesion, and the tendency to not discover design flaws until the testing phase. In reality it is very difficult for projects to follow the sequential flow of the model. It is difficult to identify all requirements and goals at the beginning of projects as requirements tend to change all the way. A working version can only be obtained late in the process.   Below is a picture of how agile methodologies differ from traditional Waterfall Model.

Back to top

Research Conclusion

Research was carried out in Carnegie Mellon University where data collected was from five years of 50 teams, developing the same project each year and the affects of transitioning from Waterfall to Extreme Programming was analyzed. The characteristics between these two methods were evaluated and compared. According to the paper, waterfall teams spent more time creating high ceremony documents where as Extreme Programming teams spent more time writing code and documenting their design in their code.  Surprisingly, the amount of code and features completed were roughly the same for both methods suggesting that on a three month project with three to four developers it didn't matter the method used. Please refer the references for the research paper.

Back to top

Tools

5 Hand-picked Extreme Programming XP Tools

External Links

  1. [ http://www.cutter.com/content-and-analysis/resource-centers/agile-project-management/sample-our-research/ead0002/ead0002.pdf Cutter Agile Project Management]
  2. [ http://en.wikipedia.org/wiki/Extreme_programming Extreme Programming Wikipedia ]
  3. [ http://www.cs.usfca.edu/~parrt/course/601/lectures/xp.html USF Lectures on Extreme Programming]
  4. [ http://www.computerworld.com/s/article/66192/Extreme_Programming?taxonomyId=063 Computerworld Articles Extreme Programming]
  5. [ http://www.extremeprogramming.org ExtremeProgramming.org]
  6. [ http://www.jera.com/techinfo/xpfaq.html Jera Extreme Programming]
  7. [ http://www.softwarereality.com/lifecycle/xp/four_values.jsp Software Reality Four Values]
  8. [ http://repository.cmu.edu/cgi/viewcontent.cgi?article=1056&context=silicon_valley&sei-redir=1&referer=http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3Dcompare%2520it%2520with%2520waterfall%2520model%2520and%2520extreme%2520programming%26source%3Dweb%26cd%3D2%26ved%3D0CCQQFjAB%26url%3Dhttp%253A%252F%252Frepository.cmu.edu%252Fcgi%252Fviewcontent.cgi%253Farticle%253D1056%2526context%253Dsilicon_valley%26ei%3DG_aCUKeIFo-k8gTJzIGQAw%26usg%3DAFQjCNEmwlV8Xg6uapysO7P0RTcnlEPz3g#search=%22compare%20waterfall%20model%20extreme%20programming%22 Comparing Extreme Programming and Waterfall Project Results]