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

[AY1920S1-CS2113T-W13-1] Coach Manager #87

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

Conversation

Sfloydzy
Copy link

@danisheddie @eujingsen @NotTheRealEdmund

Copy link

@flxffy flxffy left a comment

Choose a reason for hiding this comment

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

ignore this review

Copy link

@flxffy flxffy left a comment

Choose a reason for hiding this comment

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

A lot more refactoring needs to be done.

Things to note:

  1. There are a few variables that should be constants but are not.
  2. Controller is well done.
  3. Look up default constructors. Don't leave empty constructors that don't do anything.
  4. Good use of interfaces in Details.
  5. Code that have been commented out - those can be deleted.
  6. Conditional paths - in some cases, the flow could be better. Choose the happy path when it makes sense.
  7. Read the docs!! Data structures offered in Java are pretty robust and already offer a lot of what you are trying to implement.
  8. Why do you have tests from Duke, and dummy tests?

Comment on lines 34 to 42
/**
* Constructor for CategoryList.
* @param subMenuDescription The description for the sub menu.
* @param menu The name of the menu
*/
public CategoryList(final String subMenuDescription, final String menu) {
super(subMenuDescription, menu);
}

Copy link

Choose a reason for hiding this comment

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

Why is the constructor at the end of the class?

Comment on lines 29 to 40
// public void trainingScheduleHeading() {
// System.out.flush();
// System.out.println("TRAINING SCHEDULE: \n");
// }
// public void manageStudentsHeading() {
// System.out.flush();
// System.out.println("MANAGE STUDENTS: \n");
// }
// public void trainingProgramHeading() {
// System.out.flush();
// System.out.println("TRAINING PROGRAM: \n");
// }
Copy link

Choose a reason for hiding this comment

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

Don't leave commented out code. Just go ahead and delete unused code. Now that we are using a revision control system, we can recover any deleted code later.

Comment on lines 48 to 52
if (!hasGoal) {
return "There is no goal of the day";
} else {
return message;
}
Copy link

Choose a reason for hiding this comment

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

This conditional path could flow better for readability. Consider setting the happy path first.

Comment on lines 38 to 46
for (Date d : lessons.keySet()) {
if (d.equals(today)) {
if (!lessons.get(d).isEmpty()) {
hasLesson = true;
for (String str : lessons.get(d)) {
message += str + "\n";
}
}
}
Copy link

Choose a reason for hiding this comment

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

This logic is convoluted and uses unnecessary nesting. Look through the Map documentation and you'll find a better way to do this!

Comment on lines 44 to 52
/**
* Getter function to get the current date.
* @return A string containing the current date.
*/
public final Date getTodayDate() {
System.out.println("Today's date " + todayDate);
System.out.println("Saved date: " + endDate);
return todayDate;
}
Copy link

Choose a reason for hiding this comment

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

Violating single responsibility principle. Think about why this is so

/**
* Represents the list for the current number of plans saved.
*/
private ArrayList<String> toc = new ArrayList<>();
Copy link

Choose a reason for hiding this comment

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

What is toc? Use a more descriptive variable name.

* @throws FileNotFoundException if file is not found.
*/
public MyPlan() throws FileNotFoundException {
filePath = ".\\src\\main\\java\\duke\\data\\plan.txt";
Copy link

Choose a reason for hiding this comment

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

Windows file path? Are you sure this works on all platforms? Refer to the project constraints, your product should be cross-platform compatible.

Comment on lines 307 to 320
/**
* Create a plan of specified intensity.
* @param intensity intensity of plan to be created.
*/
public void createPlan(final String intensity) {
clearPlan();
if (Intensity.contains(intensity)) {
System.out.println("Creating plan of " + intensity + " intensity.");
System.out.println("Please input activity to add in format of "
+ "[activity] [number of sets] [number of reps].");
while (true) {
Scanner sc = new Scanner(System.in);
if (sc.hasNextLine()) {
String input = sc.nextLine();
Copy link

Choose a reason for hiding this comment

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

Should MyPlan be scanning user input? This is violating one of the design principles we went through last week.

/**
* status: whether Item is complete or not.
*/
private Boolean status;
Copy link

Choose a reason for hiding this comment

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

Your variable name isn't descriptive nor indicative of what it is meant for. Refer to the coding style for a more appropriate name.

Comment on lines +77 to +79
public String getDate() {
return "";
}
Copy link

Choose a reason for hiding this comment

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

Why is the getter returning an empty string?

Sfloydzy and others added 30 commits November 11, 2019 20:50
Added testings and edited progress list for students
MyPlan: Functionalities added(Still in progress)
Merge ppp updates and tests
MyPlan fixed functionalities
Final Changes to gradle file
Txt file directory for JAR fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants