This project is based on the AddressBook-Level3 project by the SE-EDU initiative. KrustyKrab uses the following libraries: JavaFX, Jackson, JUnit5.
Refer to the guide Setting up and getting started.
The Architecture Diagram given above explains the high-level design of the App.
Given below is a quick overview of main components and how they interact with each other.
Main components of the architecture
Main (consisting of classes Main and MainApp) is in charge of the app launch and shut down.
The bulk of the app's work is done by the following four components:
UI: The UI of the App.Logic: The command executor.Model: Holds the data of the App in memory.Storage: Reads data from, and writes data to, the hard disk.Commons represents a collection of classes used by multiple other components.
How the architecture components interact with each other
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command pdelete 1.
Each of the four main components (also shown in the diagram above),
interface with the same name as the Component.{Component Name}Manager class (which follows the corresponding API interface mentioned in the previous point.For example, the Logic component defines its API in the Logic.java interface and implements its functionality using the LogicManager.java class which follows the Logic interface. Other components interact with a given component through its interface rather than the concrete class (reason: to prevent outside component's being coupled to the implementation of a component), as illustrated in the (partial) class diagram below.
The sections below give more details of each component.
The API of this component is specified in Ui.java
The UI consists of a MainWindow that is made up of parts e.g.CommandBox, ResultDisplay, PersonListPanel, BookingListPanel, StatusBarFooter etc. All these, including the MainWindow, inherit from the abstract UiPart class which captures the commonalities between classes that represent parts of the visible GUI.
The UI component uses the JavaFx UI framework. The layout of these UI parts are defined in matching .fxml files that are in the src/main/resources/view folder. For example, the layout of the MainWindow is specified in MainWindow.fxml
The UI component,
Logic component.Model data so that the UI can be updated with the modified data.Logic component, because the UI relies on the Logic to execute commands.Model component, as it displays Person and Booking objects residing in the Model.API : Logic.java
Here's a (partial) class diagram of the Logic component:
The sequence diagram below illustrates the interactions within the Logic component, taking execute("pdelete 1") API call as an example.
Note: The lifeline for DeletePersonCommandParser should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
How the Logic component works:
Logic is called upon to execute a command, it is passed to an AddressBookParser object which in turn creates a parser that matches the command (e.g., DeletePersonCommandParser) and uses it to parse the command.Command object (more precisely, an object of one of its subclasses e.g., DeletePersonCommand) which is executed by the LogicManager.Model when it is executed (e.g. to delete a person).Model) to achieve.CommandResult object which is returned back from Logic.Here are the other classes in Logic (omitted from the class diagram above) that are used for parsing a user command:
How the parsing works:
AddressBookParser class creates an XYZCommandParser (XYZ is a placeholder for the specific command name e.g., AddPersonCommandParser) which uses the other classes shown above to parse the user command and create a XYZCommand object (e.g., AddPersonCommand) which the AddressBookParser returns back as a Command object.XYZCommandParser classes (e.g., AddPersonCommandParser, DeletePersonCommandParser, ...) inherit from the Parser interface so that they can be treated similarly where possible e.g, during testing.API : Model.java
The Model component,
Person objects (which are contained in a UniquePersonList object).Person objects (e.g., results of a search query) as a separate filtered list which is exposed to outsiders as an unmodifiable ObservableList<Person> that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.Booking objects (e.g., results of a filter predicate) as a similar separate filtered list which is exposed to outsiders as an unmodifiable ObservableList<Booking> that can be 'observed'.UserPref object that represents the user’s preferences. This is exposed to the outside as a ReadOnlyUserPref objects.Model represents data entities of the domain, they should make sense on their own without depending on other components)API : Storage.java
The Storage component,
AddressBookStorage and UserPrefStorage, which means it can be treated as either one (if only the functionality of only one is needed).Model component (because the Storage component's job is to save/retrieve objects that belong to the Model)Classes used by multiple components are in the seedu.address.commons package.
This section describes some noteworthy details on how certain features are implemented.
The Booking class is a class under the Model component. It is used to represent a booking made by a person. The class contains the following fields:
bookingId - a unique identifier for the booking.bookingPerson - the person who made the booking.bookingDateTime - the date and time of the booking.bookingMadeDateTime - the date and time at which the booking was made.status - the status of the booking (e.g., Upcoming, Completed, Cancelled).pax - the number of people for the booking.remark - any remarks made by the customer.Persons and bookings have a one-to-many relationship, where a person can have multiple bookings, but each booking only has one person attached to it as the person who made the booking.
As such:
Booking class contains a reference to the Person class, which represents the person who made the booking.bookingIds field that contains a list of booking IDs linked to the booking's bookingId field, which are unique identifiers for each booking made by the person.Bookings are stored in the UniqueBookingList class, which is a list of unique bookings utilising a HashSet for quick retrieval of Booking Objects by BookingId, and it ensures that no two bookings with the same booking ID exist in the list.
The UniqueBookingList class provides methods to add, delete, and search for bookings. It also provides methods to filter bookings by date and time, and to sort bookings by date and time, all separate from the list of persons represented by UniquePersonsList.
Aspect: Storing list of bookings:
Aspect: Linking bookings to person:
Person class occupies less space in memory.
Easier to save to JSON file.The storage component is responsible for saving and loading the address book data and user preferences. It uses the Jackson library to convert Java objects to JSON format and vice versa. The implementation of Storage is based off AddressBook-Level3, with the following changes:
AddressBookStorage interface has been modified to include methods for saving and loading bookings.JsonAddressBookStorage class has been modified to include methods for saving and loading bookings.JsonAdaptedBooking class has been added to convert Booking objects to and from JSON format.JsonAdaptedPerson class has been modified to include a list of booking IDs for each person.JsonSerializableAddressBook class has been modified to include a list of bookings.Storage is updated at every change to the address book, and the StorageManager class is responsible for managing the storage of both the address book and user preferences. The StorageManager class implements the Storage interface and uses the JsonAddressBookStorage and JsonUserPrefStorage classes to read and write data.
Given below is a class diagram of the Storage component:
Aspect: Storing list of bookings:
Aspect: Linking bookings to person:
Booking object is tied to a Person object by its ID.The proposed undo/redo mechanism is facilitated by VersionedAddressBook. It extends AddressBook with an undo/redo history, stored internally as an addressBookStateList and currentStatePointer. Additionally, it implements the following operations:
VersionedAddressBook#commit() — Saves the current address book state in its history.VersionedAddressBook#undo() — Restores the previous address book state from its history.VersionedAddressBook#redo() — Restores a previously undone address book state from its history.These operations are exposed in the Model interface as Model#commitAddressBook(), Model#undoAddressBook() and Model#redoAddressBook() respectively.
Given below is an example usage scenario and how the undo/redo mechanism behaves at each step.
Step 1. The user launches the application for the first time. The VersionedAddressBook will be initialized with the initial address book state, and the currentStatePointer pointing to that single address book state.
Step 2. The user executes pdelete 5 command to delete the 5th person in the address book. The delete command calls Model#commitAddressBook(), causing the modified state of the address book after the pdelete 5 command executes to be saved in the addressBookStateList, and the currentStatePointer is shifted to the newly inserted address book state.
Step 3. The user executes padd n/David … to add a new person. The padd command also calls Model#commitAddressBook(), causing another modified address book state to be saved into the addressBookStateList.
Note: If a command fails its execution, it will not call Model#commitAddressBook(), so the address book state will not be saved into the addressBookStateList.
Step 4. The user now decides that adding the person was a mistake, and decides to undo that action by executing the undo command. The undo command will call Model#undoAddressBook(), which will shift the currentStatePointer once to the left, pointing it to the previous address book state, and restores the address book to that state.
Note: If the currentStatePointer is at index 0, pointing to the initial AddressBook state, then there are no previous AddressBook states to restore. The undo command uses Model#canUndoAddressBook() to check if this is the case. If so, it will return an error to the user rather
than attempting to perform the undo.
The following sequence diagram shows how an undo operation goes through the Logic component:
Note: The lifeline for UndoCommand should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
Similarly, how an undo operation goes through the Model component is shown below:
The redo command does the opposite — it calls Model#redoAddressBook(), which shifts the currentStatePointer once to the right, pointing to the previously undone state, and restores the address book to that state.
Note: If the currentStatePointer is at index addressBookStateList.size() - 1, pointing to the latest address book state, then there are no undone AddressBook states to restore. The redo command uses Model#canRedoAddressBook() to check if this is the case. If so, it will return an error to the user rather than attempting to perform the redo.
Step 5. The user then decides to execute the command list. Commands that do not modify the address book, such as list, will usually not call Model#commitAddressBook(), Model#undoAddressBook() or Model#redoAddressBook(). Thus, the addressBookStateList remains unchanged.
Step 6. The user executes clear, which calls Model#commitAddressBook(). Since the currentStatePointer is not pointing at the end of the addressBookStateList, all address book states after the currentStatePointer will be purged. Reason: It no longer makes sense to redo the add n/David … command. This is the behavior that most modern desktop applications follow.
The following activity diagram summarizes what happens when a user executes a new command:
Aspect: How undo & redo executes:
pdelete, just save the person being deleted).{more aspects and alternatives to be added}
The proposed data archiving feature is designed to allow users to archive old bookings, which can help in managing the address book more efficiently. Implementation to be discussed for future revisions.
Target user profile:
Value proposition:
Priorities: High (must have) - * * *, Medium (nice to have) - * *, Low (unlikely to have) - *
| Priority | As a … | I want to … | So that I can… |
|---|---|---|---|
* * * | restaurant staff | add a new booking with customer details | keep track of upcoming reservations |
* * * | restaurant staff | delete a booking | remove cancellations or incorrect entries |
* * * | restaurant staff | view a list of all upcoming bookings | quickly see my schedule |
* * * | restaurant staff | mark a booking as completed | keep track of which customers have visited |
* * * | restaurant staff | add notes to a customer profile | remember preferences like seating choices, allergies, etc. |
* * * | restaurant staff | search for a booking using a customer’s name or phone number | quickly find their reservation details |
* * * | restaurant staff | save a new customer’s contact information | quickly find their details for future bookings |
* * * | restaurant staff | edit a customer’s contact details | update incorrect or outdated information |
* * * | restaurant staff | delete customer's contact details | maintain an updated list |
* * * | restaurant staff | store data offline | keep all information for future use and tracking |
* * * | restaurant staff | view all upcoming bookings | prepare for each day |
* * | restaurant staff | delete all completed bookings | clear unnecessary backlogs |
* * | restaurant staff | edit an existing booking | update details when a customer changes their reservation |
* * | restaurant staff | sort bookings by date or time | find what I need quickly |
* * | restaurant staff | filter bookings by date | see only the relevant reservations |
* * | restaurant staff | view a customer’s past booking history | provide a more personalized experience |
* * | restaurant staff | view a summary of today’s bookings on the homepage | see important details at a glance |
* * | restaurant staff | tag members | provide them with special perks or greetings |
* | restaurant staff | validate emails | ensure they are in the correct input format |
(For all use cases below, the System is KrustyKrab and the Actor is the user, unless specified otherwise)
MSS
Use case ends.
Extensions
1a. Invalid input (e.g., empty name, invalid email format, invalid phone number).
1b. Person with the same phone number already exists.
MSS
Use case ends.
Extensions
MSS
Use case ends.
Extensions
MSS
Use case ends.
MSS
Use case ends.
Extensions
MSS
Use case ends.
Extensions
2a. Person not found.
3a. Invalid booking data (e.g., negative pax, wrong date format).
MSS
Use case ends.
Extensions
MSS
Use case ends.
Extensions
MSS
Use case ends.
Extensions
MSS
Use case ends.
Extensions
/all flag.
MSS
Use case ends.
Extensions
MSS
Use case ends.
Extensions
MSS
Use case ends.
MSS
Use case ends.
MSS
Use case ends.
17 or above installed.{More to be added}
Team size: 5
//@@author isawangyx-reused
//Reused from https://ay2425s1-cs2103t-t08-2.github.io/tp/DeveloperGuide.html
// with minor modifications
Difficulty level:
Our project was significantly more complex compared to AB3. We introduced various new commands to support additional functionalities. The Person objects now include more fields, with certain fields ('BookingIds') requiring syncing to the Booking objects. The UI has also become more complicated, with the introduction of two split panes that reflect Person and Booking data simultaneously.
//@@author isawangyx-reused //Reused from https://ay2425s2-cs2103t-t13-4.github.io/tp/DeveloperGuide.html // with minor modifications to relate to our app Challenges faced:
//@@author isawangyx-reused //Reused from https://ay2425s2-cs2103t-t13-4.github.io/tp/DeveloperGuide.html // with minor modifications to the specific hours spent Effort required:
//@@author isawangyx-reused //Reused from https://ay2425s1-cs2103t-t08-2.github.io/tp/DeveloperGuide.html // with minor modifications Achievements: We have extended AB3 with multiple new features and a better UI, to make the app more specialised and suitable for restaurant staff.
Given below are instructions to test the app manually.
Note: These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing.
Initial launch
Saving window preferences
{ more test cases … }
Deleting a person while all persons are being shown
Prerequisites: List all persons using the plist command. Multiple persons in the list.
Test case: pdelete 1
Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated.
Test case: pdelete 0
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.
Other incorrect delete commands to try: pdelete, pdelete x, ... (where x is larger than the list size)
Expected: Similar to previous.
{ more test cases … }
Normal saving and loading
exit or simply close the app.plist and blist /all.Dealing with missing/corrupted data files