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
, PersonListPanel
, 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
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 AddressBookParser
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 client).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., AddCommandParser
) which uses the other classes shown above to parse the user command and create a XYZCommand
object (e.g., AddCommand
) which the AddressBookParser
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.The following classes were added to support new commands:
PayCommand
and PayCommandParser
SortCommand
and SortCommandParser
FilterLoanCommand
and FilterLoanCommandParser
DeleteLoanCommand
, with DeleteCommandParser
updated to return either a DeleteCommand
or DeleteLoanCommand
Each new command follows the Command design pattern and extends the abstract Command
class.
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.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 loan
feature is facilitated by Loanlist
, which contains an ArrayList<Loan>
that stores the loan list, along with several related methods. Each Person
has a LoanList
, which contains the loans that have been made to them. Thus, the following classes were created:
Loan
— an abstract class that dictates what a Loan
class should do and contain.SimpleInterestLoan
and CompoundInterestLoan
, each representing their respective loan type, with different calculations for interest and amount owed.LoanCommandParser
, which implements Parser
. It is passed the arguments from a loan
command by the Ui, and in turn generates a LoanCommand
object.LoanCommand
— , which inherits from Command
. When executed, it creates a new loan based on the arguments (if they are all valid), and adds it to the LoanList
of a specified Person
.Below is the class diagram showing Loan
and its child classes:
Given below is an example usage scenario and how the loan
feature behaves at each step.
Step 1. The user adds a Person
to Sharkives using an add
command.
Step 2. The user uses the loan
command to add a loan to that Person
(e.g., loan 1 s 1000.00 5.5 2030-12-31
).
Step 3. This input is read as a loan
command, and the Ui creates a LoanCommandParser
object with the args from the command.
Step 4. When parse()
is called, it matches the args to a validation regex, which makes sure that the number of arguments and their format is as specified.
Note: Any malformed command causes a ParserException
to be thrown, which informs the user that their format is wrong, and the correct usage of the command.
Step 5. Then, these args are split and passed to LoanCommand
, which processes and stores these args.
Step 6. execute()
in LoanCommand
is called, which in turn creates a Loan
object based on the provided args and then adds it to the specified person's LoanList
.
Design considerations:
add
command uses predicates (e.g. n/
, e/
), we elected not to use those as having too many predicates would be confusing to the user, and unnecessarily wordy for a relatively shorter command. In addition, none of these arguments are optional.has-a
relationship with loans, we modeled this by making LoanList
a new field in each Person
, which is initiated empty.The Payment feature is facilitated by LoanList
, as described previously. Additionally, it adds the following classes:
PayCommand
— a Command
class that inherits from Command
and implements all of its methodsPayCommandParser
— a Parser
class that implements Parser
and returns a PayCommand
The PayCommand
class features an overloaded constructor which supports 3 different ways to pay for a loan - amount, months' worth of instalments, and all at once. A pay
command (e.g., pay 1 2 100.00
) is parsed by PayCommandParser
, which chooses the appropriate constructor and returns a PayCommand
object.
The below image illustrates the above relationship:
Given below is an example usage scenario and how the Pay feature behaves at each step.
Step 1. The user creates a loan
(e.g., loan 1 s 1000 5.5 2025-12-31
) for an existing Person
, adding it to their LoanList
.
Step 2. The loanee makes a payment, which is recorded by the user using the pay
command (e.g., pay 1 1 50.00
).
Step 3. The command is read and sent to PayCommandParser
, which splits the arguments up. It then looks at the 3rd argument (i.e., 50.00
) and sees that it is a float
that contains neither M
or is all
.
Step 4. PayCommandParser
chooses the constructor of PayCommand
that takes a float
as the third argument, and returns the PayCommand
.
Step 5. The PayCommand
is executed, which looks at the first argument, the index of the loanee who paid, and calls the pay()
method in their Person
object. This in turn calls the pay()
method in their LoanList
, which gets the appropriate Loan
(from the second argument) and pays the specified amount to it.
Step 6. Assuming no errors occur (such as the amount being more than the remainder owed), the amount is added to amtPaid
field in the loan (instead of being deducted directly, which helps with flexible loan repayment calculations) and the remaining owed is updated based on the principal, interest rate, time passed, and amount already paid.
Note: If either index is out-of-bounds, PayCommandParser
throws the corresponding ParserException
. If the amount exceeds the amount remaining, PayCommand
throws the corresponding CommandException
.
Note: Other scenarios such as a malformed command or negative values is covered by the validation regex, which ensures that the command follows the specified format.
Design considerations:
The proposed undo/redo mechanism is facilitated by VersionedSharkives
. It extends The Sharkives
with an undo/redo history, stored internally as an SharkivesStateList
and currentStatePointer
. Additionally, it implements the following operations:
VersionedSharkives#commit()
— Saves the current address book state in its history.
VersionedSharkives#undo()
— Restores the previous address book state from its history.
VersionedSharkives#redo()
— Restores a previously undone address book state from its history.
These operations are exposed in the Model
interface as Model#commitSharkives()
, Model#undoSharkives()
and Model#redoSharkives()
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 VersionedSharkives
will be initialized with the initial address book state, and the currentStatePointer
pointing to that single address book state.
Step 2. The user executes delete 5
command to delete the 5th person in the address book. The delete
command calls Model#commitSharkives()
, causing the modified state of the address book after the delete 5
command executes to be saved in the SharkivesStateList
, and the currentStatePointer
is shifted to the newly inserted address book state.
Step 3. The user executes add n/David …
to add a new person. The add
command also calls Model#commitSharkives()
, causing another modified address book state to be saved into the SharkivesStateList
.
Note: If a command fails its execution, it will not call Model#commitSharkives()
, so the state will not be saved into the SharkivesStateList
.
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#undoSharkives()
, which will shift the currentStatePointer
once to the left, pointing it to the previous state, and restores The Sharkives to that state.
Note: If the currentStatePointer
is at index 0, pointing to the initial Sharkives state, then there are no previous Sharkives states to restore. The undo
command uses Model#canUndoSharkives()
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#redoSharkives()
, 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 SharkivesStateList.size() - 1
, pointing to the latest address book state, then there are no undone Sharkives states to restore. The redo
command uses Model#canRedoSharkives()
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#commitSharkives()
, Model#undoSharkives()
or Model#redoSharkives()
. Thus, the SharkivesStateList
remains unchanged.
Step 6. The user executes clear
, which calls Model#commitSharkives()
. Since the currentStatePointer
is not pointing at the end of the SharkivesStateList
, 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:
Alternative 1 (current choice): Saves the entire address book.
Pros: Easy to implement.
Cons: May have performance issues in terms of memory usage.
Alternative 2: Individual command knows how to undo/redo by
itself.
Pros: Will use less memory (e.g. for delete
, just save the person being deleted).
Cons: We must ensure that the implementation of each individual command are correct.
{more aspects and alternatives to be added}
Target user profile:
Value proposition: manage client contacts and loans faster than a typical mouse/GUI driven app
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
* * * | new user | see usage instructions | refer to instructions when I forget how to use the app |
Client Tracking | |||
* * * | licensed moneylender | add a new person | |
* * * | licensed moneylender | delete a person | remove entries that I no longer need |
* * * | ethical loanshark | view client profiles | track client contact details |
* * * | ethical loanshark | edit client profiles | keep records up to date |
* * | ethical loanshark | tag clients with labels | quickly identify and categorize them |
* * | ethical loanshark | search clients by name, contact number, loan ID | quickly locate their records |
* * | ethical loanshark | predict client risk | assess the risk of a new client |
* * | ethical loanshark | archive inactive client profiles | declutter active records while keeping history accessible |
* | ethical loanshark | log time of reminders for each client | have a record of communication |
* | ethical loanshark | view a log of all reminders sent to a client | know when to schedule future reminders |
Loan Tracking and Analysis | |||
* * * | ethical loanshark | add loan by client | track when money is lent to a client loan |
* * * | ethical loanshark | delete loan by client | track when a client pays their loan |
* * * | ethical loanshark | view loans by client | track when a client pays their loan |
* * * | ethical loanshark | edit loans | update details as needed |
* * * | ethical loanshark | handle multiple interest calculation methods | use the most suitable one for each loan |
* * | ethical loanshark | sort loans by priority | know which loans to chase |
* | ethical loanshark | generate a summary of all loans connected to a guarantor | assess their risk exposure |
* | ethical loanshark | summarize outstanding loans, due dates, and overdue payments on a dashboard | have an overview of my business |
* | ethical loanshark | view overdue payments as a percentage of total active loans | gauge my portfolio’s health |
* | ethical loanshark | view repayment trends (weekly, monthly, yearly) | identify seasonal patterns in client payments |
* | ethical loanshark | apply discounts or waive fees in special cases | accommodate loyal clients or challenging situations |
* | ethical loanshark | compare repayment rates between loan types | optimize my offerings |
Related Party Management | |||
* * | ethical loanshark | add related parties for each client | categorize them as family, guarantors, or friends |
* * | ethical loanshark | track contact preferences of related parties | approach them respectfully |
* * | ethical loanshark | store multiple contact methods for related parties | have options for reminders |
* | ethical loanshark | identify the most responsive related party | know who to contact first if necessary |
Data Management | |||
* * * | ethical loanshark | save data locally at end of session | keep record history from previous session |
* * | ethical loanshark | import data | ensure seamless onboarding of information |
* * | ethical loanshark | export data | share or back up information |
* | ethical loanshark | purge all data | cleanse the system |
* | ethical loanshark | save data selectively (filter/sort) | save only certain data |
* | ethical loanshark | log all data changes (e.g., updates to client profiles, loan terms) | have a clear audit trail |
* | ethical loanshark | encrypt all data | ensure client data safety in the event of a leak |
{More to be added}
(For all use cases below, the System is The Sharkives
and the Actor is the user
, unless specified otherwise)
Use case UC01: Add a client
MSS
Use case ends.
Extensions
1a1. The Sharkives shows an error message.
Use case resumes at step 1
Use case UC02: Delete a client
MSS
User requests to delete a specific client in the list
The Sharkives deletes the client
Use case ends.
Extensions
1a1. The Sharkives shows an error message.
Use case resumes at step 1.
Use case UC03: Edit a client
MSS
User requests an amendment to an existing entry in the list
The Sharkives updates the client details
Use case ends.
Extensions
1a1. The Sharkives shows an error message.
Use case resumes at step 1.
Use case UC04: Add a loan for a client
MSS
User requests to add a loan to a specific client in the list
The Sharkives adds a loan entry to the client
Use case ends.
Extensions
1a1. The Sharkives shows an error message.
Use case resumes at step 1.
Use case UC05: Delete a loan for a client
MSS
User requests to delete a loan to a specific client in the list
The Sharkives removes the loan entry to the client
Use case ends.
Extensions
1a1. The Sharkives shows an error message.
Use case resumes at step 1.
Use case UC06: Filter loans
MSS
User requests to filter loans based on a specified predicate.
The Sharkives shows only the loans that fit the specified predicate.
User clears filter.
The Sharkives shows all the loans again in their default order.
Use case ends.
Extensions
1a1. The Sharkives shows that it did not filter by any predicate, and maintains the default view.
Use case resumes at step 1.
Use case UC07: Sort loans
MSS
User requests to sort by a parameter in a specified order.
The Sharkives sorts and orders the clients based on the parameter in the specified order.
Use case ends.
Extensions
1a. The user neglects to specify any arguments.
1a1. The Sharkives defaults to ordering the clients in descending order based on amount.
Use case ends.
1b. The parameter or order is invalid.
1b1. The Sharkives shows an error message.
Use case resumes at step 1.
{More to be added}
17
or above installed.{More to be added}
command
necessary for it to work as specified. These include parameters such as indices, and amount.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.
.jar
file and place it in an empty folder..jar
file.
Expected: The app launches with a sample list of persons. The window may not be optimally sized..jar
file.
Expected: The most recent window size and location are retained.list
command to display all persons. Ensure there are at least 2 persons in the list.delete 1
Expected: First person in the list is deleted. Status message displays deleted contact details. Timestamp updates.delete 0
Expected: No person is deleted. Error message is shown. Status bar remains unchanged.delete
Expected: Error message for missing index.delete x
(where x
is larger than the list size)
Expected: Error message for invalid index.data/AddressBook.json
file and rename/delete it while the app is closed.AddressBook.json
and modify it to an invalid JSON format (e.g., remove a closing brace).sort
Expected: List is sorted with overdue loans at the top, followed by others in descending order of loan amount.sort extraArg
Expected: Error message for invalid command format.filter pred/ isPaid n
in person list page
Expected: All persons are still shown, loans under each person will only show unpaid loansfilter 3 pred/ amount > 500 pred/ loanType s
in person 3's page
Expected: Under person 3, loan list shows only the simple interest loans with amount remaining owed > $500.filter abc
Expected: Input is accepted, however loans are shown as if not filtered.loan 1 s 1000.00 5.5 2030-12-31
Expected: First person in list has a simple interest loan with principal 1000.00
, interest rate 5.5
, and due date 2030-12-31
added to their loan list.loan 1 c 1000.00 5.5 2030-12-31
Expected: First person in list has a compound interest loan with principal 1000.00
, interest rate 5.5
, and due date 2030-12-31
added to their loan list.loan 0 s 1000.00 5.5 2030-12-31
Expected: Error message: Index is not a non-zero unsigned integer.
loan abc
Expected: Error message indicating invalid command format with correct usage.Prerequisites:
loan 1 s 1000.00 5.5 2030-12-31
if needed)Test case: pay 1 1 100.00
Expected:
Test case: pay 1 1 2M
Expected:
Test case: pay 1 1 all
Expected:
Test case: pay 0 1 100.00
Expected:
Index is not a non-zero unsigned integer.
Test case: pay 1 1 0.00
Expected:
The amount must be a positive number.
Test case: pay 1 1 9999.00
(when balance < $9999)
Expected:
Payment exceeds the remaining owed!
Our team of 5 spent significant effort extending the base AB3 functionality into a financial loan tracking application.
Loan
model to support filtering, sorting, payment trackingModelManager
to ensure correct ObservableList
behaviorloan
, delete loan
, pay
, filterLoan
, and sort
commands