|註冊 | 登入 | 全文檢索 | 排行榜|
» Software Design
» Design Pattern
列印話題 寄給朋友 訂閱主題
GoodHealth Fitness Corporation is a large fitness club. It provides state-of-the-art equipment to its members to use. The company maintains a membership system for recording members’ information and prepaid hours for using the club’s facilities. Recently, GoodHealth plans to acquire GreenFitness Limited which is a small fitness club. After the acquisition, GrantFitness Corporation is established to manage the business operation of GoodHealth Fitness Corporation and GreenFitness Limited.
GoodHealth uses a class called “MemberCare” to manage the member records. The system has the following basic methods to support the daily operations.
1. createMember ( ) to create a Member object with zero prepaid hours
2. searchMember ( ) to search a Member object by id
3. remove ( ) to remove a Member object by id
4. changePhoneNumber ( ) to update the phone number of a Member object
5. addPrepaidHours ( ) to add the given hours to a Member object
6. usePrepaidHours ( ) to deduct the given hours from a Member object
GreenFitness uses a class called “ClientControl” to manage the client records. The system has the following basic methods to support the daily operations. 1. createClient ( ) to create a Client object with zero remaining hours
findClient ( ) to search a Client object by cid
deleteClient ( ) to remove a Client object by cid
updateContactNumber() to update the contact phone number of a Client object
addHours ( ) to add the given hours to a Client object
deductHours () to deduct the given hours from a Client object
The followings are the simplified class diagrams of the existing systems for your reference.
As a system analyst of the GrantFitness Corporation, you are required to support the system integration. You are asked to design and develop the GrantFitness System for integrating the classes in the existing two systems. You are reminded that the design of the existing classes: MemberCare, Member, ClientControl, and Client must be kept unchanged.
You should minimize the impact of future change on data structures and operations in both existing systems. However, your new system should integrate the operations with one common user interface. Moreover, GrantFitness may acquire other company in the future and your new system must support future integration.
The new system should provide the following functions:
1. Create a new member record for a new member in a company (GoodHealth, or GreenFitness, or any new company in the coming future)
2. Show member details (such as id/cid, name/cname, phoneNumber/contactNumber, prepaidHours/remainingHours) by a given id (input id=* to show all records)
3. Add/deduct hours to/from a member record
4. Update the phone number of a member record
5. Undo last command
6. Redo the last undone command
7. Show undo/redo list
Your system design should conform to the Open Closed Principle so that your design should easily support new functions, e.g. change the name of a member.
You MUST apply the following design patterns for your new system: Adapter pattern to support the operations between the two existing companies and the future integration for any new company acquired by GrantFitness Corporation.
**** Memento pattern to support “Undo” and “Redo” functions****
Extra Reference This sample run is served for reference only. You are free to design your own user interface.
how to do the adapter and Memento pattern
|» JWorld@TW » Software Design » Design Pattern|