Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CS2113-W14-1] W14G1 (WIAGI) #21

Open
wants to merge 921 commits into
base: master
Choose a base branch
from

Conversation

wx-03
Copy link

@wx-03 wx-03 commented Sep 22, 2024

WIAGI aims to help students who are beginning their financial independence journey and want to gain control over their budgeting, saving, and investing habits. We provide students with a simple to use application that offers a wide range of essential tools and features such as budgeting, saving, and investment analysis, helping them to make better financial decisions and be in control of their finances.

Copy link

@tzerbin tzerbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is relatively clean!
Just some small issues here and there and you should be good to go :)

int sum = 0;
for (int i = 0; i < arrList.size(); i++) {
assert arrList != null : "ArrayList is null";
int oneIndexedI = i + 1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps augment your for-loop such that counter starts from 1 and ends at arrList.size().

This is apparent in other parts of the code as well.

StringBuilder sbSpending = new StringBuilder();
assert tag != null && !tag.isEmpty() : "Tag is null or empty";

int tagsCount;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an naming inconsistency here for this 3 variables.

filteredList.add(entry);
}
}
print_list(filteredList);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method names should follow the camelCase, not snake_case.

print_list(filteredList);
}

public static <T extends Type> void printMonthly(ArrayList<T> arrList) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why the parameter is named with a generic name?

This issue is apparent in other parts of the code as well.

return currDate;
}

private static boolean inRange(LocalDate date, LocalDate start, LocalDate end) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method name should start with a verb instead e.g. isInRange.

private <T extends ArrayList<? extends Type>> void editList(String[] arguments, T list)
throws WiagiInvalidIndexException {
try {
Type toEdit = list.get(getIndex(arguments));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable names used here are not descriptive.

return;
}
String firstIndex = fullCommands[1];
switch (firstIndex) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch statement is a little long; perhaps break down this piece of code into different functions?

}
String firstIndex = fullCommands[1];
switch (firstIndex) {
case "tags":
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are other files that has already set the strings as constants, you could use it over here as well.

"\t[3] Biweekly" + System.lineSeparator() +
"\t[4] Monthly");
String userInput = Ui.readCommand();
if (userInput.equals("1")) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using switch statement instead (just for aesthetic purposes).


