-
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-T17-1] AthletiCLI #16
base: master
Are you sure you want to change the base?
[CS2113-T17-1] AthletiCLI #16
Conversation
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 team did a great job in their implementation.
In terms of software engineering, I can see that they abided to most of the good code quality and practices. However, there are 2 things to take note of. Firstly, assertions are different from exceptions. It is good to write many assertions to make the code defensive, but they are just to verify the programmer's assumption that if the line is reached, it should not fail. Error handling still has to be carried out. For example, a proper usage of assertion is :
if (fat < 0) {
// Throw exception here
}
assert fat >= 0;
We have already handled the case that fat is less than 0, and therefore the assertion will definitely pass. This is especially good when there is a chain of responsibility, like if we already handled the exception in method A and put the assertion in method B which depends on the value from method A, it should be true.
Second point would be that I notice many methods in the diet are empty and not implemented yet. It might be better to implement them soon or delete them first since it is just dead code.
In terms of Object Oriented Programming, it is done well in the sense that I can tell there is Single Responsibility Principle and each models have their own attributes. Their activity command class is in charge of causing the various objects to interact with each other
|
||
@Test | ||
void parseDietGoalSetEdit_oneInvalidGoal_throwAthletiException() { | ||
String invalidGoalString = "calories/caloreis protein/protein"; |
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.
I believe this is a constant so you can use capital letters to abide by the code quality, so does the rest of the variables here in this file
docs/DeveloperGuide/AddActivity.png
Outdated
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 might be better to use a better variable name instead of a
and c
?
@Override | ||
public String unparse(ActivityGoal activityGoal) { | ||
// TODO | ||
return null; | ||
} | ||
} |
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 we can remove these lines of code first since it is unused?
/** | ||
* Constructs a <code>Ui</code> object, whose input <code>in</code> | ||
* and output <code>out</code> is the standard input and the standard | ||
* output, respectively. | ||
*/ | ||
private Ui() { | ||
this(System.in, System.out); | ||
} |
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.
There is no need for function overloading. You can just use the constructor below and pass in the System.in
and System.out
unless there is a very good reason why you need it
* @param messages The messages to be shown. | ||
*/ | ||
public void showMessages(String... messages) { | ||
assert messages != null : "Messages should not be null"; |
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.
Do note that assertions are not the same as throwing exceptions. They should not be used to replace the error handling during run time. They are only used to test certain assumptions
/** | ||
* Represents a list of sleep records. | ||
*/ | ||
public class SleepList extends StorableList<Sleep> implements Findable { |
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 we can remove this class because most of the methods are not implemented?
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 the DG is pretty nice with good amount of details, just the diagrams could be better :D
docs/DeveloperGuide.md
Outdated
This following sequence diagram show how the 'set-diet-goal' command works: | ||
|
||
<p align="center" width="100%"> | ||
<img width="80%" src="images/setDietGoalUmlSequenceDiagram.svg" alt="'set-diet-goal' 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.
Maybe the diagram needs to be updated to reflect the current implementation? It seems to be a little different.
docs/DeveloperGuide.md
Outdated
This following sequence diagram show how the 'set-diet-goal' command works: | ||
|
||
<p align="center" width="100%"> | ||
<img width="80%" src="images/setDietGoalUmlSequenceDiagram.svg" alt="'set-diet-goal' 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.
Maybe it would help to include variable names in the diagram? I.e. it may not be immediately clear which object's execute() is called unless we look into the code/make educated guesses
docs/DeveloperGuide.md
Outdated
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
| Version | As a ... | I want to ... | So that I can ... | |
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 list of stories!
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 DG is detailed, good use of sequence diagrams
docs/DeveloperGuide.md
Outdated
|
||
**Step 5 - User Interaction:** Once the activity is successfully added, a confirmation message is displayed to the user. | ||
|
||
The following sequence diagram shows how the `add-activity` operation works: |
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 maintain same format of explaining feature implementation to ensure consistency; ie. similar to [Implemented] Setting Up of Diet Goals where image of sequence diagram is first attached before detailed explanation.
docs/DeveloperGuide.md
Outdated
| v1.0 | sleep deprived user | delete a sleep entry | remove outdated or incorrect data from my sleep records | | ||
| v1.0 | sleep deprived user | view all my sleep records | have a clear overview of my sleep habits and make informed decisions on my sleep | | ||
| v1.0 | sleep deprived user | edit my sleep entries | correct any mistakes or update my sleep information as needed | | ||
| v2.0 | user | find a to-do item by name | locate a to-do without having to go through the entire list | |
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 be more specific in identifying what are the possible criterions of "to-do". for example, is it referring to an activity / diet / sleep entry, or is it the goals?
Step 8. After executing the SetDietGoalCommand, SetDietGoalCommand returns a message that is passed to | ||
AthletiCLI to be passed to UI(not shown) for display. | ||
|
||
#### [Implemented] Adding activities |
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 be better to put the adding of activities in a separate section instead of under diet goals since the adding of activities is not related to the diet goals based on sequence diagram.
docs/DeveloperGuide.md
Outdated
|
||
### Sleep Management in AthletiCLI | ||
|
||
#### [Implemented] Adding, Editing, Deleting, Listing Sleep |
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 there find function for sleep entries as well?
docs/DeveloperGuide.md
Outdated
|
||
This following sequence diagram show how the 'set-diet-goal' command works: | ||
|
||
<p align="center" width="100%"> |
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.
include self-invocation of initializeIntermmediateDietGoals method?
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 a good and comprehensive DG, just a few tiny nits!
docs/images/AddActivity.svg
Outdated
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 black words ":AthletiCLI" is a bit hard to read against the dark background. Perhaps a different colour would make it more readable.
docs/images/HelpAddDiet.svg
Outdated
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 a consistent use of colour for the different entities across sequence diagrams would make things look a little neater.
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
| Version | As a ... | I want to ... | So that I can ... | |
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.
docs/images/DataClassDiagram.svg
Outdated
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 the arrow from ActivityList to StorableList could be straight instead of curved, and also not overlap with the arrow from DietList to StorableList.
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 the lines could be straight and not curved to make it look slightly neater.
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 could edit the diagram such that the lifeline stops after the X to conform to the UML standard we learnt in class.
|
||
### Overview | ||
|
||
The class diagram shows the relationship between `AthletiCLI`, `Ui`, `Parser`, and `Data`. |
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.
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! However we cannot seem to find a way to label it with PUML. Perhaps you could share the software that you are using for your class 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.
Your UML Diagramm looks good to me but it might be better to delete the square used for attributes and methods if this class doesn’t have it at all.
|
||
The _Sequence Diagram_ below shows how the components interact with each other for the scenario where the user issues the command `help add-diet`. | ||
|
||
![](images/HelpAddDiet.svg) |
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.
Well-made diagram!
|
||
The `Storage` component only interacts with the `Data` component. The _Sequence Diagram_ below shows how they interact with each other for the scenario where a `save` command is executed. | ||
|
||
![](images/Save.svg) |
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.
Data is not deactivated after return arrow. Should this be the case?
docs/DeveloperGuide.md
Outdated
- `list-diet` for listing all diets. | ||
- `find-diet 2021-09-01` for finding diets of a particular date. | ||
|
||
2. **Command Identification**: The Parser Class identifies the type of diet operation and passes the necessary parameters. |
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 published website, the numbering reads 1., 7, ..., 10. Is there something that can be done about this?
docs/DeveloperGuide.md
Outdated
1. **Step 1 - Input Capture:** The user issues a `set-activity-goal ...` which is captured and passed to the | ||
Parser by the running AthletiCLI instance. | ||
2. **Step 2 - Goal Parsing:** The Parser parses the raw input to obtain the sports, target and timespan of the goal. | ||
Given that all these parameters are provided correctly and no exception is thrown, a new activity goal object is | ||
created. | ||
3. **Step 3 - Command Parsing:** In addition the parser will create a `SetActivityGoalCommand` object with the newly | ||
added activity goal attached to it. The command implements the `SetActivityGoalCommand#execute()` operation and is | ||
passed to the AthletiCLI instance. | ||
4. **Step 4 - Goal Addition:** The AthletiCLI instance executes the `SetActivityGoalCommand` object. The command will | ||
access the data and retrieve the currently stored list of activity goals stored inside it. The new `ActivityGoal` | ||
object is added to the list. |
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 format! Labelling each of the steps makes it easy to understand what is being done in each step
docs/DeveloperGuide.md
Outdated
<p align="center" > | ||
<img width="100%" src="images/AddActivityGoal.svg" alt="Sequence Diagram of set-activity-goal"/> | ||
</p> | ||
|
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.
docs/DeveloperGuide.md
Outdated
<p align="center" width="100%"> | ||
<img width="80%" src="images/SleepAndSleepListClassDiagram.svg" alt="Class Diagram of Sleep and SleepList"/> |
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.
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, I like the variety of diagrams and the detail that your document guide has. Some diagrams could be simplified (adding only relevant methods) but overall, it is a very good DG!
docs/images/MainClassDiagram.svg
Outdated
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 your arrows be pointing upwards instead?
docs/images/Save.svg
Outdated
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.
I like that you started from SaveCommand for simplicity.
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.
I like the variety of this class diagram where inheritance and dependencies are used. Can dependency be mixed with inheritance for your arrow from SleepList to Findable?
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.
docs/DeveloperGuide.md
Outdated
**Step 1:** The input from the user ("set-diet-goal fats/1") runs through AthletiCLI to the Parser Class. | ||
|
||
**Step 2:** The Parser Class will identify the request as setting up a diet goal and pass in the parameters | ||
"fats/1". | ||
|
||
**Step 3:** A temporary dietGoalList is created to store newly created diet goals. | ||
|
||
{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.} | ||
**Step 4:** The inputs are verified against our lists of approved diet goals. | ||
|
||
**Step 5:** For each of the diet goals that are valid, a dietGoal object will be created and stored in the | ||
temporary dietGoalList. | ||
|
||
**Step 6:** The Parser then creates for an instance of SetDietGoalCommand and returns the instance to | ||
AthletiCLI. | ||
|
||
**Step 7:** AthletiCLI will execute the SetDietGoalCommand. This adds the dietGoals that are present in the | ||
temporary list into the data instance of DietGoalList which will be kept for records. | ||
|
||
**Step 8:** After executing the SetDietGoalCommand, SetDietGoalCommand returns a message that is passed to | ||
AthletiCLI to be passed to UI(not shown) for display. |
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.
I like how clear your steps are and how straight to the point it is.
docs/DeveloperGuide.md
Outdated
The fulfillment of these goals is tracked automatically and can be evaluated by the user at any time. | ||
|
||
These are the key components and their roles in the architecture of the goal tracking: | ||
* `SetActivityGoalCommand`: encapsulates the execution of the `set-activity-goal` command. It adds |
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 the set-activity-goal command a bit long for a cli input?
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.
Your DG is quite good but some modification or improvement might make it even better!
AthletiCLI -> Ui++ : showMessages(feedback) | ||
Ui --> AthletiCLI-- | ||
|
||
destroy HelpCommand |
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.
|
||
### Overview | ||
|
||
The class diagram shows the relationship between `AthletiCLI`, `Ui`, `Parser`, and `Data`. |
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.
Your UML Diagramm looks good to me but it might be better to delete the square used for attributes and methods if this class doesn’t have it at all.
|
||
By following these general steps, AthletiCLI ensures a streamlined process for managing diet-related tasks. | ||
|
||
#### [Implemented] Setting Up of Diet Goals |
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.
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.
Also I think it might be better that the cross signal indicating the end of the activation bar should be attached directly to the activation bar.
Improve test coverage for diet goals
User Guide Update and Numerous Bug Fix
Co-authored-by: Yang Ming-Tian <[email protected]>
Update skylee03's PPP
Update README.md
Add captions for DG images for PPP
Add sleep command and sleep list feature to Developers Guide
Fix DG numbering
Final minor bugfixes for sleep
Minor update to UG
Replace 'command' with `command` in DG
PPP Update
PPP Update - Fix Page Layout
AthletiCLI helps athletes track their activities, workouts, diets and well-being in general. It is optimised for CLI users so that they can add their activities very quickly.