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-W10-2] ExchangeCourseMapper #17

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

Conversation

chewycj
Copy link

@chewycj chewycj commented Sep 21, 2024

ExchangeCourseMapper allows users to plan their course mapping by listing the universities of interest, along with the specific courses and subject codes offered by each school. Users can quickly filter by NUS-coded modules or by partner universities (PU) when they want to view the relevant options.

Copy link

@okkhoy okkhoy 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 code is clean. Some minor issues are highlighted in the review. Please take a look and fix.

private static final Logger logger = Logger.getLogger(AddCoursesCommand.class.getName());


private static boolean isValidCourseMapping(String nusCourseInput, String puCourseInput,
Copy link

Choose a reason for hiding this comment

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

In general, all non-trivial methods need javadoc header comments

Comment on lines 76 to 79
System.out.println(INVALID_UNIVERSITY_INPUT);
System.out.println(LINE_SEPARATOR);
System.out.println(LIST_RELEVANT_PU);
System.out.println(LINE_SEPARATOR);
Copy link

Choose a reason for hiding this comment

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

Can you not use UI to do this job, rather than printing directly?

String command = input.replaceFirst("help", "").trim().toLowerCase();

switch (command) {
case "set":
Copy link

Choose a reason for hiding this comment

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

need explicit fallthrough comment

Copy link

@RCPilot1604 RCPilot1604 left a comment

Choose a reason for hiding this comment

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

Would it be possible extract out repeated sequential diagram segments using reference frames? For instance, ListSchoolCommand, FilterCoursesCommand, ObtainCoursesCommand etc all share createJsonObject which can be extracted out and the differences be depicted in a ref frame.

Overall, the sequence diagrams are a bit too long and complicated. Splitting them up using ref frames would be a good idea.

Also would it be a good idea to show the initial set up seqence as well in a sequence diagram that shows the full run-through of the code? Ref frames can be used here as well to simplify the sequence diagrams.


### Class Diagrams
Command Package:
![Class diagram for Commands](images/CommandClass.png)

Choose a reason for hiding this comment

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

Would it better to split this diagram into smaller, more bite-sized chunks for better readability?

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, thank you for the feedback, we will work on it!

* Line Separator is used to ensure readability and ease of use for users.

#### Sequence Diagram on PlantUML:
![Filter Courses Sequence Diagram](images/FilterCoursesCommand.png)

Choose a reason for hiding this comment

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

Should there be a third activation bar for "print PU and PU course code"?

Choose a reason for hiding this comment

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

Also should "throw new IOException()" be depicted as a solid black arrow within Command?

* Assertions and logging are used for error handling.

#### Sequence on PlantUML:
![ListUniCourseCommand sequence diagram](images/ListUniCoursesCommand.png)

Choose a reason for hiding this comment

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

Should there be an activation bar and dotted return arrow for "print course details"?

Choose a reason for hiding this comment

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

No group (i.e ListSchoolCommand)

Comment on lines 14 to 16
opt inputStream is null
Command -> Command: throw new IOException()
end

Choose a reason for hiding this comment

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

Exception arrow should go out

Comment on lines 15 to 17
opt inputStream is null
Command -> Command: throw new IOException()
end

Choose a reason for hiding this comment

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

Exception arrow should go out

Comment on lines +32 to +33
ListSchoolCommand --> CEG_Student
deactivate ListSchoolCommand

Choose a reason for hiding this comment

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

Should return something

Choose a reason for hiding this comment

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

No group

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the feedback! May we clarify the meaning of "No group"?

Comment on lines 153 to 160
#### Why it is implemented that way:
* The `execute` method is essential and unique to every command class so inheritance was used.
* Every method in the class remains maintainable and has one responsibility this allows easy debugging and
refactoring.
* By using inheritance, new command classes can easily extend the functionality of existing ones
which reducing redundancy in the code
* Logging and assertions helps the team of developers to follow through the command execution.

Choose a reason for hiding this comment

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

I guess this part is redundant and duplicated?

Comment on lines 67 to 72

### Class Diagrams
Command Package:
![Class diagram for Commands](images/CommandClass.png)

{TODO: Object Diagram}

Choose a reason for hiding this comment

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

Perhaps you can try to omit some unnecessary details to make it more readable.

The `UI`, `Parser` and `Storage` components (also shown in the diagram above),
* defines its API in a class with the same name as the Package

The `Command` component,

Choose a reason for hiding this comment

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

maybe you can try to illustrate other components here ?

Comment on lines 209 to 225
* The `AddCoursesCommand` class extends `Command` class where it overrides the `execute` method for
custom behaviour.
* The command first reads a JSON file to obtain the names via `createJsonObject()` method from the
superclass.
* The `trimString` method then removes the `add` command and checks whether the user gave any input after the command.
The method would return the user's input without the command.
* This input is then passed into the `parseAddCommand()` method to obtain the relevant information: NUS course code,
name of partner university and partner university course code.
* Along with the JSON Object created from the `createJSONObject()` method, the information extracted from the
`parseAddCommand()` method would be passed to the `isValidInput()` method to verify the user's course mapping.
* In the `isValidInput()` method, the `getPUCourseList()` method is called to verify the user's partner university is
included in the dataset. An exception is thrown if the university is not found in the dataset.
* Afterward, the `isValidCourseMapping` checks whether the NUS course code and PU course code are compatible for
course mapping.
* If both checks above are passed, the course mapping would be added to the `myList.json` file.
* Throughout the code, exceptions, assertions and logging are in place for better error handling.
* Line Separator is used to ensure readability and ease of use for users.

Choose a reason for hiding this comment

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

Perhaps adding some diagrams here will make it easier to understand?

Copy link

@limkongkiat limkongkiat left a comment

Choose a reason for hiding this comment

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

Good job overall, just a few nits with some of the diagrams. Keep it up!

* Line Separator is used to ensure readability and ease of use for users.

#### Sequence Diagram on PlantUML
![Add Courses Sequence Diagram](images/AddCoursesCommand.png)

Choose a reason for hiding this comment

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

Perhaps you could standardize whether you use User or CEG_Student?

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, our team will work on it!

* Line Separator is used to ensure readability and ease of use for users.

#### Sequence Diagram on PlantUML
![Delete Courses Sequence Diagram](images/DeleteCoursesCommand.png)

Choose a reason for hiding this comment

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

Perhaps it would be better to standardize whether or not there are activation bars?

* Line Separator is used to ensure readability and ease of use for users.

#### Sequence Diagram on PlantUML
![Add Courses Sequence Diagram](images/AddCoursesCommand.png)

Choose a reason for hiding this comment

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

Maybe you could ensure that all arrows are properly connected to the bar?

readability.

#### Sequence Diagram on PlantUML:
![Filter Courses Sequence Diagram](images/ObtainContactsCommand.png)

Choose a reason for hiding this comment

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

Perhaps you could include an [else] label for the first alt block for greater clarity?

Copy link

@glenda-1506 glenda-1506 left a comment

Choose a reason for hiding this comment

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

Great job! The diagrams were well-drawn with minor errors. Perhaps you could consider colour-coding your sequence diagrams like the Architecture Diagram?

Comment on lines +253 to +254
* Throughout the code, exceptions, assertions and logging are in place for better error handling.
* Line Separator is used to ensure readability and ease of use for users.

Choose a reason for hiding this comment

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

As these 2 lines are repeated throughout the DG, perhaps you could put it at the top and just mention it once?

Copy link
Author

Choose a reason for hiding this comment

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

That's true, it is repeated throughout our DG 😮 we will extract it out and mention it once, thank you for the feedback!

readability.

#### Sequence Diagram on PlantUML:
![Filter Courses Sequence Diagram](images/ObtainContactsCommand.png)

Choose a reason for hiding this comment

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

Should this be CEG_Student, instead of User?

* Line Separator is used to ensure readability and ease of use for users.

#### Sequence Diagram on PlantUML
![Delete Courses Sequence Diagram](images/DeleteCoursesCommand.png)

Choose a reason for hiding this comment

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

Should there be a dotted return arrow for the deleteCourse(listIndex : int)?

|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 ... |
|---------|--------------|-----------------------------------------------------------------|----------------------------------------------------------------|
| v1.0 | CEG students | see the possible Oceania and South East Asia partner university | see all my possible choices in those regions |

Choose a reason for hiding this comment

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

I think this is a typo, it should standardise this with the rest?

hzxnancy and others added 30 commits November 12, 2024 02:14
[Improvement] Fix minor grammatical errors and update CourseValidator sequence diagram
…into improvement/List-schools-implementation
…ementation

[Improvement] Update List school why it is implemented
Extract method to align with AddCoursesCommand seq diagram
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.