public class MonthlyRecurrence extends Recurrence {
@Override
public void checkIncomeRecurrence(Income recurringIncome, IncomeList incomes) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Methods here are relatively long. Perhaps break it down into smaller parts?

Copy link

@ChuaCleon ChuaCleon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Use normal rectangle instead of curved rectangle


Illustrated below is the class diagram for the Recurrence Component:</br>
</br>
<img src="./Diagrams/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="800"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
can use an association arrow from Type class to RecurrenceFrequency class instead

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partly hard to reed the methods and attributes.


Illustrated below is the class diagram for the Recurrence Component:</br>
</br>
<img src="./Diagrams/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="800"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
parseRecurrence() is a static method as seen later on in the DG, should that method be underlined in the class diagram?


Illustrated below is the class diagram for the Recurrence Component:</br>
</br>
<img src="./Diagrams/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="800"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
font size a bit too small.

Copy link

@paulktham paulktham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some improvements to be made but overall is a pretty good job! can tell that its a WIP so these inconsistencies are normal 😺


### Recurrence Component

#### Motivation behind the component:</br>
Copy link

@paulktham paulktham Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the </br> is showing in the dg which i dont think was intended


## Design & implementation

{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}

## Overall Class Diagram
![overallClass.jpg](./Diagrams/overallClass.jpg)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since you are already omitting other classes for conciseness, i dont think its necessary and easier to read to include simple getter functions in the classes that you show here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

especially since this is to show the overall architecture this can be quite trivial

Comment on lines 52 to 53
Illustrated below is the class diagram for the Recurrence Component:</br>
</br>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the </br> is showing here also which i dont think is intended

Within Wiagi constructor, Storage class is constructed, which will load and initialise incomes, spendings and
password by de-serialising the text at their distinct file paths. Wiagi will then initialise it incomes and spendings
based on the member in the Storage class.
![storageLoad.png](./Diagrams/storageLoad.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a ref for login but there is no sd


Illustrated below is the class diagram for the Recurrence Component:</br>
</br>
<img src="./Diagrams/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="800"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This diagram is really quite hard to read, especially with all the long and similar function names for daily monthly and yearly recurrence, maybe there are other ways you can display this nicer. or maybe split it up

Copy link

@kennethSty kennethSty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great kickstart.
You could consider the following for the next round:

  1. Give more context to your sequence diagrams.
  2. Use more descriptive path conditions in your diagrams.
  3. Double check the usage of
    as a lot of them are printed on the webpage of the PD
  4. A couple of nitty gritty details I added as reviews.

{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the
original source as well}

[Original Source](https://github.com/nus-cs2113-AY2425S1/tp)

## Design & implementation

{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholder still here


## Design & implementation

{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}

## Overall Class Diagram
![overallClass.jpg](./Diagrams/overallClass.jpg)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great strategy to leave out the irrelevant classes for a high level overview

Within Wiagi constructor, Storage class is constructed, which will load and initialise incomes, spendings and
password by de-serialising the text at their distinct file paths. Wiagi will then initialise it incomes and spendings
based on the member in the Storage class.
![storageLoad.png](./Diagrams/storageLoad.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the unnamed instances of IncomeListStorage etc. be ready for garbage collection after the load is finished? If not, maybe add a comment on how they will be reused later.


Illustrated below is the class diagram for the Recurrence Component:</br>
</br>
<img src="./Diagrams/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="800"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partly hard to reed the methods and attributes.

+ `YearlyRecurrence`: Handles entries labelled as yearly recurring events

##### parseRecurrence method
Class: `Parser` </br>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean here? Is it part of the Parser class? Why then is it located under the implementation of the Recurrence class?

Potentially you could help the reader understand the structure a bit more but not only relying on your class diagrams and sequence diagrams, but also by giving you test more structure.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess what you want to say with the 'class' label is in which classes it is used.

Simply change the naming then to make this more clear.

```
Below illustrates the functionality of the checkIncomeRecurrence method through a sequence diagram </br>
</br>
<img src="./Diagrams/addRecurrenceEntry.png" alt="addRecurrenceEntry" width="700"/> </br>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the actual operators, potentially use what it intuitively means instead. (e.g. next recurrence is due).
This could help to reduce the complexity of the diagram.
image

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you used a note to explain CheckDate.
Maybe consider choosing a more descriptive variable name for CheckDate instead. Could help to improve the readability of the code and your diagrams because fewer additional comments or notes are relevant.

#### Implementation:
#### Recurrence class
The `Recurrence` class is a abstract class that provides the interface for checking `Income` and `Spending` and adding
recurring entries into the list. </br>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


printed in DG webversion
image

Comment on lines 163 to 181
Priorities: High (must have) - * * *, Medium (nice to have) - * *, Low (unlikely to have) - *

| Priority | As a ... | I want to ... | So that I can ... |
|----------|----------|------------------------------------------------------|--------------------------------------------------|
| *** | user | start and close the application | use it only when needed |
| *** | user | add my financial transactions | track the flow of my money |
| *** | user | categorise my entries as income and spendings | better understand my financials |
| *** | user | add income and expenditure categories | see my overall net gain or loss |
| *** | user | see all my spendings | know what I spent on |
| *** | user | delete my entries | correct my mistakes |
| *** | user | have a password to my account | protect my account information |
| ** | user | edit my incomes and spendings | correct my mistakes |
| ** | user | categorise my expenses | see what I spend on |
| ** | user | categorise my incomes | see where my savings come from |
| ** | user | read the amount of money left in my allocated budget | gauge how much to spend for the remaining period |
| ** | user | set expenses and incomes as recurring | do not need to manually add them each time |
| ** | Student | set budgets for each category of expense | make better financial decisions |
| * | user | be alerted when I overspend my budget | try to curb my spendings |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this part of the DG particularly! Well done


## Design & implementation

{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}

## Overall Class Diagram
![overallClass.jpg](./Diagrams/overallClass.jpg)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Is this the right way to add comments to your class diagram? You might want to put the note outside the box and then have a dotted line pointing to the note from the box


### adding of new entry
![addCommandSequence.jpg](./Diagrams/addCommandSequence.jpg)
To add new entries, user will have to input the related commands.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
The text is slightly buggy here. You might want to create a new line below the image

Illustrated below is the class diagram for the Recurrence Component:</br>
</br>
<img src="./Diagrams/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="800"/>
</br>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
Your line break does not show correctly in the DG. You might want to try something else


Illustrated below is the class diagram for the Recurrence Component:</br>
</br>
<img src="./Diagrams/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="800"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
If I understand correctly, Spending and Income inherits from Type. But what is Type? Perhaps there could be more clarity if the parent class had a proper name

Within Wiagi constructor, Storage class is constructed, which will load and initialise incomes, spendings and
password by de-serialising the text at their distinct file paths. Wiagi will then initialise it incomes and spendings
based on the member in the Storage class.
![storageLoad.png](./Diagrams/storageLoad.png)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider to adjust the background colour since the lifelines appear to be invisible.
Screenshot 2024-10-30 at 12 36 53

</br>
Illustrated below is the sequence diagram of the Recurrence Component: </br>
</br>
<img src="./Diagrams/recurrenceSequenceDiagram.png" alt="recurrenceSequenceDiagram" width="700"/>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rectangles should be sharp border as curved border is non-standard. And use dotted lines instead of quotation
Screenshot 2024-10-30 at 12 57 13 PM

Copy link

@rexkoh425 rexkoh425 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good diagrams!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Parser should have a dependency on Type since it uses it in the static method?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there was a typo and there's a extra space for SpendingList for the first method?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe could look to add () for printStatisticsRequired if it is a method?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Maybe can indicate the access modifiers for password member under Storage since everything else has too?

Copy link

@tzerbin tzerbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DG draft is very well attempted.
However, there is an overload of information within the DG which can be further summarised and organised, such as huge class diagrams and explanations on self-explanatory methods.
Good luck for the upcoming submissions!


## Design & implementation

{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}

### Overall Class Diagram
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the purpose is to show the architecture, perhaps use an architecture diagram instead of a class diagram with a tag showing that "many of the classes are omitted for conciseness".
Then, break down your current class diagram into smaller diagrams per component.

Should there be usage of association labels on dependencies?
Also do include the remaining roles for associations.
Do update all the multiplicities of all classes.
There are some member attributes (e.g. password in Storage class) that does not have its access modifier.

which will initialise the variables in `Storage` respectively.

#### save method in `IncomeListStorage` `SpendingListStorage`
<img src="./Diagrams/Storage/saveStorageSequenceDiagram.png" alt="saveStorageSequenceDiagram" width="600" height="400"/><br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to consider omitting method calls to JavaAPI such as FileWriter, only if you feel that it is not of importance.

`10.0|part time|2024-10-10|job|MONTHLY|2024-10-10|10`

#### load method in `IncomeListStorage` `SpendingListStorage`
<img src="./Diagrams/Storage/loadStorageSequenceDiagram.png" alt="loadStorageSequenceDiagram" width="600" height="400"/><br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there be a self-invocation for load() methods within the Storages?

Perhaps use UML notation for sequence diagrams instead of having "labels" to state what it is doing.
This problem exists in multiple sequence diagrams.

`10.0|part time|2024-10-10|job|MONTHLY|2024-10-10|10`

#### load method in `IncomeListStorage` `SpendingListStorage`
<img src="./Diagrams/Storage/loadStorageSequenceDiagram.png" alt="loadStorageSequenceDiagram" width="600" height="400"/><br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there an activation bar on :Wiagi if there are no methods called for the instance.
This problem exists in multiple sequence diagrams too.


Illustrated below is the class diagram for the Recurrence Component:<br>
<br>
<img src="./Diagrams/Recurrence/recurrenceClassDiagram.png" alt="recurrenceClassDiagram" width="950"/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any classes that have a dependency on RecurrenceFrequency?

```
Below illustrates the functionality of the checkIncomeRecurrence method through a sequence diagram <br>
<br>
<img src="./Diagrams/Recurrence/addRecurrenceEntry.png" alt="addRecurrenceEntry" width="800"/> <br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The activation bar for incomes:IncomeList and :Recurrence seems unreasonable as there are no method calls.
Are there any lifeline ending?


## Design & implementation

{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}

### Overall Class Diagram
![overallClass.drawio.png](./Diagrams/Overall/overallClass.drawio.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that an architecture diagram might be more effective in displaying a clearer high-level overview of how the system components interact with each other. The detailed information in the class diagram, while useful, may be more than necessary for showing the overall structure and interactions of the system’s major components.

At the end of the run, or when the user exits the application, `Wiagi` will save the lists.
Now let's delve deeper into some of these classes used for the program below

#### EntryType Class
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

descriptions for each class are generally clear and comprehensive, well done :)

+ For missing files (e.g., new users), users will be prompted to set a new password at the start of the
program. The entered password will then be hashed and stored in a newly created password file.

#### Implementation:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting - should 'implementation' have a higher heading hierarchy?

which will initialise the variables in `Storage` respectively.

#### save method in `IncomeListStorage` `SpendingListStorage`
<img src="./Diagrams/Storage/saveStorageSequenceDiagram.png" alt="saveStorageSequenceDiagram" width="600" height="400"/><br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are all the return arrows necessary? should any be omitted to reduce clutter and improve clarity??

```
Below illustrates the functionality of the checkIncomeRecurrence method through a sequence diagram <br>
<br>
<img src="./Diagrams/Recurrence/addRecurrenceEntry.png" alt="addRecurrenceEntry" width="800"/> <br>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activation bars should begin with a method call. here, the activation bar under incomes:IncomeList has no method call. This problem occurs in some other sequence diagrams as well
Screenshot 2024-11-02 233421

wx-03 and others added 30 commits November 12, 2024 04:41
Rename filewriter and update storage SD
Edit my PPP, added javadocs, adding more test later for storage
Rename list income and list spending command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.