This project is based on the AddressBook-Level3 project by the SE-EDU initiative. KeyContacts 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 delete 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
, StudentListPanel
, 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 Student
object 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("delete 1")
API call as an example.
Note: The lifeline for DeleteCommandParser
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 KeyContactsParser
object which in turn creates a parser that matches the command (e.g., DeleteCommandParser
) and uses it to parse the command.Command
object (more precisely, an object of one of its subclasses e.g., DeleteCommand
) which is executed by the LogicManager
.Model
when it is executed (e.g. to delete a student).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:
KeyContactsParser
class creates an XYZCommandParser
(XYZ
is a placeholder for the specific command name e.g., AddCommandParser
) which uses the other classes shown above to parse the user command and create a XYZCommand
object (e.g., AddCommand
) which the KeyContactsParser
returns back as a Command
object.XYZCommandParser
classes (e.g., AddCommandParser
, DeleteCommandParser
, ...) inherit from the Parser
interface so that they can be treated similarly where possible e.g, during testing.API : Model.java
The Model
component,
StudentDirectory
objects (which each represent a single version of the student directory)Student
objects (e.g., results of a search query) as a separate filtered list which is exposed to outsiders as an unmodifiable ObservableList<Student>
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.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,
StudentDirectoryStorage
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 keycontacts.commons
package.
This section describes some noteworthy details on how certain features are implemented.
The undo/redo mechanism is facilitated by VersionedStudentDirectory
. It extends StudentDirectory
with an undo/redo history, stored internally as an studentDirectoryStateList
and currentStatePointer
. Additionally, it implements the following operations:
VersionedStudentDirectory#commit()
— Saves the current student directory state in its history.VersionedStudentDirectory#undo()
— Restores the previous student directory state from its history.VersionedStudentDirectory#redo()
— Restores a previously undone student directory state from its history.These operations are exposed in the Model
interface as Model#commitStudentDirectory()
, Model#undoStudentDirectory()
and Model#redoStudentDirectory()
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. The VersionedStudentDirectory
will be initialized with the initial student directory state, and the currentStatePointer
pointing to that single student directory state.
Step 2. The user executes delete 5
command to delete the 5th student in the student directory. The delete
calls Model#commitStudentDirectory()
, causing the modified state of the student directory after the delete 5
command executes to be saved in the studentDirectoryStateList
, and the currentStatePointer
is shifted to the newly inserted student directory state.
Step 3. The user executes add n/David …
to add a new student. The add
command calls Model#commitStudentDirectory()
, causing another modified student directory state to be saved into the studentDirectoryStateList
.
Note: If a command fails its execution, it will not call Model#commitStudentDirectory()
, so the student directory state will not be saved into the studentDirectoryStateList
.
Step 4. The user now decides that adding the student was a mistake, and decides to undo that action by executing the undo
command. The undo
command will call Model#undoStudentDirectory()
, which will shift the currentStatePointer
once to the left, pointing it to the previous student directory state, and restores the student directory to that state.
Note: If the currentStatePointer
is at index 0, pointing to the initial StudentDirectory state, then there are no previous StudentDirectory states to restore. The undo
command uses Model#canUndoStudentDirectory()
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#redoStudentDirectory()
, which shifts the currentStatePointer
once to the right, pointing to the previously undone state, and restores the student directory to that state.
Note: If the currentStatePointer
is at index studentDirectoryStateList.size() - 1
, pointing to the latest student directory state, then there are no undone StudentDirectory states to restore. The redo
command uses Model#canRedoStudentDirectory()
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 student directory, such as list
, will not call Model#commitStudentDirectory()
. Thus, the studentDirectoryStateList
remains unchanged.
Step 6. The user executes clear
, which calls Model#commitStudentDirectory()
. Since the currentStatePointer
is not pointing at the end of the studentDirectoryStateList
, all student directory 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:
Current: Saves the entire student directory.
Alternative: Individual command knows how to undo/redo by itself.
delete
, just save the student being deleted).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… |
---|---|---|---|
* * * | user | cancel a particular lesson session | account for student availability |
* * * | user | schedule a make-up lesson for students who missed | manage lesson rescheduling efficiently |
* * * | user | save a student’s lesson timing | know when I will meet them |
* * * | user | save the data and retrieve them after restarting the app | ensure my data is persistent |
* * * | user | view a list of all my students | keep track of all my students |
* * * | user | delete a student when they stop taking lessons | keep my records clean |
* * * | new user | view the list of commands | know what commands I can run |
* * * | user | add a piano piece to a student | track what piece they are working on |
* * * | user | save a student’s address | know where to travel for tutoring |
* * * | user | see the grade level of a student | tailor the lesson to their proficiency |
* * * | user | save a student's contact | easily contact them for tutoring |
* * * | user | undo my last command | revert the effects of a wrong command |
* * * | user | redo a command that I undid | revert the effects of a wrong undo |
* * | user | modify the details of each record | change particulars when needed |
* * | user | sort the students by personal particulars | find specific records easily |
* * | user | see students scheduled for a particular day | know my schedule for the day |
* * | user | search students based on personal particulars | locate a student efficiently |
* | user | export my student data to a CSV file | back up my records or share them with others |
* | user | track the purchase and sale of learning materials | manage inventory and ensure reimbursement |
* | user | generate reports on each student’s progress | share them with parents or guardians |
* | user | view a timetable for the week | prepare my schedule |
* | new user | receive prompts/suggestions when I type a command wrongly | get help using the system |
* | experienced user | use shortcuts/aliases for commands | perform common tasks faster |
* | user | group my students together if they are in the same class | view their information together |
* | user | track whether each student has paid for the month | collect my fees on time |
* | user | keep track of how much each student should pay for lessons | manage fees easier |
* | user | write down miscellaneous notes for each student | recall them before each lesson |
* | user | view a summary of my income for the month | track my earnings |
* | user | track attendance for each student | see how consistent they are with lessons |
* | user | track the progress of each student on their assigned pieces | monitor their improvement |
(For all use cases below, the System is KeyContacts
and the Actor is the user
, unless specified otherwise)
MSS
User requests to add a student, including their details.
KeyContacts adds the student and notifies the user.
Use case ends.
Extensions
MSS
User requests to edit a student with new data.
KeyContacts edits the student and notifies the user.
Use case ends.
Extensions
MSS
User requests to delete a student.
KeyContacts deletes the student from the list and notifies the user.
Use case ends.
Extensions
MSS
User requests clear the student directory.
KeyContacts clears the student directory.
Use case ends.
MSS
User requests to view a list of all students.
KeyContacts displays the list of students to the user.
Use case ends.
MSS
User requests to find a student, providing one or more search terms.
KeyContacts displays the students that fit the search term.
User scrolls through the displayed list to find the student they are looking for.
Use case ends.
Extensions
MSS
User requests to sort the students, providing the sorting details.
KeyContacts displays the students sorted in the given order.
Use case ends.
Extensions
MSS
User requests to schedule a student's regular lesson, including the day of the week, starting time and ending time.
KeyContacts schedules the regular lesson at the given day and time period for the student with the associated index and notifies the user.
Use case ends.
Extensions
MSS
User requests to assign piano pieces to a student.
KeyContacts assigns the piano pieces to the student and notifies the user.
Use case ends.
Extensions
MSS
User requests to unassign piano pieces from a student.
KeyContacts unassigns the piano pieces from the student and notifies the user.
Use case ends.
Extensions
MSS
User requests to view the calendar for a specified week.
KeyContacts displays the calendar view for the given week.
Use case ends.
Extensions
MSS
User requests to schedule a make-up lesson.
KeyContacts schedules the make-up lesson and notifies the user.
Use case ends.
Extensions
MSS
User requests to cancel a lesson session.
KeyContacts cancels the lesson session and notifies the user.
Use case ends.
Extensions
MSS
User requests to uncancel a lesson session.
KeyContacts uncancels the lesson session and notifies the user.
Use case ends.
Extensions
MSS
User requests to view the list of commands.
KeyContacts displays the dialog box with a link to the user guide.
Use case ends.
MSS
User requests to undo the last command.
KeyContacts undoes the last command.
Use case ends.
MSS
User requests to redo the last undone command.
KeyContacts redoes the last undone command.
Use case ends.
MSS
User requests to exit KeyContacts.
KeyContacts closes.
Use case ends.
17
or above installed..puml
files for generating diagrams in the documentation.preferences.json
data file.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
Download the jar file and copy into an empty folder
Double-click the jar file
Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum.
Saving window preferences
Resize the window to an optimum size. Move the window to a different location. Close the window.
Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained.
Adding a student with basic details
Test case (standard): add n/John Doe p/83143234 a/74 Acorn Street 11 653203 #02-02 gl/abrsm 1 g/
Expected: Student "John Doe" is added to the student directory with correct details.
Test case (with group): add n/Mary Sue p/9732123 a/51 Mangrove Drive 11 642371 #01-03 gl/abrsm 2 g/Group one
Expected: Student "Mary Sue" is added to the student directory, assigned to "Group one".
Adding a duplicate student
Test case (name and phone clashing): add n/john doe p/83143234 a/Acorn Street #02-02 gl/abrsm 1 g/
Expected: Error is thrown as student already exists (note the lower case)
Test case (only name is clashing): add n/John Doe p/8923921 a/Acorn Street #03-01 gl/abrsm 1 g/
Expected: Student "John Doe" is added to the student directory, as the duplicate criteria is name and phone number
Editing a student’s details
Prerequisites: List all students using the list command. Ensure there is at least one student in the list.
Test case: edit 1 n/Jane Doe p/91234567
Expected: The first student's name and phone number are updated to "Jane Doe" and "91234567", respectively.
Test case: edit 1 g/Group one
Expected: The first student's group is updated to "Group one".
Assign piano pieces
Test case: assign 1 pn/Moonlight Sonata pn/Fur Elise
Expected: "Moonlight Sonata" and "Fur Elise" are assigned to the first student.
Test case: assign 1 pn/Moonlight Sonata pn/Claire de Lune
Expected: Throws an error not allowing you to assign the same piece twice
Test case: assign 2 pn/Waltz pn/Etude
Expected: "Waltz" and "Etude" are assigned to the second student.
Unassign piano pieces
Test case: unassign 1 pn/Moonlight Sonata pn/Fur Elise
Expected: "Moonlight Sonata" and "Fur Elise" are unassigned from the first student.
Test case: unassign 2
Expected: All pieces are unassigned from the second student
Schedule a lesson
Test case: schedule 1 d/Monday st/12:00 et/14:00
Expected: A regular lesson is scheduled for the first student on Monday from 12:00 to 14:00.
Test case: schedule 2 d/Friday st/16:00 et/18:00
Expected: A regular lesson is scheduled for the second student on Friday from 16:00 to 18:00.
Cancel a scheduled lesson
Test case: cancel 1 dt/04-11-2024 st/12:00
Expected: The first student's lesson on November 04, 2024, at 12:00 is canceled.
Test case: cancel 2 dt/18-10-2024 st/16:00
Expected: The second student's lesson on October 18, 2024, at 16:00 is canceled.
Schedule a makeup lesson
Test case: makeup 1 dt/25-12-2024 st/12:00 et/14:00
Expected: A makeup lesson is scheduled for the first student on December 25, 2024, from 12:00 to 14:00.
Test case: makeup 2 dt/26-12-2024 st/10:00 et/11:30
Expected: A makeup lesson is scheduled for the second student on December 26, 2024, from 10:00 to 11:30.
Test case: makeup 1 dt/31-02-2024 st/10:00 et/12:00
Expected: An error is thrown as 31st Feb is not a valid date.
View current week’s schedule
view
View a specific week’s schedule
view dt/01-12-2024
Find by name
find n/John
Find by multiple details
find n/John gl/ABRSM
Sort by name in ascending order
sort n/ASC
Sort by grade level in descending order and name in ascending order
sort gl/DESC n/ASC
Undo previous modification
undo
after performing any modification (e.g., adding a student). Redo last undone action
redo
after an undo command. Dealing with corrupted data files
Note: Team size 5
Our project was significantly more complex when compared to AB3. We have introduced various new commands to support new functionalities. Our student objects involve more fields, with certain fields (lessons) requiring syncing across multiple students. Our UI is also more complicated, with the introduction of a new calendar view that updates based on students' lesson data.
Command Planning: Planning for multiple commands, which enhance the product, while fitting together cohesively, required careful thought and deliberation. Lesson-related Logic: Logic for syncing lessons across students in the same group, as well as checking for lesson clashes, needed to be developed. UI Refactoring: Designing a UI which could show all existing information, while also displaying a calendar view required multiple drafts and discussions.
Our project involved substantial effort in several key areas:
Refactoring: Modifying existing AB3 features to suit our product (e.g. removing extra fields) Command Implementation: Implementing multiple new commands Model Implementation: Updating the model with new fields, and implementing lesson-related logic. Testing and Debugging: Testing and debugging the new features, as well as performing regression testing
We have extended AB3 with multiple new features and a better UI, to make the app more specialised and suitable for piano tutors.