Skip to content

Commit a2c500d

Browse files
authored
Merge pull request #254 from AY1920S1-CS2103T-W12-3/developer-guide
Developer Guide
2 parents c0e915e + 1502baf commit a2c500d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+536
-232
lines changed

docs/DeveloperGuide.adoc

Lines changed: 65 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,20 @@ This document describes the architecture and system design of _PalPay_.
2424
It is a living document that evolves throughout the design and implementation for each release.
2525
Each release will have an edition of the document, and the current edition of the document is for the first public release of the application.
2626

27-
This document is aimed at covering the high-level system architecture and design.
27+
This document aims to cover the high-level system architecture and design.
2828
It is segmented into two major parts: software design, including system architecture, and design implementation.
29-
The software design documents the main software components that operate and support the main system architecture.
30-
Essential details such as the user stories and use cases, as well as the Non Functional Requirements are included at the back of the document.
29+
The software design illustrates the main software components that operate and support the main system architecture.
30+
Essential details such as the user stories, use cases, and the Non Functional Requirements are included at the back of this document.
3131

3232
=== Audience
3333

34-
This document is written for software engineers want to gain an insight of the system architecture and design of the application.
35-
In particular, the intended audience of this document is the students taking the roles of the developers, designers, and software testers of _PalPay_ from CS2103T - Software Engineering.
34+
This document is written for software engineers who desires a deeper insight of the system architecture and design of this application - PalPay.
35+
In particular, the intended audience of this document will be the students taking on the roles of the developers, designers, and software testers of _PalPay_ from CS2103T - Software Engineering.
3636

3737
=== Description
3838

3939
_PalPay_ is a CLI application targeted for users who have poor financial management skills. The users should also prefer typing over mouse inputs.
40-
It allows the users to keep track of daily financial transactions, as well as set a budget for a time duration to achieve long-term financial success.
41-
Not only that, users can keep a ledger of lending and borrowing of money with others so that the users can keep track of the flow of their money.
40+
It allows the users to keep track of daily financial transactions, as well as set a budget for a time duration to achieve long-term financial success. Additionally, users can keep a ledger of lending and borrowing of money with others so that the users can keep track of the flow of their money.
4241

4342
== Setting up
4443

@@ -240,9 +239,9 @@ that deal with `Ledger` implements the `LedgerOperation` interface. +
240239
** This allows us to achieve polymorphism by overloading methods in `Model` to handle the different operations correctly.
241240
** This reduces code coupling as there are different models to handle different balance amounts.
242241

243-
* A `Transaction` entry can affect a `Budget` which has similar categories.
244-
** Only `Out` Transactions will affect `Budget`.
245-
** Activity diagram below shows how and when a `Transaction` object affects `Budget`.
242+
* A `Transaction` entry can affect a `Budget` which has similar categories and is within the same time period. The activity diagram bellow will further clarify this flow.
243+
** Only `Out` Transactions can affect `Budget`.
244+
** The activity diagram below shows how and when a `Transaction` object affects `Budget`.
246245

247246
.Activity diagram for Out Transaction affecting Budget
248247
image::OutbudgetActivityDiagram.png[]
@@ -267,7 +266,13 @@ Upon setting a new budget, a `BudgetCard` is created and displayed in a list in
267266

268267
A `Budget` stores an *initial amount*, *amount* (the current amount), *deadline*, *categories*.
269268
There is a need for a `Budget` to store both *initial amount* and *amount* as it allows for percentage of budget remaining to be calculated. +
270-
Displaying the percentage improves the user experience greatly as our target user is a
269+
Shown below is the class diagram of `Budget` class:
270+
271+
.Class diagram of Budget class
272+
image::BudgetClassDiagram.png[]
273+
274+
275+
Displaying the percentage remaining improves the user experience greatly as our target user is a
271276
`visual person who wants to see how much budget he has left in each category so as to cut down on spending as necessary`
272277
as specified in <<User-Stories, user stories>>. Hence, taking a quick glance at the `Budget card` allows the user to
273278
determine how much of budget he has left, as well as be alarmed by the red font colour to spend less if he has overspent beyond the budget set. +
@@ -284,18 +289,26 @@ public String displayPercentage() {
284289
}
285290
```
286291

287-
Shown below is an example of an overspent budget. Budget is displayed in red to alert the user that
288-
he has overspent beyond the set budget:
292+
Moreover, as our user is a visual person, PalPay makes use of colour to display different messages.
293+
For instance, budget is displayed in red to alert the user that he has overspent beyond the set budget. +
294+
295+
Shown below is an example of an overspent budget:
289296

290297
.Example of an overspent budget
291298
image::overspentBudget.png[]
292299

300+
293301
When setting a new `Budget`, existence of a duplicate budget is checked through a sequence of checks.
294-
The activity diagram below shows a simple successful case of setting a new budget:
302+
The activity diagram below shows the activity diagram of setting a new budget:
295303

296304
.Activity Diagram of successfully setting a new Budget
297305
image::SetBudgetSimpleActivityDiagram.png[]
298306

307+
As shown, a new budget cannot have the same *initalAmount*, *deadline* and *categories* as any other existing budget in
308+
budget list. Allowing existence of duplicate budgets will crowd the interface of `Budget` tab,
309+
which prevents the user from getting a quick overview of his budget status. Hence, a duplicate check is essential
310+
in providing a pleasing user experience. +
311+
299312
==== Design Considerations
300313

301314
Currently, `Budget` does not extend from `Transaction` although the two behave in a similar way.
@@ -335,6 +348,7 @@ image::Split.png[]
335348

336349
// end::split[]
337350

351+
//tag::receive[]
338352
=== Settle Up Feature: `receive`
339353

340354
This feature allows another person to send money to the user. +
@@ -371,6 +385,7 @@ public abstract class Payment extends Transaction implements LedgerOperations {
371385
}
372386
}
373387
```
388+
//end::receive[]
374389

