Frameworks written in Java typically have a number of interfaces that are natural extension points. This Java tip shows you how to implement a framework using property files and dynamic class loading that allows extensions. The resulting framework enables both objects and classes to be added dynamically without touching the framework source code. A simple example is provided that illustrates the benefits and drawbacks of this solution. Example problem Booking resources is a common problem in different domains.
Offices have systems to book conference rooms.
Car rental companies have systems for reserving cars. And the system for borrowing books from the library is very similar to the system for booking a conference room or reserving a car. I will present a simple booking framework that can be used in all such situations. The framework has two interfaces, Bookable and BookableStorage , and one coordinating class, Booker . It is the responsibility of the Bookable object, shown below, to keep track of its own bookings and decide whether booking requests can be met.