Chapter 11. Refactoring web applications

 

This chapter covers:

  • 11.1 Refactoring in the real world 233
  • 11.2 Refactoring basics: readability and duplication 236
  • 11.3 Separating markup from program code 241
  • 11.4 Simplifying conditional expressions 253
  • 11.5 Refactoring from procedural to object-oriented 262
  • 11.6 Summary 267

You can’t know a town, neighborhood, or landscape well until you’ve been around it. You need to explore it to the point where most places are familiar to you. That means roaming most of the roads and streets. Just traversing it a couple of times is not enough.

You learn more if you’re on foot or on a bicycle. Traveling by car, even if you’re driving, you might forget where the slopes or even hills are located. When you’re foot-powered, you’re likely to remember the exact ups and downs.

A software design is a landscape of possibilities. If you take the time to explore them, you’re likely to learn something new every time.

In the real world, there is limited time for this. But refactoring opens up an opportunity. The obvious benefits of refactoring are improving the design and preventing it from deteriorating as a result of changes. The less obvious benefit is to allow us to explore and see the effect of different design approaches.

11.1. Refactoring in the real world

11.2. Refactoring basics: readability and duplication

11.3. Separating markup from program code

11.4. Simplifying conditional expressions

11.5. Refactoring from procedural to object-oriented

11.6. Summary