Press Releases
Achieving Understandable, Readable, Maintainable Code with Minimal Refactoring O'Reilly Releases "Prefactoring"
Tuesday, 11 October 2005 14:06 ESTSebastopol, CA--More often than not, developers will stop a large project in the middle of the build stage to rethink and recode the software design to make it cleaner and more efficient. Known as "refactoring "(a term popularized by Martin Fowler in his book, "Refactoring: Improving the Design of Existing Code"), this process can eat up time and money. Refactoring is done for a variety of reasons: to facilitate the addition of new features, to improve maintainability, or to increase performance.
It generally refers to the practice of altering code to improve its internal structure without changing its external behavior. "Prefactoring," on the other hand, is the art of applying the insights gleaned from previous experience (whether yours or someone else's) to new projects. It's based on the premise that you're better off considering the best possible design patterns before beginning a project.
In his new book, "Prefactoring" (O'Reilly, US $29.95), author Ken Pugh shares practices and guidelines derived from his own experiences and those of many other developers. These guidelines make explicit the considerations that good developers implicitly make in their designs.
"Take these guidelines as a starting point to developing your own," Pugh advises readers. "Many of the guidelines explored in the book relate to basic design principles, but they are expressed in different fashions. Other guidelines revolve around the concepts of Extreme Abstraction, Extreme Separation, and Extreme Readability."
According to Pugh, these three "extremes" parallel some of the ideas in Extreme Programming. For instance, if abstraction is good, Extreme Abstraction is better. If separation of concerns is good, Extreme Separation is better. Says Pugh, "Many of the guidelines present an extreme position so you can differentiate it from your current practices. You might wind up finding your own in-between position that balances the tradeoffs in a manner appropriate to your situation."
Presented through the development of both a hypothetical software project and a real-world project, some of the guidelines in "Prefactoring" include:
-When You're Abstract, Be Abstract All the Way Splitters Can be Lumped Easier Than Lumpers Can be Split -Do a Little Job Well and You May Be Called Upon Often -Plan Globally, Develop Locally Communicate with Your Code -The Easiest Code to Debug Is That Which is Not Written -Use the Client's Language -Don't Let the Cold Air In -Never Be Silent -Don't Speed Until You Know Where You Are Going
"Applying the guidelines in the book does not guarantee that you will never need to refactor your design or code," Pugh explains. "You might decrease the amount of refactoring that is required. Can you foresee everything? No. Are the decisions you make today final? No. It's practically impossible to think of everything or know everything in the beginning of a project. However, you can use your experience and the experiences of others to guide you in a certain direction. You can make decisions today that might minimize changes tomorrow."
"Prefactoring" will appeal to readers who understand the basic concepts of object-oriented design. It assumes that the reader has some familiarity with the basic Unified Modeling Language (UML) diagrams, as well as some knowledge of an object-oriented language, such as Java, C++, C#, Ruby, or Python.
The guidelines in "Prefactoring" will help developers make decisions that minimize the amount of refactoring to be done later. To the extent that they can think ahead and anticipate change--that is, prefactor their code--they'll be more productive.
Additional Resources:
Chapter 2, "The System in So Many Words," is available online at:
http://www.oreilly.com/catalog/prefactoring/chapter/index.html
For more information about the book, including table of contents, index, author bio, and samples, see:
http://www.oreilly.com/catalog/prefactoring/
For a cover graphic in JPEG format, go to:
ftp://ftp.ora.com/pub/graphics/book_covers/hi-res/0.jpg
Prefactoring
Ken Pugh
ISBN: 0-596-00874-0, 220 pages, $29.95 US, $41.95 CA
http://www.oreilly.com
1005 Gravenstein Highway North
Sebastopol, CA 95472
About O'Reilly
O'Reilly Media, Inc. is the premier information source for leading-edge computer technologies. The company's books, conferences, and web sites bring to light the knowledge of technology innovators. O'Reilly books, known for the animals on their covers, occupy a treasured place on the shelves of the developers building the next generation of software. O'Reilly conferences and summits bring alpha geeks and forward-thinking business leaders together to shape the revolutionary ideas that spark new industries. From the Internet to XML, open source, .NET, Java, and web services, O'Reilly puts technologies on the map. For more information: http://www.oreilly.com