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-T17-1] AthletiCLI #16

Open
wants to merge 1,052 commits into
base: master
Choose a base branch
from

Conversation

AlWo223
Copy link

@AlWo223 AlWo223 commented Oct 5, 2023

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.

Brian030601 added a commit to Brian030601/tp that referenced this pull request Oct 18, 2023
Copy link

@woowenjun99 woowenjun99 left a 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";

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

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?

Comment on lines 33 to 38
@Override
public String unparse(ActivityGoal activityGoal) {
// TODO
return null;
}
}

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?

Comment on lines +15 to +22
/**
* 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);
}

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";

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 {

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?

Copy link

@Jonoans Jonoans left a 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

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"/>
Copy link

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.

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"/>
Copy link

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

|--------|----------|---------------|------------------|
|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 ... |
Copy link

Choose a reason for hiding this comment

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

Nice list of stories!

Copy link

@WooKaiNing WooKaiNing left a 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


**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:

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.

| 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 |

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

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.


### Sleep Management in AthletiCLI

#### [Implemented] Adding, Editing, Deleting, Listing Sleep
Copy link

@WooKaiNing WooKaiNing Nov 1, 2023

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?


This following sequence diagram show how the 'set-diet-goal' command works:

<p align="center" width="100%">

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?

Copy link

@lckjosh lckjosh left a 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!

Copy link

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.

Copy link

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 ... |
Copy link

Choose a reason for hiding this comment

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

image Perhaps a space between 'Version' and 'As a...' would make things more readable.

Copy link

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.

Copy link

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.

Copy link

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`.

Choose a reason for hiding this comment

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

Should your class diagram show the accessibility of the functions in it?
Screenshot 2023-11-02 at 5 23 24 PM
Screenshot 2023-11-02 at 5 23 32 PM

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.

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)

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)

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?

- `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.

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?

Comment on lines 189 to 199
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.

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

Comment on lines 202 to 205
<p align="center" >
<img width="100%" src="images/AddActivityGoal.svg" alt="Sequence Diagram of set-activity-goal"/>
</p>

Choose a reason for hiding this comment

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

The colour for the AtheleticCLI class background makes it difficult to read on some screens. Consider changing it to a color with more contrast to the black text?
Screenshot 2023-11-02 at 5 37 12 PM

Comment on lines 238 to 239
<p align="center" width="100%">
<img width="80%" src="images/SleepAndSleepListClassDiagram.svg" alt="Class Diagram of Sleep and SleepList"/>

Choose a reason for hiding this comment

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

Class diagram is extremely cluttered with methods. Are there any methods which are less important to the overall functionality which can be removed? Doing so might make it easier to read and understand.
Uploading Screenshot 2023-11-02 at 5.38.42 PM.png…

Copy link

@charkty charkty left a 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!

Copy link

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?

Copy link

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.

Copy link

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?

Copy link

Choose a reason for hiding this comment

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

image
Should there be a broken activation bar?

Comment on lines 104 to 123
**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.
Copy link

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.

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
Copy link

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?

Copy link

@Haoyuli2002 Haoyuli2002 left a 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

Choose a reason for hiding this comment

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

Overall I think this is a pretty good sequence diagram, however, I think it might be better to separate the cross sign and the dash line of your method, you may see the marks in the following screenshot
IMG_1481


### Overview

The class diagram shows the relationship between `AthletiCLI`, `Ui`, `Parser`, and `Data`.

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

Choose a reason for hiding this comment

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

This diagram looks generally comprehensive but I think you the activation bar should end only if the self invocation is done.
IMG_1483

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.

DaDevChia and others added 30 commits November 14, 2023 01:52
Add captions for DG images for PPP
Add sleep command and sleep list feature to Developers Guide
Replace 'command' with `command` in DG
PPP Update - Fix Page Layout
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.