This project aim to learn Open closed principle and Design patterns
Imaginary Big Building Corporation is a property management company in Hong Kong. The company manages various kinds of buildings from overseas whose owners are people from Hong Kong. The company plans to develop a building management system (BMS) for maintaining different kinds of building records. The following is the simplified class diagram of existing data maintained by the company
As a system analyst of the Company, you are required to design and develop BMS. You are reminded that the design of the existing classes: Building, Apartment, House and Room must be kept unchanged. MS should provide the following functions:
- Create a building record (Apartment, House or any new kind of Building in the coming future).
- Modify a building record (Apartment, House or any new kind of Building in the coming future)
- Display Building details (such as building id, corresponding attributes and rooms) by a given building id (input building id=* to display all building records)
- Add, update or delete rooms in a building record
- Undo last command
- Redo the last undone command
- Show undo/redo list
Your system design should conform to the Open Closed Principle so that your design should easily be extended to support new building (e.g. Warehouse or Shop).
You MUST apply the following design patterns for your new system
Command pattern to provide the “add building”, “display buildings”, “modify building”, “add room”, "delete room", "modify room", “undo”, “redo” and “list undo/redo list” functions
Factory pattern or Abstract Factory Pattern to create different kinds of Command objects and different kinds of Building objects (e.g. Apartment object, House object, etc.)
Memento pattern to provide “Undo” and “Redo” functions on "modify building" and "modify room"