October 10, 2005
Prefactoring: Achieving Understandable, Readable, Maintainable Code with Minimal Refactoring
Sebastopol, 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
-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
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.
ISBN: 0-596-00874-0, 220 pages, $29.95 US, $41.95 CA
O'Reilly Media spreads the knowledge of innovators through its books, online services, magazines, and conferences. Since 1978, O'Reilly Media has been a chronicler and catalyst of cutting-edge development, homing in on the technology trends that really matter and spurring their adoption by amplifying "faint signals" from the alpha geeks who are creating the future. An active participant in the technology community, the company has a long history of advocacy, meme-making, and evangelism.
Return to: O'Reilly Press Room
Recent Press Releases
Press Release Archive »
Media Relations - North America & Conferences
Media Relations - Germany
Media Relations - Japan
Media Relations - United Kingdom