Skip to content

Commit

Permalink
Merge pull request AY2324S2-CS2103T-T09-4#127 from Jajared/jared/upda…
Browse files Browse the repository at this point in the history
…te-dg

Add DG section for add student to class
  • Loading branch information
Zack-Tay authored Mar 29, 2024
2 parents 9cedd11 + a4f9681 commit 1db87a6
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 54 deletions.
156 changes: 102 additions & 54 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,22 +241,70 @@ The following activity diagram summarizes what happens when a user executes a ne

**Aspect: How undo & redo executes:**

- **Alternative 1 (current choice):** Saves the entire address book.
- Pros: Easy to implement.
- Cons: May have performance issues in terms of memory usage.

* **Alternative 1 (current choice):** Saves the entire address book.
* Pros: Easy to implement.
* Cons: May have performance issues in terms of memory usage.

- **Alternative 2:** Individual command knows how to undo/redo by
* **Alternative 2:** Individual command knows how to undo/redo by
itself.
* Pros: Will use less memory (e.g. for `delete`, just save the person being deleted).
* Cons: We must ensure that the implementation of each individual command are correct.
- Pros: Will use less memory (e.g. for `delete`, just save the person being deleted).
- Cons: We must ensure that the implementation of each individual command are correct.

_{more aspects and alternatives to be added}_

### \[Proposed\] Data archiving

_{Explain here how the data archiving feature will be implemented}_

### \[Implemented\] Add student to tutorial class

The implemented search mechanism is facilitated by the abstract `AddStudentToClassCommand` along with its specific commands `AddStudentToClassByEmailCommand`, `AddStudentToClassByIdCommand` and `AddStudentToClassByIndexCommand`, as well as the parser `AddStudentToClassCommandParser`.

`AddStudentToClassCommandParser` implements the `Parser` interface and its operations.

`AddStudentToClassCommand` extends the `Command` class and contains auxillary operations that supports the mechanism, such as retrieving the target tutorial class. Each of the following commands further extends `AddStudentToClassCommand` based on its specific functionality:

- `AddStudentToClassByEmailCommand` — Add student based on specified email to a tutorial class.
- `AddStudentToClassByIdCommand` — Add student based on specified student id to a tutorial class.
- `AddStudentToClassByIndexCommand` — Add student based on specified index (viewable from the UI) to a tutorial class

Given below is an example usage scenario and how the add mechanism behaves at each step.

Example: `/add_student_to_class id/A01234567X module/CS2103T tutorial/T09`

<puml src="diagrams/AddStudentToClassSequence.puml" alt="AddStudentToClassSequence" />

Step 1. The user executes `/add_student_to_class id/A01234567X module/CS2103T tutorial/T09` command to add the particular student with id `A01234567X` to the module `CS2103T` and tutorial class `T09`.
The `execute` command calls `AddressBookParser#parseCommand()`, which extracts the command word of the command and the arguments of the command.

Step 2. The `AddressBookParser` then creates a new `AddStudentToClassCommandParser` and calls `AddStudentToClassCommandParser#parse()`, with `id/A01234567X`, `module/CS2103T` and `tutorial/T09` as the arguments.

Step 3. The `AddStudentToClassCommandParser` parses the arguments to determine what parameter is used to specify the target student (email, index or id). Additionally, the `ModuleCode` and `TutorialClass` is determined.

<box type="info" seamless>

**Important Note:** The tutorial class and module code must be specified. To determine the target student, only one prefix should used per command. If there are multiple prefixes, the target priority is as follows: By Index -> By Student ID -> By Email

</box>

Step 4. Based on the prefix used, `AddStudentToClassCommandParser` creates the specific `AddStudentToClassCommand` accordingly. Each command contains a specific predicate to find the student.

Step 5. `LogicManager` calls `AddStudentToClassCommand#execute()`, passing `Model` as an argument. This method retrieves the target module and tutorial class. Then, the method retrieves the student to add using the defined predicate. Throughout the process, error handling (e.g checking for invalid student/module/tutorial) is utilised to mitigate potential discrepancies and ensure valid execution.

Step 6. Finally, a `CommandResult` is created and the student is added to the tutorial class.

#### Design considerations:

**Aspect: Modularity and extensibility:**

- **Alternative 1 (current choice):** Seperate each specific command into a different class, while overlapping code is abstracted to an abstract class.
- Pros: Specific commands are instantiated and thus can be easily traced and is more readable. Any reusable code is defined in the abstract class which can then be reused by the subclasses.
- Cons: May have duplicate code to a certain extent.

