9.6 Wrapping Up
This chapter touches on the core of professional software engineering. Any gifted layman can use the WindowBuilder to create a nice small application for a specific purpose, but it takes much more foresight to create a software product that can grow and change with the demands of its users, that can be maintained for years and decades, and that delivers its functionality reliably throughout.
Nevertheless, the chapter may appear surprisingly long when we reduce its content to the two fundamental concepts: Model-view separation enables 9.1
9.2.2 testing to make the functionality reliable, and it liberates that functionality from concerns about the ever-changing user interface. Undoable operations
9.5 are simply encapsulated as command objects, which are managed by a command processor.
The challenge in this chapter is not the concepts, but their faithful rendering in concrete software: It is just too simple to destroy the principles and all their benefits by seemingly minor glitches in the implementation. After all, cannot a single reference to a view be tolerated in the model if it 9.2.3 saves days of coding? Does it really matter if an observer interface is tailored to the user interface that we have to deliver in three days’ time? Cannot
9.4.3 repainting of changed data be much more efficient if the view remembers the changed data elements?
Professional developers know two things that will prevent them from falling into such traps. First, the extra effort of introducing model-view 9.4
9.5.3 separation is rather extensive, but it is also predictable. Going through a series of well-known and well-rehearsed steps is psychologically less taxing than grappling with an endless list of poorly understood details. Second, they know the motivation behind all of those steps and see the necessity and implications of each. As a result, they perceive a proper overall structure as a necessary investment in achieving their future goals more easily. Both points together—the following of known steps and the understanding of implications—also enable professionals to be sure of their details, such as when recreating the previous and subsequent states in a command’s undo()
9.5.1 and redo() methods very precisely, if necessary by reasoning in detail about
4.1
4.2.2 the contracts of invoked model operations. This chapter has introduced the landmarks for proceeding with forethought in this way.