375390
// tag::project[]
376391
[[Implementation-Projection]]
@@ -508,20 +523,20 @@ This feature allows the user to delete an existing transaction, budget, ledger o
508523

509524
* The delete feature is facilitated by the Logic and Model components of the application.
510525
* The delete feature works for `Transaction`, `Budget`, `Ledger` and `Projection` entries.
511-
* The following activity diagram summarizes what happens when a user executes Delete command:
526+
* The following activity diagram summarizes what happens when a user executes a `delete` command:
512527

513-
.Activity Diagram of Delete Command
528+
.Activity Diagram for `delete` command
514529
image::DeleteActivityDiagram.png[]
515530

516531
==== Design Consideration
517532

518-
* The `delete` command is followed by a `TYPE+INDEX` parameter.
533+
* The `delete` keyword is followed by a `TYPE+INDEX` parameter.
519534
** `Transaction` entries takes in `t` as its `TYPE` parameter.
520535
** `Budget` entries takes in `b` as its `TYPE` parameter.
521536
** `Ledger` entries takes in `l` as its `TYPE` parameter.
522537
** `Projection` entries takes in `p` as its `TYPE` parameter.
523538
* The `index` parameter refers to the entry number within the `TYPE` entry's view tab.
524-
* Example: `delete t5` deletes the 5th transaction from the list of transaction if that particular entry exists.
539+
* Example: `delete t5` deletes the 5th entry from the list of transactions if that particular entry exists.
525540

526541
===== Aspect: Delete requires `TYPE+INDEX` as one of its parameter
527542

@@ -538,19 +553,19 @@ image::DeleteActivityDiagram.png[]
538553
// tag::update[]
539554
=== Update Existing Entry Feature: `update`
540555

541-
This feature allows users to update `Transaction`, `Budget` or `Projection` entries. The user is unable to perform this feature on `Ledger` and operations the rationale will be further explained in **Aspect 2**.
556+
This feature currently allows users to update `Transaction` or `Budget` entries. The user is unable to perform this feature on `Ledger` operations. The rationale for this will be further explained in **Aspect 2**. The user is currently unable to perform this feature on `Projection` operations as it will be further implemented in future updates.
542557

543558
==== Current Implementation
544559

545560
* The update feature is facilitated by the Logic and Model components of the application.
546561
* The parameter requirements differs for the type of entry:
547562
** `Transaction` type requires at least one of it's `Amount`, `Description`, `Date` or `Category` fields to be updated.
548563
** `Budget` type requires at least one of it's `Amount`, `Date` or `Category` fields to be updated.
549-
** `Project` type only requires it's `Date` field to be updated.
564+
** `Project` type requires it's `Date` and `Category` fields to be updated (Future implementation).
550565
* At least one valid parameter must be changed when executing an `update` command. (i.e. `update b1` will result in an error as no fields are being changed).
551566
* The following activity diagram summarizes what happens when a user executes an update command:
552567

553-
.Activity Diagram for update
568+
.Activity Diagram for `update`
554569
image::UpdateActivityDiagram.png[]
555570

556571
==== Design Considerations
@@ -573,13 +588,23 @@ More often than not, users do not need to change an entire Transaction or Budget
573588

