You are previewing Extreme Programming Adventures in C#.
O'Reilly logo
Extreme Programming Adventures in C#

Book Description

Apply what you know about extreme programming and object-oriented design to learning C# and the Microsoft® .NET Framework on the fly. Written by a leader in extreme programming, this book covers both high-level concepts and practical coding applications.

Table of Contents

  1. Extreme Programming Adventures in C#
  2. A Note Regarding Supplemental Files
  3. Foreword
  4. Introduction
    1. Code on the Companion Web Site
    2. System Requirements
    3. Support
    4. Acknowledgments
  5. Extreme Programming
    1. XP in the Context of This Book
    2. Extreme Programming Values
      1. Simplicity
      2. Communication
      3. Feedback
      4. Courage
      5. The Values in Concert
    3. Extreme Programming Practices
      1. Whole Team
      2. Planning Game
      3. Small Releases
      4. Customer Acceptance Tests
      5. Simple Design
      6. Pair Programming
      7. Test-Driven Development
      8. Design Improvement
      9. Supporting Practices
    4. Is It XP?
  6. 1. XML Notepad Stories
    1. Building an Application Extreme-Programming Style
    2. Initial Vision
    3. Learn from the Best
    4. Petzold Notepad Version 1
    5. Handling Keyboard Events
    6. Shaping the Release
    7. Stories for Initial Release
    8. Subsequent Iterations and Releases
    9. The XProgramming Format
  7. 2. Testing with NUnit
    1. Testing: A Core Practice
    2. NUnit
    3. Setting Up NUnit
    4. Finding a Simple Pattern
    5. Paired Tags
    6. Paired Unknown Tags
    7. Unmatched Tags
    8. What’s Left?
      1. Wait! I Just Thought...
    9. A Short Look at Debugging Under NUnit
    10. The Debug Startup Program
    11. Attach to the NUnit Process
    12. Choosing a Technique
    13. Summary
  8. 3. A Pressing Matter
    1. The First Story
    2. Handling the Enter
    3. It Didn’t Work!
    4. What’s Next?
  9. 4. Extracting the Model
    1. Where We Were
    2. The Basic Plan
    3. The Refactoring
      1. One Last Thing
    4. What’s Next?
  10. 5. Expressing Ideas
    1. Something to Do
    2. Commenting for "Clarity"
      1. Is This Really More Clear?
    3. Commenting Means "Not Done"
      1. Easy Pickins
      2. The Cursor Line
    4. We Need Some Tests Here!
    5. Some Additional Tests
    6. The Starting Code
    7. The Current Code
    8. What’s Next?
      1. Our Story Works!
      2. WRONG! Where’s Our Customer Acceptance Test?
    9. A Little Refactoring: That Ugly Get
    10. Get Rid of the Text Copy
    11. Observations and Conclusions
    12. Reflecting Back
    13. Current Code
  11. 6. The First Customer Acceptance Test
    1. Do We Need a Customer Test?
    2. OK, We Need a Test
    3. The Test Runs!
    4. Imagine a Long Delay...
    5. Test from a File
    6. Test a Lot of Files
    7. Still to Come
  12. 7. Warts and All
    1. Enhancing the Customer Tests
    2. Do You Have a Test for That?
    3. The First Test Worked
    4. There’s Only One Thing to Do
    5. We Need an Object
    6. Conclusions for Today
    7. Further Reflection
      1. Program by Intention
      2. Better Code Management
    8. Upgrading the Code Manager
  13. 8. The InputCommand Object
    1. Recap
    2. Cleaning the Lines
    3. Building SelectionStart
  14. 9. Story One Is Done!
    1. Planning Our Next Session
      1. Pushing the Command Metaphor
      2. Duplicate Reading Logic
      3. Code Manager Needs Autorun
      4. Watts Stuff
    2. Cleaning the Code
      1. CustomerTest: ArrayToEnd
      2. Scaffolding Tests
      3. Rename a Test
      4. Rename a Variable
      5. InterpretFileInput
      6. The Read Loops
    3. InputCommand Refactoring
      1. Would Watts Have Helped Us?
      2. CleanTheLines
    4. Smaller Details
      1. CommandTest
      2. TextModel Method: TestText
      3. Comments
      4. LinesAfterCursor and LinesThroughCursor
    5. Conclusions
    6. Ship It!
    7. Iteration Planning
      1. Save a File
      2. Scrolling After Enter
      3. XML Conversion
    8. Conclusion
  15. 10. Find a Bug, Write a Test
    1. Oh No, There’s a Bug!
    2. Find a Defect, Write Tests
    3. Mock the TextBox
      1. The Payoff?
    4. Extract Method
    5. The Scroll Test
    6. Build an Interface
    7. Lessons: Lots of Learning, Not Much Testing
      1. Feature Envy
      2. Object Being Born
      3. Building and Using an Interface
      4. Building a Mock Object
      5. Tests, Tests, We Need More Tests
      6. Miles to Go...
    8. Conclusions
    9. Code Summary
    10. CustomerTest.cs
    11. InputCommand.cs
    12. InputCommandTest.cs
    13. ITestTextBox.cs
    14. MockTextBox.cs
    15. Notepad.cs
    16. TestableTextBox.cs
    17. TestScroll.cs
    18. TextTextBox.cs
    19. TestTextModel1.cs
    20. TextModel.cs
    21. XMLNotepad.cs
  16. 11. Adding the Section Tag, Part I
    1. Looking at the Next Few Stories
    2. A Quick Look Around
      1. Trivial Test
      2. File Input Test
      3. Para After Para Test
      4. Insert Para Test
      5. Insert After Para Test
      6. Input Command Test
      7. ITestTextBox and MockTextBox
      8. Test Text Model
    3. The New Customer Test
    4. Adding the Programmer Test
    5. After Lunch Comes a Bit Late
    6. Adding Ctrl+S—Almost
      1. Test for More of Alt+S
      2. Implementing More of Alt+S
    7. Improving the Code
    8. Removing Duplication
    9. What’s Next?
  17. 12. Adding the Section Tag, Part II
    1. Reviewing the Code
    2. The Tests All Run
    3. The Lesson
    4. The TextModel Code
    5. Looking Around
    6. What Do We See Now?
    7. Judgment Call
    8. Enough for Now
    9. Code Summary
  18. 13. Discovering the Menu
    1. Exploring the Problem
    2. Other Issues
    3. Preparing the Ground
    4. Adding the Menu
    5. Enough For Now?
    6. What’s Next?
  19. 14. Don’t Try This at Home
    1. The Idle Brain Is the Devil’s Playground
      1. YAGNI
    2. Sketching the Solution
    3. Further Down the Rat Hole
    4. Real Soon Now
    5. Don’t Try This at Home
  20. 15. Climbing Out of the Rat Hole
    1. Pairing at a Distance
    2. What’s a Delegate?
    3. Converting XMLNotepad to Use Delegates
  21. 16. Adding the <pre> Tag
    1. New Stories
    2. The <pre> Tag
    3. Oops, Here’s a New Story Coming Out!
      1. Important Lesson
  22. 17. How Do We Do a Test That We Can’t Do?
    1. We Need Better Customer Acceptance Tests
    2. Reviewing the Problem
    3. First Improvements
    4. Never Give Up...That Ship
    5. Test the Connection
    6. Wait! Wait, Wait, Wait!
  23. 18. A Simple Feature Teaches Some Lessons
    1. Shift Return Inside <pre> Tags
    2. Shift+Enter Test
      1. False Start Number One
      2. False Start Number Two
    3. New Plan
    4. Lessons Learned
      1. Programming by Intention
    5. Enough for Now
  24. 19. Dark Clouds on the Horizon
    1. We’re in Big Trouble, Guys!
    2. We Need a Test
    3. Yellow Bar
  25. 20. Finishing the Shift+Enter Story
    1. Wrapping Up the Job
      1. Isn’t This Against the Rules?
    2. What’s to Do?
    3. It Works—Now Let’s Test It
    4. Improving the Customer Acceptance Test
    5. All Done, for Now
  26. 21. Some Things We Ought to Do
    1. Command Pattern
    2. Adapter Pattern
    3. Mediator Pattern
    4. Small Boy with a Patterns Book
    5. Deriving a File Class
    6. Rendering the Text More Effectively
      1. Use RichTextBox Instead of TextBox
      2. Keeping the XML Correct
      3. Protect the Tags
      4. Verify the Structure
      5. TextModel as a Tree
    7. XML Support in .NET
    8. What’s the Plan?
      1. Customer Schedules Learning Stories
      2. Manager Schedules Learning Time
      3. Programmer Schedules Learning Time
    9. Yes, But What’s the Plan?
  27. 22. The Delegate from Troy
    1. Finding a Pair and Something to Do
    2. A Little Refactoring
    3. Add Duplication to Reduce Duplication
    4. Summing Up
      1. Was This a Righteous Change?
      2. How Was the Pairing?
      3. What’s Left to Do?
      4. One Last Thing
  28. 23. Planning Interlude
    1. How Do We Plan to Meet a Deadline
    2. Proposed Stories
    3. What About These Estimates?
    4. Our Plan
  29. 24. File Save and Load
    1. First the Functionality
    2. Now the Menus
    3. Show the Bug, Fix the Bug
    4. My Cunning Plan
    5. Finishing Up
    6. Reflection
    7. The XML Notepad Form
  30. 25. Tagging Along
    1. Setting Direction
    2. The Basic Approach
    3. The Actual Work
    4. Improving the Platform
    5. sbBegin with a Test
    6. Enter the List Item
    7. What’s the Opposite of Simple?
    8. We Have to Do Something
    9. Some Starting Ideas
      1. XMLNotepad.cs
    10. Removing the Duplication
    11. Moving Responsibility
    12. A Bit More Cleanup
    13. Reflection
    14. Ordered List
    15. The Code at This Point
      1. XNLNotepad.cs
      2. TextModel.cs
      3. TestTextModel.cs
      4. CustomerTests.cs
    16. Selected Customer Tests
      1. saveload.test
      2. insertOL.test
      3. insertAfterPara.test
      4. insertPara.test
      5. InsertPre.test
      6. insertUL.test
      7. paraAfterPara.test
  31. 26. Menu Arrays
    1. The Pain
    2. The Plan
    3. Menu Array
    4. The Table
    5. Reviewing Where We Are
    6. TextModel Code
  32. 27. Displaying the Article
    1. Today’s Process
    2. Possibilities
    3. Research and Experimentation
      1. Explorer Pane in Microsoft .NET
      2. Launch a Browser
    4. Serendipity Strikes
      1. This Is Really Cool!
    5. Am I Cheating?
    6. The Power of Reflection
    7. Now the Sky Is Clear
    8. And Then, as if by Magic
    9. What’s Next?
  33. 28. Oh No! Undo!
    1. The Final Exam
    2. The Requirement
    3. Possible Solutions
    4. What About Tests?
    5. Begin with a Test
    6. Using TextModel as the Saved Object
    7. Snapshot Every Time
    8. Building It In
    9. Removing the Experiments
    10. It Gets Weird for a Moment
    11. Are We There Yet?
    12. Review of What Has Happened So Far
    13. The Big Picture
    14. Does This Prove Anything?
  34. 29. The Final Optimized Undo
    1. Deciding to Begin Again
    2. Clearing a Space to Work
    3. A New Idea
    4. A Minor Setback on the Way to Success
    5. Further Optimizations Are Possible
    6. Summing Up Undo
  35. 30. The Long Dark Teatime of the Soul
    1. Recollection
    2. A Repeated Mistake
    3. Playing With Pain
    4. Design Thinking
    5. Experiments Without Tests
    6. An Initial Attempt
    7. A Second Attempt and a Big Mistake
    8. The Third Attempt
    9. First-Take Excerpt: The Stench of Death
  36. 31. Project Retrospective
    1. Learning from the Past
    2. Could We Put This Program into Production?
    3. The Value of Real Customers
    4. Customer Tests
    5. Pair Programming
    6. Trends over Time
    7. Are the Tests Helping Us?
    8. Are the Objects Helping Us?
    9. Did Our Tests and Objects Help Us Enough?
    10. Eat Your Own Dog Food
    11. Code Manager
    12. Coding Standard
    13. Be Ready to Use Advanced Facilities
    14. Is TextModel Too Large?
    15. Premature Optimization
    16. Responding to Pressure
    17. Pressure and Productivity
    18. Pressure and Quality
    19. Debugging Techniques
    20. Design and Code Quality
    21. Would "More Design" Have Helped?
    22. Smaller Questions
    23. The Effect of Illness
    24. Does Incremental Development Work?
  37. Sound Bites
    1. Are the objects helping us? (Chapter 31, page 482)
    2. Are the tests helping us? (Chapter 31, page 481)
    3. Automated tests record our intelligence for later! (Chapter 5, page 65)
    4. Begin with a test. (Chapter 25, page 323)
    5. Build simple scaffolding and then improve it. (Chapter 17, page 216)
    6. Card, Conversation, Confirmation. (Chapter 6, pages 71-72)
    7. Daily builds are for wimps. (Extreme Programming, page xxix)
    8. Design all the time. (Chapter 1, page 8)
    9. Don’t fall in love with our own work
    10. End to end is further than you think. (Chapter 13, page 182)
    11. Expressing Intention. (Chapter 4, page 42)
    12. Fake it before you make it. Fake it till you make it. (Chapter 11, page 146)
    13. Find a bug, write a test. (Chapter 5, page 58)
    14. Infrastructure doesn’t please the customer; features do. (Chapter 30, page 472)
    15. Isolate the unknown
    16. It’s Chet’s fault. (Chapter 11, page 139)
    17. Keep the tests on green. (Chapter 17, page 213)
    18. Make it work; make it right; make it fast. (Chapter 17, page 215)
    19. Outer design should drive inner design, always. (Chapter 30, page 473)
    20. Programming without thinking...what good is that? (Chapter 30, page 473)
    21. Push a little when something seems too hard. (Chapter 17, page 216)
    22. Reflect on how things are going. (Chapter 30, page 469)
    23. Removing duplication is your friend. (Chapter 11, page 151)
    24. Solve what you know; leave the parts you don’t know for later. (Chapter 6, page 78)
    25. Some very simple refactoring...has done most of the job for us. (Chapter 22, page 268)
    26. Start a new path with something abysmally simple. (Chapter 4, page 45)
    27. The story’s not done until the customer tests run. (Chapter 6, page 72)
    28. Twenty lines without a successful test is a pretty big change! (Chapter 4, page 45)
    29. Two Hats. (Chapter 8, page 95)
    30. We don’t need a testing framework; we need tests. (Chapter 6, page 73)
    31. We start new features with large bold strokes. We’re intentionally building from rough toward smooth. (Chapter 4, page 47)
    32. What is the simplest thing that could possibly work? Do the simplest thing that could possibly work. (Chapter 28, page 408)
    33. YAGNI—You Aren’t Gonna Need It. (Chapter 14, page 192)
  38. Bibliography
  39. Ron Jeffries
  40. Index
  41. About the Author
  42. Copyright