1 / 37

Title

Title. Extreme programming for programmers. Kirill Kalishev SPb Java Users Group 13 Oct 2001. Contents. Key concepts Planning Design Programming. Intent: to try to show programming in the eyes of the extreme programmer. The goals. Deliver value for the customer

warwick
Télécharger la présentation

Title

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Title Extreme programming for programmers Kirill Kalishev SPb Java Users Group 13 Oct 2001

  2. Contents Key concepts Planning Design Programming Intent: to try to show programming in the eyes of the extreme programmer

  3. The goals Deliver value for the customer Flatten the change curve Have fun doing programming

  4. Customer value Start Planned result Desired result Conformance to a big up-front plan Conformance to actual customer value

  5. Change curve Cost of change Implementation Analysis Design Test Requirements Development lifecycle We have to make it true! Provided the change is cheap

  6. Key concepts (XP values) • Communication • A project would fail if somebody doesn’t communicate something important • Simplicity • Do the simplest thing that could possibly work • (win in changing it when it needs change) • Feedback • Optimism is hazard, feedback is treatment • Courage • Don’t let your fears stop you from making great software Values is what distinguishes bunch of individuals vs. team

  7. Key concepts (four variables) Cost Time Scope Quality Manageable Const

  8. The circle of life Communication Feedback  Simplicity  Courage On-site customer Pair programming Short releases Planning game Refactoring Unit testing Simple design Acceptance testing

  9. Practices On-site customer Planning game Short releases Metaphor Simple design Test first Pair programming Continuos integration Refactoring Coding standards Collective ownership Sustainable pace Weakness of one is supported by strength of others

  10. On-site customer • The customer + programmers = a team • The customer is in the same room to give answers • prevents programmers from putting their suppositions to code • The customer is logically the one • all stakeholders speak to programmers with one voice • Can’t find a customer? • does the project make sense? Talking to the customer everyday is a key to success!

  11. Planning game - bill of rights Programmers Customer The right to an overall plan (what/when/how much) The right to know what is needed (clear declaration of priority) The right to change mind anytime (functionality/priorities) The right to make & update estimates The right to see the progress & be informed on any schedule changes The right to accept responsibilities vs. having them assigned The right to get the most possible value out of each programming week The right to produce quality work at all times

  12. Planning game - the moves Table Programmers Customer Defines stories (on index cards) Say who much it costs (put estimates to cards), go spike if needed Defines what to do & what to defer (sorts by value) Sort cards by risk Defines the plan (by time or by scope) Commit to meet the plan The plan

  13. Planning game - yesterday’s weather • The team believes that the next iteration they will do the same amount of work as in the previous one • Project velocity in terms of ideal engineering time (days/weeks/tomato hours) is calculated • All stories are estimated in the same metric • Each next iteration is filled with the stories whose summary estimates fills the current velocity The worst problem is not being behind the schedule as such, but not knowing about that

  14. Release vs. Iteration planning Customer Planning game Programmers Release Release Iteration Iteration 1 1 2 2 ... n n • Iteration planning • by time (1, 2, 3 week iterations) • each iteration the project velocity is updated • task breakdown is done • Release planning • by scope/by time

  15. Short releases • The whole team (customer + programmers) learns about the system • Releases are done often • The customer has a working system at all times

  16. Acceptance testing Programmers Customer Defines acceptance criteria for each story Make it automatic, make it pass

  17. Design strategy • XP believes that the best strategy is to solve the most pressing problem while keeping most options • In design, it reflects in the following: • No up-front design, instead, • Do The Simplest Thing That Could Possibly Work • rely on your ability to change it later, when you learn new things or new features will be really needed • Do design all the time, as you go along • Design for the iteration works Simplicity keeps most options!

  18. On diagrams • Like drawing cool diagrams? Great! We like it too. However, • Minimize the time between making design solution and turning it into code • Computer does’t understand diagrams, but does it for code • You should consider yourself just guessing until code is written • Start with a test, to know when you are done

  19. On architecture • Metaphor • The story both the customer and programmers share about how the system works • Metaphor covers most of what we call “architecture” • System of names • Actors • Interactions - Oops, it sounds like plumbing, right? - Yes, something like that. In this case water going through pipes is like a transaction. When at least one valve is closed -- no way to proceed - Cool, why don’t we call it pipes, water & valves - Okay, sounds like fun

  20. Pair programming • A rule: Each line of code is written by at least two people • Pair programming is a dialog of two people • The driver - controls the keyboard, the mouse and actively works on implementation of the program • The observer - thinks more strategically, looks for errors, misprints & etc. • Partners change roles • No dialog - no pair programming Pair-programmed code is better written & structured plus it is done quicker!

  21. Acceptance vs. unit testing • Acceptance tests • Owned by the customer • Proves that the story is done in terms of the customer’s perspective • Unit tests • Owned by programmers • Test everything that could possible break • Written before production code • Always pass 100% in the integrated code

  22. Unit testing - a bet • You won’t win if you write a test that • doesn’t communicate any new things about how production code should work • is not gonna break • You will win if you write a test that • communicates what is needed from the production code • will ever show that something has broken down (which is inevitable) - Test Everything That Could Possibly Break • independent of others as much as possible If you had to choose what to throw away, it should be production code, not tests

  23. Unit testing - XP style • When to test? It is a normal way to program: • If you add a new feature, write a test before production code • If you fix a defect, write a test that would expose the defect, then fix it • Every time, before you integrate code, unit tests must pass 100% Don’t let the fear that testing can’t catch all bugs stop you from writing tests that will catch most bugs

  24. Excuses for not testing • I don’t have time • This can’t be tested • I don’t know how • It tests itself! • I already tested it once and I have not changed it. I am smart enough to know this works perfectly XP is not about writing production code. It is about writing tests and making them pass.

  25. Code quality • Quality code • Runs all tests • Expresses every idea we need to express • Says everything once and only once • Have the minimum number of classes and methods consistent with the above • No production production code is considered existing without tests for that

  26. Collective code ownership • No code is owned by an individual person • The team owns that (read - everyone in the team) • If you see the chance to put changes - just do it, but • all unit tests must pass 100% • integrate asap, otherwise you will lose • Why is it better than personally owned code? • You don’t have to wait unit a responsible person will be available • You know better what you want Conflicts are not a problem as such. You have tests, you integrate often so you are not afraid of conflicts

  27. Continuos integration • No code sits nonintegrated for more than two hours • integration is not painful anymore, we do it several times an hour! • There is only one integration thread a time • to make sure you’re integrating only your changes (integration computer works) • All unit tests must pass 100% every time you integrate

  28. Refactoring • An activity of changing structure without modifying behavior, aimed at: • making the program easier to understand & cheaper to modify • A core activity to do a good program • start with a simple thing & refactor it later. You are not afraid of being wrong. • Refactoring essential? No, if you are • omniscient • perfect • and so everyone else on the team Refactoring is everyday disciplined activity. If you do more and more refactoring - it means you don’t do enough refactoring

  29. Essentials of refactoring • If you add a feature • first look for chance to improve existing code, to make the adding easier • refactor • make sure unit tests pass 100% & integrate • write a test, put in new feature and make the tests pass again • integrate • If you see the chance to improve something - do it. Otherwise, you risk to run into debts. If you don’t want to do refactoring for yourself, do it for your team!

  30. Coding standards Looking at the code, you should not see who wrote that Different coding styles should not be an obstacle to better understanding. Develop that, agree on that and follow that! Any fool can write a program the computer can understand. Good programmers write programs other people can understand.

  31. On comments • We do appreciate good comments. However, while development, we don’t write comments because: • they often lie • they don’t provide feedback (computer doesn’t understand them!) • there are a lot of more reliable ways to reveal the intent If you feel you should put a comment, refactor you program first. Then, take a look again. You are likely to lose you will to put comments.

  32. Sustainable pace Productivity does not increase with hours worked so we work 40-hour week to be fresh and eager If we have to work overtime, we don’t do it more than a week

  33. On simplicity • Simplicity is the art of maximizing the amount of work not done • simplicity to do • simplicity to understand • simplicity to change • Complexity is like debts. The more we keep it complicated, the more money we pay for that What may look simple for you, may not be the case for the team. The way is to learn, agree and follow. The whole team together.

  34. On design patterns • Design is a kind of recognition of patterns - we call it “experience” • Design patterns (like ones from GoF) give us system of names, what promotes better: • communication • understanding • Since patterns are goals for refactoring, learning refactoring techniques is essential as well Thinking in patterns is not an evil. Narrow thinking is.

  35. Why is it worth trying? • To realize if XP is for you or not • Practices are simple. Their interactions are not obvious. The most value on XP is in the mutual support of the practices • To ship software & have from it

  36. Who is who in the XP world • The inventors of XP • Kent Beck • Ward Cunningham http://c2.com • Martin Fowler http://www.martinfowler.com • Famous speakers & writers on XP • Bob Martin http://www.objectmentor.com • Ron Jeffries • Don Wells http://www.extremeprogramming.org • William Wake http://users.vnet.net/wwake • Pair programming & collaborative development • Laurie Williams http://collaboration.csc.ncsu.edu/laurie/

  37. Come share experience! • Within SPb XP users group • http://groups.yahoo.com/group/spbxp • You can reach me • by phone: +7 (812) 322-9526 • web:http://www.kirillkalishev.com

More Related