Tag Archives: author

Refactoring Workbook

Premise

"Refactoring improves through practice."

The Refactoring Workbook contains exercises to help you assess and improve your ability to refactor (Java, but close enough for C# too). It's available now from Amazon.com.

Thanks to those who reviewed the drafts! If you like the book, please consider posting a review at Amazon or elsewhere.

Also available: Refactoring in Ruby, with Kevin Rutherford; it has its own website. We did an interview with InformIT too.

Table of Contents

Preface
Chapter 1 – Roadmap

Section 1 – Smells Within Classes
Chapter 2 – The Refactoring Cycle
Chapter 3 – Measured Smells  (Sample at java.net or at InformIT)
Interlude 1 – Smells and Refactorings

Chapter 4 – Names
Chapter 5 – Unnecessary Complexity
Interlude 2 – Inverses

Chapter 6 – Duplication
Chapter 7 – Conditional Logic
Interlude 3 – Design Patterns

Section 2 – Smells Between Classes
Chapter 8 – Data
Chapter 9 – Inheritance
Chapter 10 –Responsibility
Chapter 11 – Accommodating Change
Chapter 12 – Library Classes
Interlude 4 – Gen-A-Refactoring

Section 3 – Programs to Refactor
Chapter 13 – A Database Example
Chapter 14 – A Simple Game
Chapter 15 – Catalog
Chapter 16– Planning Game Simulator
Chapter 17– Where to Go From Here
Bibliography

Appendices
Appendix A. Selected Answers
Appendix B. Java Refactoring Tools
Appendix C. Inverses for Refactorings
Appendix D. Key Refactorings
Inside Cover – Smells and Refactorings

Reviews

"As an occasional teacher of undergraduate programming courses, I think this book is worth its weight in platinum."–Gregory Wilson, Dr. Dobb's Journal, July 2004. Page 82.

Author

William Wake (William.Wake@acm.org, www.xp123.com) is a programmer, coach, and  author.

Source Code

File rwb.zip contains the source code for the longer examples in the book. (Updated Jan., 2014 to more modern Java and JUnit.)

Errata

  • Page 63. The Elements of Programming Style is by Brian W. Kernighan and P.J. Plauger, not Kernighan and Pike. (Thanks to Mike Cohn for spotting this.)
  • Page 121. The column names in the Offering table in the diagram don't match up to the names in the code. Change the getString() calls in Offering.find() to use columns "Name" and "DaysTimes". (Thanks to Glenn Boysko and Mohsen Akhavan for spotting this.)
  • Page 197. "hadMidScore" should be "hadMidRangeScore" in the code fragment:
      boolean hadMidRangeScore = (score > 500)
    (Thanks to Marco Isella for spotting this.)

Background Reading

More Resources

Review – Design Patterns in Java

Design Patterns in Java. Steve Metsker and William C. Wake. Addison-Wesley, 2006. I won’t review my own book, but I will summarize:

This is a workbook-style book, updating Steve’s earlier Design Patterns Java Workbook and Design Patterns in C#. It covers the same 23 patterns as Design Patterns, but adds some different perspective and a number of challenges to help you make sure you understand the patterns. It’s targeted to intermediate programmers, though more advanced programmers who want to brush up on patterns might consider it also. (May, ’06)

Review – Refactoring Workbook

Refactoring Workbook, William Wake. Addison-Wesley, 2003.

[Consider this a summary rather than a review my own book.] My goals were to create a workbook that helps people practice recognizing smells (problems) and learn to apply important refactoring techniques. There's a "smell finder" inside the covers to help lead you from symptoms to solutions. The table of contents and the book's home page are here.
(April, '06)

Extreme Programming Explored

 

Extreme Programming Explored Extreme Programming Explored, by William C. Wake. Addison-Wesley, 2001. Foreword by Dave Thomas (The Pragmatic Programmer).

This book grew out of the XPlorations series of articles. I wrote them as I was learning XP, and relating it to my own experience and practices.

Availability

The best version is the book itself. It reflects the feedback of reviewers and editors. You can purchase it somewhere like Amazon.com.

The XPlorations series continues to grow. 

Table of Contents

Preface

Chapter 1. Introducing XP…………………………………….1
Programming, team practices, and processes.

Section 1: Programming

Chapter 2. How do you program in XP?…………..11
XP uses incremental, test-first programming.

Chapter 3. What is refactoring?………………………….29
"Refactoring: Improving the design of existing code."
–Martin Fowler

Section 2: Team Practices

Chapter 4. What are XP’s team practices?………51
We’ll explore these practices and their alternatives.

Chapter 5. What’s it like to program in pairs?..65
Pair programming is exhausting but productive.

Chapter 6. Where’s the architecture?………………..77
Architecture shows up in spikes, the metaphor, the first iteration, and elsewhere.

Chapter 7. What is the system metaphor?………..87
"The system metaphor is a story that everyone–customers, programmers, and managers–can tell about how the system works."
–Kent Beck

Section 3: Process

Chapter 8. How do you plan a release?
What are stories like?
………………………………….101
Write stories, estimate stories, and prioritize stories.

Chapter 9. How do you plan an iteration?……..115
Iteration planning can be thought of as a board game.

Chapter 10. Customer, Programmer, Manager:
What’s a typical day?
………………..125
Customer: questions, tests, and steering;
Programmer: testing, coding, and refactoring; [without cube]
Manager: project manager, tracker, and coach.

 
Chapter 11. Conclusion………………………………………..143

Chapter 12. Annotated Bibliography………………….145