* **Alternative 2:** Lump into one generic command that handles each parameter accordingly.
- Pros: Reduces duplicate code and much cleaner (i.e only 1 command class is executed).
- Cons: The logic handling may be slightly more complex and messy within the class as all parameters have to be dealt with seperately (potentially using different logic).

### \[Implemented\] Searching for students

The implemented search mechanism is facilitated by `SearchStudentCommand` and `SearchStudentCommandParser`.
Expand All @@ -278,7 +326,7 @@ Step 1. The user executes `/search_student name/Bob` command to find students wi
The `execute` command calls `AddressBookParser#parseCommand()`, which extracts the command word of the command and the
arguments of the command.

Step 2. The `AddressBookParser` then creates a new `SearchStudentCommandParser` and calling
Step 2. The `AddressBookParser` then creates a new `SearchStudentCommandParser` and calling
`SearchStudentCommandParser#parse()`, with `name/Bob` as the argument.

Step 3. The `SearchStudentCommandParser` parses the arguments to determine which prefix the user is searching in.
Expand All @@ -301,13 +349,12 @@ Step 6. Finally, a `CommandResult` is created and the new filtered is displayed
### Design considerations:

- **Alternative 1 (current choice):** Only one prefix allowed per command.
- Pros: Easy to implement.
- Pros: Easy to implement.
- Cons: Does not allow users to fine tune searches based on multiple fields.

- **Alternative 2:** Allow for multiple prefixes.
- Pros: Users can filter searches to a higher degree
- Cons: Handling combinations of different fields could be complex

---

## **Documentation, logging, testing, configuration, dev-ops**
Expand Down Expand Up @@ -338,15 +385,15 @@ Step 6. Finally, a `CommandResult` is created and the new filtered is displayed

Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unlikely to have) - `*`

| Priority | As a …​ | I want to …​ | So that I can…​ |
|----------|---------|-------------------------------------------------------------------------------|------------------------------------------------------------------------|
| `* * *` | TA | add new students to a class | maintain an up-to-date list of enrolled students. |
| `* * *` | TA | add partial info of students | still add students even if I don’t have all their information. |
| `* * *` | TA | delete a student from my class if they drop the module/class | keep my class list accurate and up-to-date. |
| Priority | As a …​ | I want to …​ | So that I can…​ |
| -------- | ------- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
| `* * *` | TA | add new students to a class | maintain an up-to-date list of enrolled students. |
| `* * *` | TA | add partial info of students | still add students even if I don’t have all their information. |
| `* * *` | TA | delete a student from my class if they drop the module/class | keep my class list accurate and up-to-date. |
| `* * ` | TA | search for my students based on their NUS ID, emails, names or tutorial groups | locate details of students without having to go through the entire list |
| `* * *` | TA | view all students and their particulars | have a comprehensive overview of the enrolled students in my class. |
| `* *` | TA | add/remove different modules I am teaching | manage my teaching assignments efficiently. |
| `* * *` | TA | view all the tutorial classes and their information | visibility into the schedule and details of all tutorial classes. |
| `* * *` | TA | view all students and their particulars | have a comprehensive overview of the enrolled students in my class. |
| `* *` | TA | add/remove different modules I am teaching | manage my teaching assignments efficiently. |
| `* * *` | TA | view all the tutorial classes and their information | visibility into the schedule and details of all tutorial classes. |

_{More to be added}_

Expand All @@ -361,7 +408,7 @@ _{More to be added}_
1. User specifies the student to be added.
2. System adds the student to the list of students.
3. System indicates successful addition of new student.
Use case ends.
Use case ends.

**Extensions:**

Expand All @@ -387,7 +434,7 @@ Use case ends.

1. User specifies the student to be deleted.
2. System deletes the student from the list of students and tutorial group (if any).
Use case ends.
Use case ends.

**Extensions:**

Expand All @@ -401,15 +448,15 @@ Use case ends.
- Use case ends.
- 1c. Invalid input command.
- 1c1: Returns an error indicating command not recognised and provides the correct command format.
<br>
<br>

#### Use case 3: Search for students

**MSS:**

1. User specifies the student to be searched for.
2. System generates a list of matching entries according to specified parameters.
Use case ends.
Use case ends.

**Extensions:**

Expand All @@ -421,15 +468,15 @@ Use case ends.
- Use case ends.
- 2a. Partial match for specified parameter.
- 2a1. System will display all matching results for the specified value.
<br>
<br>

#### Use case 4: View all students

**MSS:**

1. User wants to view all students' information.
2. System displays all students information (name, email, student id and tutorial class).
Use case ends.
Use case ends.

**Extensions:**

Expand All @@ -440,15 +487,15 @@ Use case ends.
- 1b1. System will ignore those arguments and execute the command as usual.
- 2a. No existing students in the list.
- 2a1. System will return a message indicating that there are no students in the list.
<br>
<br>

