Refactoring to Facade

A facade provides an interface, but it does not use a Java interface. Rather, a facade is a class with methods that make it easy to use the classes in a subsystem.

Consider an example from the early days at Oozinoz, when there were not yet standards for GUI development. Suppose that you come across an application that a developer has created to show the flight path of an unexploded shell. Figure 4.1 shows this class. As before, the underscore in the name of the FlightPanel_1 class is a hint that this class, from com.oozinoz.applications, needs refactoring.

Figure 4.1. The FlightPanel_1 class displays the flight path of an unexploded shell.

Aerial shells are designed to explode high in the sky, with spectacular results. But ...

Get Design Patterns Java™ Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.