-
Notifications
You must be signed in to change notification settings - Fork 89
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-T18-2] FinancialPlanner #17
base: master
Are you sure you want to change the base?
[CS2113-T18-2] FinancialPlanner #17
Conversation
Make format of flashcard Directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of loggers and assertions.
I think you tried to apply the singleton principle for some classes. It will be covered in one of the lectures, you can also read ahead under week 10's topics. The current implementation can improve a lot, particularly the instance names, and the way they are accessed.
@@ -0,0 +1,5 @@ | |||
package seedu.financialplanner.commands; | |||
|
|||
public abstract class AbstractCommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to put abstract in the class name
private static void loadBudget(String[] split) { | ||
double initial = Double.parseDouble(split[1].trim()); | ||
double current = Double.parseDouble(split[2].trim()); | ||
Budget.load(initial, current); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to add some safeguards here
String[] split = line.split("\\|"); | ||
String type = split[0].trim(); | ||
switch (type) { | ||
case "I": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supposed to be empty?
public BudgetCommand(RawCommand rawCommand) throws FinancialPlannerException { | ||
command = String.join(" ", rawCommand.args); | ||
if (!command.equals("set") && !command.equals("update")) { | ||
logger.log(Level.WARNING, "Invalid arguments for budget command"); | ||
throw new FinancialPlannerException("Please indicate whether budget is to be set or update."); | ||
} | ||
|
||
if (command.equals("set") && Budget.hasBudget()) { | ||
logger.log(Level.WARNING, "Invalid command: Trying to set existing budget"); | ||
throw new FinancialPlannerException("There is an existing budget, did you mean update?"); | ||
} | ||
|
||
if (command.equals("update") && !Budget.hasBudget()) { | ||
logger.log(Level.WARNING, "Invalid command: Trying to update non-existent budget"); | ||
throw new FinancialPlannerException("There is no budget set yet, did you mean set?"); | ||
} | ||
|
||
if (!rawCommand.extraArgs.containsKey("b")) { | ||
logger.log(Level.WARNING, "Missing argument /b in command"); | ||
throw new IllegalArgumentException("Missing /b argument."); | ||
} | ||
|
||
try { | ||
logger.log(Level.INFO, "Parsing budget as double"); | ||
budget = Double.parseDouble(rawCommand.extraArgs.get("b")); | ||
} catch (IllegalArgumentException e) { | ||
logger.log(Level.WARNING, "Invalid value for budget"); | ||
throw new IllegalArgumentException("Budget must be a number."); | ||
} | ||
|
||
if (budget <= 0) { | ||
logger.log(Level.WARNING, "Invalid value for budget."); | ||
throw new FinancialPlannerException("Budget should be greater than 0."); | ||
} | ||
|
||
if (budget > Cashflow.getBalance()) { | ||
logger.log(Level.WARNING, "Invalid value for budget"); | ||
throw new FinancialPlannerException("Budget should be lower than total balance."); | ||
} | ||
|
||
assert budget > 0 && budget <= Cashflow.getBalance() : "Budget should be greater than 0 and less than " + | ||
"or equal to total balance"; | ||
rawCommand.extraArgs.remove("b"); | ||
|
||
if (!rawCommand.extraArgs.isEmpty()) { | ||
String unknownExtraArgument = new ArrayList<>(rawCommand.extraArgs.keySet()).get(0); | ||
throw new IllegalArgumentException(String.format("Unknown extra argument: %s", unknownExtraArgument)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try using a neater way to put safeguards
public static final CashflowList INSTANCE = new CashflowList(); | ||
public final ArrayList<Cashflow> list = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use better names for these lists
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class RawCommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this class relate to the other commands?
for (int i = 0; i < cashflowList.list.size(); i++) { | ||
if (cashflowList.list.get(i).toString().contains(description)) { | ||
String output = cashflowList.list.get(i).toString()+" | Index: "+(i+1); | ||
foundedFinancialList.add(output); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can also just iterate through the objects instead of using their indexes
Delete Reminder and display reminder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally good job in making a comprehensive developer guide.
I really like your visualizer, that enhances the UI/UX.
Diagrams were present to support the understanding of the program
@@ -1,13 +1,249 @@ | |||
# Developer Guide | |||
|
|||
## Table of contents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of indentation to organize the Table of Contents.
However, since there are 3 types of indentation, could there be a better way of labelling each line? say 1.1.1?
Just a small suggestion.
* [Non-Functional Requirements](#non-functional-requirements) | ||
* [Glossary](#glossary) | ||
* [Instructions for manual testing](#instructions-for-manual-testing) | ||
|
||
## Acknowledgements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comprehensive acknowledgement of others.
Properly citing third-party libraries and tools ensures transparency and gives credit to the original creators.
This section showcases the developer's integrity and understanding of open-source norms.
**DG adapted from** | ||
|
||
* [Addressbook-level3](https://github.com/se-edu/addressbook-level3) | ||
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it would be good to have a Architecture Diagram showcasing your overall design and mechanism of FinancialPlanner. This would give the Developer their needed context should they want to further implement other features to integrate into your program
docs/DeveloperGuide.md
Outdated
* Advantage: Changes are saved after every command. | ||
* Disadvantage: Executing command might slow down the program when there is a large amount of data to be saved. | ||
|
||
### Visualization Feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos for integrating Xchart!
By having the visual aids, it would definitely allow the user to be aware of their expenses at a glance.
Even though FinancialPlanner is CLI, I like the GUI component added to enhance the UI/UX
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
|
||
### Storage Component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The relationship between Storage and SaveData/LoadData seems slightly confusing.
Typically, if Storage is a class providing functionalities like saving and loading, it may have methods for those, rather than being connected to abstract classes representing those actions.
Consider redefining these relationships for clarity.
A clearer distinction or some elaboration on what differentiates Cashflow and Budget would be beneficial.
According to the chart type (Pie/Bar) argument and the Hashmap obtained from the categorizer passed in, | ||
the visualizer displays the specified visualization chart by calling the charting library Xchart. | ||
|
||
### Class Diagram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visualizer seems to have methods that return some kind of chart, but the return types are not indicated.
It would be clearer if return types were included.
The relationship between Categorizer and other classes is not immediately evident.
Perhaps some connecting lines or indications of method calls/dependencies would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VIsualizer would do the showing of chart itself. Thus it is a void method call to visualizer to print the chart.
Thanks for the feedback on the class diagram!
Will work on that!
docs/DeveloperGuide.md
Outdated
|
||
![](images/vis/visualisationClass.png) | ||
|
||
### Sequence Diagram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the sequence diagram, it would be beneficial to include return arrows, especially for method calls that yield some kind of result.
The method printDisplayChart(type) is invoked on Ui from VisCommand, but from the class diagram, it seems like the method belongs to the Visualizer class. This discrepancy should be resolved for consistency.
Or am I just confusing myself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! I can see the confusion. printDisplayChart prints a message telling the user that a chart is being displayed. Visualizer has a method for displaying the actual chart. I have renamed the method for UI to make it clearer. I will add the return arrows as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall great DG! Very detailed description and plenty of diagrams and code snippets to transmit the content in an intuitive way. Maybe could try to make it more coherent by paying attention to how each detail is actually formatted (colors, bullet points etc.). Kudos also for the use of diagrams!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall very good DG, very precise and in depth analysis of the code and detailed description.
Maybe could use a single and coherent way of using bullet points (right now the DG contains >>, 1), 1. and Step 1). This could make the DG look as if actually written by a single person.
docs/DeveloperGuide.md
Outdated
## Acknowledgements | ||
|
||
**Xchart (A Simple Charting Library for Java)** | ||
- author: KNOWN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe there is a typo here: shouldn't it be author: KNOWM
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THanks for spotting!
docs/DeveloperGuide.md
Outdated
**DG adapted from** | ||
|
||
* [Addressbook-level3](https://github.com/se-edu/addressbook-level3) | ||
|
||
{list here sources of all reused/adapted ideas, code, documentation, and third-party libraries -- include links to the original source as well} | ||
|
||
## Design & implementation | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could add a brief introduction and overview of your Financial Planner, explaining the goal and purpose as well as its rough overall design in form of an arbitrary architecture diagram. This would also allow further developers an immediate insight into your product and align them with your ideas and implementations from the start.
docs/DeveloperGuide.md
Outdated
* Saving the data once upon exit (Currently implemented): | ||
* Advantage: Better efficiency and performance of the program. | ||
* Disadvantage: If the program crashes or exits incorrectly, data will not be saved. | ||
* Saving the data after every command: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it should be specified whether this way is currently implemented or not (as is done for the other option) to keep the considerations coherent. Right now I assume it is not, but I would still not be sure.
Output | ||
|
||
`Displaying piechart for expense` | ||
A message will be shown telling you that the chart is being displayed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice implementation. This feature is straightforward and meets the user requirements.
|
||
### Class Diagram | ||
|
||
![](images/vis/visualisationClass.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the text above Command and RawCommand are omitted, whereas it seems like there should be a dependency between the Categorizer and VisCommand. Maybe some more detailed steps could help clarify these doubts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback, will add it in!
|
||
Overall | ||
|
||
![](images/vis/visualisationSequence.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could include return arrows. Also it could perhaps be helpful to make the alt and opt boxes coherent by applying the coloring to all sequence diagrams in the DG (helps create impression that DG was written by a single person).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall very nice use of diagrams, except some minor bugs in the UML diagrams
|
||
Overall | ||
|
||
![](images/vis/visualisationSequence.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a <<class>> above Categorizer and Visualizer?
docs/DeveloperGuide.md
Outdated
|
||
#### Diagrams | ||
Given below is the class diagram showing the class structure of the add income/expense mechanism: | ||
![](images/CashflowClassDiagram.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you will want to refer to the PlantUML docs to remove the C and E circles to comply with our standard of UML diagrams.
According to the cashflow type (Income/Expense) arugment passed in, the Categorizer sorts the | ||
specified cashflow entry according to type using a Hashmap which is returned and used by the Visualizer | ||
|
||
Visualizer's Role: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use charts for user to visualize their income/expenses.
docs/DeveloperGuide.md
Outdated
![](images/CashflowClassDiagram.png) | ||
|
||
Given below is the sequence diagram showing the add income/expense mechanism: | ||
![](images/AddCashflowSequence.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Activation Bar is missing in this diagram. May want to refer to the Sequence Diagram examples in the CS2113 Website.
|
||
This feature has 5 functions, `set`, `update`, `delete`, `reset`, and `view`. | ||
|
||
![](images/Budget.png) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of reference frames for neater view of the diagram.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add on to previous comment
The current budget will be shown to the user through the `Ui`. | ||
|
||
Example: `budget view` | ||
|
||
|
||
## Product scope | ||
### Target user profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May want to add more User Stories to accurately reflect your actual feature implementation in each version.
Branch update dg
Branch ug quickfix
Fix bug in UGDG
Changes dg
Fix broken link
Add about us
Changes dg
Fix bug in UG
Branch dg quick fix
Final Final FInal Final changes
Add project portfolio page
Update aboutus page
Remove the non-existing John Doe from AboutUs.md
Financial Planner helps individuals manage their finances effectively and achieve their financial goals. The purpose of such an application is to provide users with a range of tools and features to help them better understand their financial situation.