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-W12-2] FindOurSEP #8

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

Conversation

ehz0ah
Copy link

@ehz0ah ehz0ah commented Sep 19, 2024

FindOurSEP is a tool designed for NUS administrative staff managing Student Exchange Program (SEP) allocations for Computer Engineering students. It streamlines the process of matching students with suitable universities based on academic profiles, preferences, and other criteria. This tool aims to enhance efficiency and accuracy in the complex task of SEP placement management.

Copy link

@wenxin-c wenxin-c left a comment

Choose a reason for hiding this comment

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

Some suggestions for the team to consider. Please standardise how empty lines are used in your codebase. Try not to use excessive empty lines as they are meant to group different logics, instead of simply in between every line/block. Overall good work, keep it up.

* @return The created Student object if all validations pass.
* @throws SEPException If any validation errors occur, a SEPException containing all error messages is thrown.
*/
public Student makeStudent(String input) throws SEPException {

Choose a reason for hiding this comment

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

createStudent might sound better haha?

public boolean parseInput(String input) {
String[] parts = input.split(" ");
switch (parts[0].toLowerCase()) {
case "add":

Choose a reason for hiding this comment

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

You could consider extracting the commands into constant as well for easy usage in other places or change later on.

Comment on lines 27 to 51
Future<StudentList> allocationTask = executor.submit(() -> {
return allocator.allocate();
});

// Submit the loading message task
Future<?> loadingTask = executor.submit(() -> {
while (!allocationTask.isDone()) {
this.ui.printAllocatingMessage();
}
});

// Check periodically if the allocation is done
while (!allocationTask.isDone()) {
Thread.sleep(100); // Small delay to avoid busy-waiting
}

// Interrupt the loading task once allocation is done
loadingTask.cancel(true);

// Retrieve the result of the allocation task
this.studentList.setStudentList(allocationTask.get());

// Shut down the executor service
executor.shutdown();

Choose a reason for hiding this comment

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

You could consider only leave spaces between different groups of logics, instead of between every line or block.

Comment on lines 122 to 131
Thread.sleep(500); // 500 milliseconds
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // Restore the interrupted status
} finally {
System.out.println("\r" + Messages.ALLOCATE_COMPLETE);
System.out.println(HORIZONTAL_LINE);
}
}

Choose a reason for hiding this comment

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

You could consider converting some numbers and strings into named constant to give it a meaning. It will be easier for future usage or change as well.

throw SEPEmptyException.rejectEmptyStudentList();
}

AsciiTable at = new AsciiTable();

Choose a reason for hiding this comment

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

You could consider give the variable a more meaningful name by giving a bit more description.

