O'Reilly logo

Prefactoring by Ken Pugh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1.3. The Guidelines Explored

Our goal as developers is to make understandable, readable, and maintainable code. The guidelines in this book are designed to help you reach this goal. The guidelines presented in this book do not represent best practices. "Best" can be determined only in the context in which you are currently developing a system. However, the guidelines do represent suggestions for creating good practices appropriate to your context.

EXCEPTIONAL GUIDELINE

There are exceptions to every guideline, except this one.

Many of the guidelines are different manifestations of the same basic principles. The underlying principles have tradeoffs in their application, which also appear in the derived guidelines. For example, applying the principle of separation of concerns usually creates more classes and more methods. Consistency, even though it might increase the amount of code, also makes systems that do similar things have the same structure, thus decreasing learning. A concentration on interfaces and delegation increases the number of delegating methods.

1.3.1. Context Is Everything

One rule exists: nothing works everywhere, and hence, you must be the judge if a particular practice is appropriate for your application. You need to apply principles in context . The decision whether to use a particular principle or practice depends on the situation in which it is employed. When you try to apply the same principle or style to everything, you can create waste or confusion. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required