574589
* **Alternative 1 (current choice):** Update Command only works with `Transaction`, `Budget` and `Projection` Operations.
575590
** Pros: Intuitive implementation and execution for the user.
576-
** Cons: Requires excessive user operations. The user has to first delete the `Ledger` operation that he/she wishes to change, then input the `Ledger` operation with the amended fields.
577-
** For example, when a new command is executed, we must remember to update both `HistoryManager` and `VersionedAddressBook`.
591+
** Cons: Requires excessive user operations.
592+
*** The user has to first delete the `Ledger` operation that he/she wishes to change, followed by inputting the `Ledger` operation with the amended fields back into PalPay.
578593
* **Alternative 2:** Update Command to also work with `Ledger` operations.
579594
** Pros: Requires only one user command to append or change `Ledger` entries.
580595
** Cons: Results in convoluted implementation and user experience. This will also hinder future permeability of the `Split` feature.
581596
*** `Ledger` operations such as `split` includes many repeated fields (i.e. multiple `Persons` and `shares` list).
582597
*** Will require several conditional user inputs to differentiate between the various repeated entities that the user wishes to amend.
598+
599+
==== Future Enhancements
600+
601+
===== Update feature for Projections
602+
Currently the update feature has not been implemented for `Projection` operations. In future iterations of PalPay, the update feature should work seamlessly with `Projection` operations, similar to that of `Transaction` and `Budget` operations
603+
604+
The activity diagram below will provide a visual representation of the possible user routes using the `update` command after this enhancement has been implemented.
605+
606+
.Activity Diagram for future `update`
607+
image::UpdatefutureActivityDiagram.png[]
583608
// end::update[]
584609

585610
// tag::sort[]
@@ -724,20 +749,20 @@ Given below is an example usage scenario and how the undo/redo mechanism behaves
724749
The `VersionedUserState` will be initialized with the initial user state, and the `currentStatePointer`
725750
pointing to that single user state.
726751

727-
image::UndoRedoState0.png[]
752+
image::UndoRedoState0.png[pdfwidth=50%, align="center"]
728753

729754
**Step 2**. The user executes `delete t5` command to delete the 5th transaction in the transaction list.
730755
The `delete` command calls `Model#commitUserState()`, causing the modified state of the user state after the
731756
`delete t5` command executes to be saved in the `userStateList`, and the `currentStatePointer` is shifted
732757
to the newly inserted user state.
733758

734-
image::UndoRedoState1.png[]
759+
image::UndoRedoState1.png[pdfwidth=50%, align="center"]
735760

736761
**Step 3**. The user executes `in $/10 n/Allowance d/07112019` to log a new transaction.
737762
The `in` command also calls `Model#commitUserState()`, causing another modified user state to be saved
738763
into the `userStateList`.
739764

740-
image::UndoRedoState2.png[]
765+
image::UndoRedoState2.png[pdfwidth=50%, align="center"]
741766

742767
[NOTE]
743768
If a command fails its execution, it will not call `Model#commitUserState()`, so the user state will
@@ -748,7 +773,7 @@ executing the `undo` command. The `undo` command will call `Model#undoUserState(
748773
`currentStatePointer` once to the left, pointing it to the previous user state, and restores the user state
749774
to that state.
750775

751-
image::UndoRedoState3.png[]
776+
image::UndoRedoState3.png[pdfwidth=50%, align="center"]
752777

753778
[NOTE]
754779
If the `currentStatePointer` is at index 0, pointing to the initial user state, then there are no previous
@@ -759,14 +784,14 @@ If so, it will return an error to the user rather than attempting to perform the
759784
Commands that do not modify the user state, such as `list`, will usually not call `Model#commitUserState()`,
760785
`Model#undoUserState()` or `Model#redoUserState()`. Thus, the `userStateList` remains unchanged.
761786

762-
image::UndoRedoState4.png[]
787+
image::UndoRedoState4.png[pdfwidth=50%, align="center"]
763788

764789
**Step 6**. The user executes `clear`, which calls `Model#commitUserState()`.
765790
Since the `currentStatePointer` is not pointing at the end of the `userStateList`, all user states after
766791
the `currentStatePointer` will be purged. We designed it this way because it no longer makes sense to redo the
767792
`in $/10 n/Allowance d/07112019` command. This is the behavior that most modern desktop applications follow.
768793

769-
image::UndoRedoState5.png[]
794+
image::UndoRedoState5.png[pdfwidth=50%, align="center"]
770795

771796
The following sequence diagram shows how the undo operation works:
772797

@@ -985,7 +1010,7 @@ These instructions only provide a starting point for testers to work on; testers
9851010

9861011
. Initial launch
9871012

988-
.. Download the jar file and copy into an empty folder
1013+
.. Download the jar file and copy into an empty folder.
9891014
.. Double-click the jar file +
9901015
Expected: Shows the GUI with a set of sample contacts.
9911016
The window size may not be optimum.
@@ -1017,9 +1042,18 @@ Status bar remains the same.
10171042
Expected: Similar to previous.
10181043

10191044

1045+
=== Viewing Help Window
1046+
1047+
. Requesting help from PalPay
1048+
1049+
.. Prerequisites: None
1050+
1051+
.. Test case: `help` +
1052+
Expected: A help window pops up that displays the URL of PalPay's User Guide and a `Copy URL` button.
1053+
10201054
=== Saving Data
10211055

10221056
. Dealing with missing/corrupted data files
10231057

1024-
.. _{explain how to simulate a missing/corrupted file and the expected behavior}_
1058+
.. Delete the file at `.\data\bankaccount.json`.
10251059

0 commit comments

Comments
 (0)