* Manages a list of students and provides methods for adding, deleting, sorting,
* printing and validating student data such as student ID, GPA, and preferences.
*/
public class StudentList {

Choose a reason for hiding this comment

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

This class is pretty long, you might consider extracting some methods into another helper class and invoke the relevant methods if needed, e.g. splitInput, validateStudentId etc.

Copy link

@Chinorea Chinorea left a comment

Choose a reason for hiding this comment

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

Overall No major Errors with the UML diagrams, just some minor error in class diagrams and sequence diagrams (Arrow Heads). well done

#### Allocate Command

#### Revert Command

Choose a reason for hiding this comment

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

image

Diagram image for RevertSequence and GenerateSequence is currently broken

@@ -1,22 +1,241 @@
# Developer Guide

## Table of Contents

Choose a reason for hiding this comment

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

Overall there are no major errors with the UML diagrams presented. Good job


Here is a class diagram highlighting the fundamental structure of the `Allocator` class.

![AllocatorClass](UML_Diagrams/AllocatorClass.drawio.svg)

Choose a reason for hiding this comment

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

image

The Solid Arrow for the class diagrams is incorrect. It should be a solid Triangle. You can refer to the Parser class diagram for the correct implementation.


``Allocator`` mainly participates in the execution of ``allocate`` command. The sequence diagram below showcases the program workflow when a user inputs the command ``allocate`` (assume before that several students have been added into the student list).

![AllocatorSequence](UML_Diagrams/AllocatorSequence.drawio.svg)

Choose a reason for hiding this comment

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

image

You can consider keeping the styling for all the names of the entities constant (Bolding of :Allocator entity).


Here is a class diagram highlighting the fundamental structure of the `Parser` class.

![ParserClass](UML_Diagrams/ParserClass.drawio.svg)

Choose a reason for hiding this comment

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

image

You could consider segmenting out the {abstract} Command class to improve its visibility, it currently looks like another command class.

Holy-An and others added 9 commits October 30, 2024 10:52
Sequence Diagrams for Criteria Command and Delete Command
Add Sequence diagram for find and filter commands
Add Sequence Diagram for Stats, Allocate, and ViewQuota Commands
Change some small bugs in the DG
Copy link

@TPH777 TPH777 left a comment

Choose a reason for hiding this comment

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

Overall quite well done! Most details pointed out are just suggestions to improve and there is no major flaw.

Comment on lines 88 to 89
The `UI` class methods typically return `void`, but will print responses directly to the console or handle user input,
streamlining interactions and allowing the backend to focus solely on data processing.
Copy link

Choose a reason for hiding this comment

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

Maybe its better to include when does it not return void


The sequence diagram below demonstrates the interactions within the `Parser` component when a user inputs the command: `add id/A1234567I gpa/5.0 p/{13,61,43}`.

![ParserSequence](UML_Diagrams/ParserSequence.drawio.svg)
Copy link

Choose a reason for hiding this comment

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

The return type should not have :


{Describe the design and implementation of the product. Use UML diagrams and short code snippets where applicable.}
Delete Command removes an exisiting Student in the StudentList.
Copy link

Choose a reason for hiding this comment

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

Maybe can explain in greater detail, particularly what is the return string for.

Choose a reason for hiding this comment

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

@paulktham 👀


#### Criteria Command

Criteria Command sets a minimum GPA every student must acheieve before they can be allocated to a university.
Copy link

Choose a reason for hiding this comment

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

May be irrelevant to DG, but the method name is inconsistent ('gpa' in setMinimumGPA and validateGpa).

Choose a reason for hiding this comment

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

@Holy-An 👀


Criteria Command sets a minimum GPA every student must acheieve before they can be allocated to a university.

![CriteriaCommandSequence](./UML_Diagrams/CriteriaCommand.drawio.svg)
Copy link

Choose a reason for hiding this comment

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

Similarly, its nice to explain how the returned float is used.

Choose a reason for hiding this comment

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

@paulktham 👀


The `StatCommand` class implements the `stats` command, which provides GPA-related statistics (average GPA or minimum GPA) for students associated with a specified university. The command syntax is `stats <stat_type> <UNI_INDEX>`, where `<stat_type>` can be `-avggpa` for average GPA or `-mingpa` for minimum GPA.

![StatSequence](UML_Diagrams/StatSequence.drawio.svg)
Copy link

Choose a reason for hiding this comment

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

I think its better to standardize all the sequence diagrams for your commands. Either make the activation bar starts form the Command class directly or use dotted line first.


The `ViewQuotaCommand` class handles the `viewQuota` command to display information about a university’s remaining quota (available spots) based on a specified university index.

![ViewQuotaSequence](UML_Diagrams/ViewQuotaSequence.drawio.svg)
Copy link

Choose a reason for hiding this comment

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

I think its better to leave the return variable name, spotsLeft out, since all the diagrams earlier do not have it.

Choose a reason for hiding this comment

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

@ThisisXXZ 👀


The `AllocateCommand` class manages the allocation process of students using the `Allocator` class. This command sets up an allocation process for students in the specified `StudentList` and informs the user that allocation is underway.

You could refer to [Allocator](#allocator) section to check the detailed workflow of ``AllocateCommand``.
Copy link

Choose a reason for hiding this comment

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

printResponse return arrow is not pointing properly.


#### Generate Command

![GenerateSequence](UML_Diagrams/GenerateCommandSequence.drawio.svg)
Copy link

Choose a reason for hiding this comment

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

the return arrow of Ui is not pointing properly

Copy link

@xenthm xenthm 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 writing your DG so far! I just have some issues with some UML diagrams.

Copy link

Choose a reason for hiding this comment

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

Based on your source code (caa 31/10/24 1531H):

public class UI {
    private static final int LINE_LENGTH = 80;
    public static final String HORIZONTAL_LINE = "-".repeat(LINE_LENGTH);
    private final Scanner scanner;
    ...
}

should the LINE_LENGTH and HORIZONTAL_LINE attributes in this diagram be underlined instead (to show that they are static)?

Copy link

Choose a reason for hiding this comment

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

Additionally, would it be better if the default values of your attributes are indicated in the class diagram (e.g. - LINE_LENGTH: int = 80

Copy link

Choose a reason for hiding this comment

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

Should the self invocations done by :StudentList have a return arrow too?
image

Copy link

Choose a reason for hiding this comment

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

Is there a better to way to express this loop:
image
given that your source code in Parser.java contains this code (caa 31/10/24 1545H):

public void deleteStudent(String input) throws SEPException{
    String[] parts = input.split("delete", 2);
    String studentId = organiseId(parts[1]);
    if (!studentId.matches(ID_REGEX)) {
        throw SEPFormatException.rejectIdFormat();
    }
    boolean isRemoved = students.removeIf(student -> student.getId().equals(studentId));
    if (!isRemoved) {
        throw SEPEmptyException.rejectStudentNotFound();
    }
}

There is no mention of the :String that is returned from StudentList::getId.

Choose a reason for hiding this comment

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

@paulktham 👀

Copy link

Choose a reason for hiding this comment

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

Should the operation and return arrows in this diagram leave a small gap in the activation bar?
image
I understand that the respective methods are called/the methods are returned immediately, but most of the examples in the textbook show a small gap:
image

ThisisXXZ and others added 30 commits November 12, 2024 11:43
Change Student class diagram link name
last fix to deletecommand diagram
Update Ug regarding preferences
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.

10 participants