#### Use case 5: Add new tutorial class

**MSS:**

1. User specifies the class to be added.
2. System adds the tutorial class.
Use case ends.
Use case ends.

**Extensions:**

Expand All @@ -461,42 +508,44 @@ Use case ends.
- 1c. The specified tutorial class already exists.
- 1c1: Returns an error indicating that the tutorial class already exists
- Use case ends.
<br>
<br>

#### Use case 6: Delete tutorial class

**MSS:**

1. User specifies the class to be deleted.
2. System deletes the tutorial class.
Use case ends.
Use case ends.

**Extensions:**

- 1a. Invalid input command.
- 1a1. Return an error indicating command not recognised and provides the correct command format.
- Use case ends.
- 1b. The tutorial class specified does not exist.
- 1b1. Returns an error indicating invalid tutorial class and shows the list of tutorial classes available.
- Use case ends.
<br>
<br>

#### Use case 7: View all classes

**MSS**

1. User wants to view all classes.
2. System shows a list of all available classes.
Use case ends.
Use case ends.

**Extensions**

- 1a. Invalid input command.
- 1a1. Return an error indicating command not recognised and provides the correct command format.
- Use case ends.
- 1b. Additional arguments are specified after the command.
- 1b1. System will ignore those arguments and execute the comamnd as usual.
- 2a. There are no existing classes.
- 2a1. System will return a message indicating that there are no existing classes in the list.
<br>

<br>

### Non-Functional Requirements

Expand All @@ -509,17 +558,16 @@ Use case ends.
7. Should be usable by a person who is TA-ing for the first time.
8. Should provide comprehensive error messages and guidelines to recover from errors due to user input.
9. Should provide a comprehensive and well-designed user documentation to guide users on how to use TAHelper.
10. Should provide a comprehensive and well-designed developer documentation to guide developer on how to improve and develop TAHelper further.

10. Should provide a comprehensive and well-designed developer documentation to guide developer on how to improve and develop TAHelper further.

### Glossary

* **Mainstream OS**: Windows, Linux, Unix, MacOS
* **Private contact detail**: A contact detail that is not meant to be shared with others
* **TA (Teaching Assistant)**: An individual who is responsible for teaching a tutorial class of University students.
* **TAHelper**: A contact management application to help TAs keep track of students in classes they teach
* **GUI**: Graphical User Interface
* **MSS**: Main Success Scenario
- **Mainstream OS**: Windows, Linux, Unix, MacOS
- **Private contact detail**: A contact detail that is not meant to be shared with others
- **TA (Teaching Assistant)**: An individual who is responsible for teaching a tutorial class of University students.
- **TAHelper**: A contact management application to help TAs keep track of students in classes they teach
- **GUI**: Graphical User Interface
- **MSS**: Main Success Scenario

---

Expand All @@ -538,40 +586,40 @@ testers are expected to do more _exploratory_ testing.

1. Initial launch

1. Download the jar file and copy into an empty folder
1. Download the jar file and copy into an empty folder

1. Double-click the jar file Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum.
1. Double-click the jar file Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum.

1. Saving window preferences

1. Resize the window to an optimum size. Move the window to a different location. Close the window.
1. Resize the window to an optimum size. Move the window to a different location. Close the window.

1. Re-launch the app by double-clicking the jar file.<br>
Expected: The most recent window size and location is retained.
1. Re-launch the app by double-clicking the jar file.<br>
Expected: The most recent window size and location is retained.

1. _{ more test cases …​ }_

### Deleting a person

1. Deleting a person while all persons are being shown

1. Prerequisites: List all persons using the `list` command. Multiple persons in the list.
1. Prerequisites: List all persons using the `list` command. Multiple persons in the list.

1. Test case: `delete 1`<br>
Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated.
1. Test case: `delete 1`<br>
Expected: First contact is deleted from the list. Details of the deleted contact shown in the status message. Timestamp in the status bar is updated.

1. Test case: `delete 0`<br>
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.
1. Test case: `delete 0`<br>
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.

1. Other incorrect delete commands to try: `delete`, `delete x`, `...` (where x is larger than the list size)<br>
Expected: Similar to previous.
1. Other incorrect delete commands to try: `delete`, `delete x`, `...` (where x is larger than the list size)<br>
Expected: Similar to previous.

1. _{ more test cases …​ }_

### Saving data

1. Dealing with missing/corrupted data files

1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_
1. _{explain how to simulate a missing/corrupted file, and the expected behavior}_

1. _{ more test cases …​ }_
Loading

0 comments on commit 1db87a6

Please sign in to comment.