Skip to Main Content
Prefactoring
book

Prefactoring

by Ken Pugh
September 2005
Intermediate to advanced content levelIntermediate to advanced
240 pages
6h 28m
English
O'Reilly Media, Inc.
Content preview from Prefactoring

8.4. Operations Interface

The com.samscdrental.controller package implements the CD rental system's operational interface via the following classes:

    MaintenanceOperations.java
    RentalOperations.java
    ReportOperations.java

Tim and I added three operation classes to the model: RentalOperations, MaintenanceOperations, and ReportOperations. The methods in these classes represent the operations that can be requested by either the GUI or a test program. The class names use the term Operations rather than Command or Controller, since those terms have more existing connotations (e.g., the Command pattern and the Model-View-Controller pattern).

These operation classes are façades on the system's entire inner structure. They make a clean breaking point between the display and the model (see "Separating Concerns Makes Smaller Concerns"). Each operation on the user interface is represented in one of these façades. Each façade corresponds to different sets of user interactions that represent different types of users.

The RentalOperations class contains operations related to rentals: checkinCDDisc( ) and checkoutCDDisc( ). MaintenanceOperations contains the operations related to reading data from files into the collections. ReportOperations deals with report creation.

The methods in these façades declare their parameters as abstract data types (ADTs). This requires the GUI to convert an input string to the corresponding ADT before passing it to a method. Each ADT has a method that converts ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Understanding Unittest.Mock

Understanding Unittest.Mock

Mario Corchero
Java™ Performance

Java™ Performance

Charlie Hunt, Binu John

Publisher Resources

ISBN: 0596008740Supplemental ContentCatalog PageErrata