Advertisement
claukiller

Untitled

Jan 7th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.00 KB | None | 0 0
  1. //about quality
  2. Quality is another strange variable. Often, by insisting on better quality you can get projects done
  3. sooner, or you can get more done in a given amount of time. This happened to me when I started
  4. writing unit tests (as described in Chapter 2, A Development Episode, page 7). As soon as I had
  5. my tests, I had so much more confidence in my code that I wrote faster, without stress. I could
  6. clean up my system more easily, which made further development easier. I've also seen this
  7. happen with teams. As soon as they start testing, or as soon as they agree on coding standards,
  8. they start going faster.
  9.  
  10. //Interactions Between the Variables
  11. There is a human effect from quality. Everybody wants to do a good job, and they work much
  12. better if they feel they are doing good work. If you deliberately downgrade quality, your team might
  13. go faster at first, but soon the demoralization of producing crap will overwhelm any gains you
  14. temporarily made from not testing, or not reviewing, or not sticking to standards.
  15.  
  16. //Learning to drive
  17. I jerked back to attention as the car hit the gravel. My mom (her courage now amazes me) gently
  18. got the car back straight on the road. Then she actually taught me about driving. "Driving is not
  19. about getting the car going in the right direction. Driving is about constantly paying attention,
  20. making a little correction this way, a little correction that way."
  21. //ejemplo coche iba centrao en ir recto y su madre le dijo que es ir arreglando las cosas poco a poco
  22. This is the paradigm for XP. There is no such thing as straight and level. Even if things seem to be
  23. going perfectly, you don't take your eyes off the road. Change is the only constant. Always be
  24. prepared to move a little this way, a little that way. Sometimes maybe you have to move in a
  25. completely different direction. That's life as a programmer
  26. Everything in software changes. The requirements change. The design changes. The business
  27. changes. The technology changes. The team changes. The team members change. The problem
  28. isn't change, per se, because change is going to happen; the problem, rather, is the inability to
  29. cope with change when it comes.
  30.  
  31. //4values
  32. //Communication
  33.  
  34. The first value of XP is communication. Problems with projects can invariably be traced back to
  35. somebody not talking to somebody else about something important. Sometimes a programmer
  36. doesn't tell someone else about a critical change in the design. Sometimes a programmer doesn't
  37. ask the customer the right question, so a critical domain decision is blown. Sometimes a manager
  38. doesn't ask a programmer the right question, and project progress is misreported.
  39.  
  40. //Simplicity
  41.  
  42. XP is making a bet. It is betting that it is better to do a simple thing today and pay a little more
  43. tomorrow to change it if it needs it, than to do a more complicated thing today that may never be
  44. used anyway.
  45. Simplicity and communication have a wonderful mutually supporting relationship. The more you
  46. communicate, the clearer you can see exactly what needs to be done and the more confidence
  47. you have about what really doesn't need to be done. The simpler your system is, the less you have
  48. to communicate about, which leads to more complete communication, especially if you can
  49. simplify the system enough to require fewer programmers.
  50.  
  51. //Feedback
  52.  
  53. Most projects seem to have exactly the opposite strategy. The thinking seems to go, "As soon as
  54. the system is in production, you can no longer make 'interesting' changes, so keep the system in
  55. development as long as possible."
  56. This is exactly backwards. "In development" is a temporary state, one that the system will only be
  57. in for a small percentage of its life. Far better to give the system independent life, to make it stand
  58. and breathe on its own. You are going to have to live with supporting production and developing
  59. new functionality simultaneously. Better to get used to juggling production and development
  60. sooner rather than later.
  61.  
  62.  
  63. Concrete feedback works together with communication and simplicity. The more feedback you
  64. have, the easier it is to communicate. If someone has an objection to some code you have written
  65. and they hand you a test case that breaks it, that is worth a thousand hours of discussion about
  66. design aesthetics.
  67.  
  68. //Courage
  69.  
  70. Another courageous move is throwing code away. You know how sometimes you work all day on
  71. something, and it isn't going very well, and the machine crashes? And how the next morning you
  72. come in and in half an hour reconstruct all of the previous day's work but clean and simple this
  73. time?
  74. Use this. If the end of the day is coming and the code is a little out of control, toss it. Maybe save
  75. the test cases, if you like the interface you've designed, but maybe not. Maybe just start over from
  76. scratch.
  77.  
  78. //the values in practice
  79. The Values in Practice
  80. I asked the C3 team (that first big XP project I mentioned earlier) to tell me stories about their
  81. proudest moment on the project. I was hoping to get stories about big refactorings, or being saved
  82. by tests, or a happy customer. Instead, I got this:
  83. The moment I was proudest of was when Eddie moved to a job closer to home,
  84. avoiding a two-hour daily commute, so he could spend more time with his family.
  85. The team gave him total respect. Nobody said a word against him leaving.
  86. Everybody just asked what they could do to help.
  87. This points to a deeper value, one that lies below the surface of the other four—respect. If
  88. members of a team don't care about each other and what they are doing, XP is doomed.
  89.  
  90. //basic principles
  91. Assume simplicity—Treat every problem as if it can be solved with ridiculous simplicity. The time
  92. you save on the 98% of problems for which this is true will give you ridiculous resources to apply
  93. to the other 2%. In many ways, this is the hardest principle for programmers to swallow. We are
  94. traditionally told to plan for the future, to design for reuse. Instead, XP says to do a good job (tests,
  95. refactoring, communication) of solving today's job today and trust your ability to add complexity in
  96. the future where you need it. The economics of software as options favor this approach.
  97.  
  98. Open, honest communication—This is such a motherhood statement that I almost left it out. Who
  99. wouldn't want to communicate openly and honestly? Everybody I visit, it seems. Programmers
  100. have to be able to explain the consequences of other people's decisions, "You violated
  101. encapsulation here and it really messed me up." They have to be able to tell each other where
  102. there are problems in the code. They have to be free to express their fears, and get support. They
  103. have to be free to deliver bad news to customers and management, to deliver it early, and not be
  104. punished
  105.  
  106. //back to basics
  107. I remember when I first learned to program in BASIC. I had a couple of workbooks covering the
  108. fundamentals of programming. I went through them pretty quickly. When I had done that, I wanted
  109. to tackle a more challenging problem than the little exercises in the books. I decided I would write
  110. a Star Trek game, kind of like one I had played at the Lawrence Hall of Science in Berkeley, but
  111. cooler.
  112. My process for writing the programs to solve the workbook exercises had been to stare at the
  113. problem for a few minutes, type in the code to solve it, then deal with whatever problems arose. So
  114. I sat confidently down to write my game. Nothing came. I had no idea how to write an application
  115. bigger than 20 lines. So I stepped away and I tried to write down the whole program on paper
  116. before typing it in. I got three lines written before I got stuck again.
  117.  
  118. When you code something up, you also have an opportunity to understand the best structure for
  119. the code. There are certain signs in the code that tell you that you don't yet understand the
  120. necessary structure.
  121. Code also gives you a chance to communicate clearly and concisely. If you have an idea and
  122. explain it to me, I can easily misunderstand. If we code it together, though, I can see in the logic
  123. you write the precise shape of your ideas. Again, I see the shape of your ideas not as you see
  124. them in your head, but as they find expression to the outside world.
  125. This communication easily turns into learning. I see your idea and I get one of my own. I have
  126. trouble expressing it to you, so I turn to code, also. Since it is a related idea, we use related code.
  127. You see that idea and have another.
  128.  
  129. Fortunately, there is a short-term reason to write tests. Programming when you have the tests is
  130. more fun than programming when you don't. You code with so much more confidence. You never
  131. have to entertain those nagging thoughts of "Well, this is the right thing to do right now, but I
  132. wonder what I broke." Push the button. Run all the tests. If the light turns green, you are ready to
  133. go to the next thing with renewed confidence.
  134. I caught myself doing this in a public programming demonstration. Every time I would turn from the
  135. audience to begin programming again, I would push my testing button. I hadn't changed any code.
  136. Nothing in the environment had changed. I just wanted a little jolt of confidence. Seeing that the
  137. tests still ran gave me that
  138.  
  139. //quick overview
  140. The Planning Game—Quickly determine the scope of the next release by combining
  141. business priorities and technical estimates. As reality overtakes the plan, update the plan.
  142. ● Small releases—Put a simple system into production quickly, then release new versions on
  143. a very short cycle.
  144. ● Metaphor—Guide all development with a simple shared story of how the whole system
  145. works.
  146. ● Simple design—The system should be designed as simply as possible at any given
  147. moment. Extra complexity is removed as soon as it is discovered.
  148. ● Testing—Programmers continually write unit tests, which must run flawlessly for
  149. development to continue. Customers write tests demonstrating that features are finished.
  150. ● Refactoring—Programmers restructure the system without changing its behavior to remove
  151. duplication, improve communication, simplify, or add flexibility.
  152. ● Pair programming—All production code is written with two programmers at one machine.
  153. ● Collective ownership—Anyone can change any code anywhere in the system at any time.
  154. ● Continuous integration—Integrate and build the system many times a day, every time a
  155. task is completed.
  156. ● 40 hour week—Work no more than 40 hours a week as a rule. Never work overtime a
  157. second week in a row.
  158. ● On-site customer—Include a real, live user on the team, available full-time to answer
  159. questions.
  160. ● Coding standards—Programmers write all code in accordance with rules emphasizing
  161. communication through the code.
  162. //testing
  163. Any program feature without an automated test simply doesn't exist. Programmers write unit tests
  164. so that their confidence in the operation of the program can become part of the program itself
  165. //refactoring
  166. Note that this means that sometimes you do more work than absolutely necessary to get a feature
  167. running. But in working this way, you ensure that you can add the next feature with a reasonable
  168. amount of effort, and the next, and the next. You don't refactor on speculation, though; you
  169. refactor when the system asks you to. When the system requires that you duplicate code, it is
  170. asking for refactoring.
  171. //Pair Programming
  172. All production code is written with two people looking at one machine, with one keyboard and one
  173. mouse.
  174. There are two roles in each pair. One partner, the one with the keyboard and the mouse, is
  175. thinking about the best way to implement this method right here. The other partner is thinking more
  176. strategically:
  177. ● Is this whole approach going to work?
  178. ● What are some other test cases that might not work yet?
  179. ● Is there some way to simplify the whole system so the current problem just disappears?
  180. Pairing is dynamic. If two people pair in the morning, in the afternoon they might easily be paired
  181. with other folks. If you have responsibility for a task in an area that is unfamiliar to you, you might
  182. ask someone with recent experience to pair with you. More often, anyone on the team will do as a
  183. partner.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement