Skip to content

Commit be21c07

Browse files
Merge pull request #56 from demitycho/developer-guide
Developer guide update to include Schedule implementation
2 parents 085c8ac + bed9cf7 commit be21c07

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/DeveloperGuide.adoc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,44 @@ The editedStudent will have the new programming language attribute and will henc
521521
** Cons: User will have to learn a new specific command and might also be slightly difficult to implement.
522522
// end::programmingLanguage[]
523523

524+
// tag::schedule[]
525+
=== Schedule feature
526+
==== Current Implementation
527+
528+
To get better control of one's weekly schedule, we will now attach a component called `Schedule` to `Model`.
529+
530+
image::ScheduleClassDiagram.png[width="800"]
531+
532+
A `Schedule` is a list of `Lessons`. A `Lesson` has a `Student` attribute, a `Day` attribute, a starting `TIME START_TIME` and an ending `TIME END_TIME` attribute
533+
534+
* A `Lesson` object called `newLesson` will be created by `ModelManager.addLesson(Student, Day, Time START_TIME, Time END_TIME)`, which is implemented as such:
535+
[source, java]
536+
----
537+
public void addLesson(Student studentToAddLesson, Day day, Time startTime, Time endTime)
538+
throws DuplicateLessonException, StudentNotFoundException, InvalidLessonTimeSlotException {
539+
//Check for Duplicate Lesson, StudentNotFound, invalid input ime
540+
541+
schedule.addLesson(newLesson);
542+
}
543+
----
544+
545+
The student will be selected by the Index of the last seen list of students. A new `Lesson` will now be added for that student at the specific `Day`, `START_TIME` and `END_TIME`.
546+
547+
[NOTE]
548+
If you have a future implementation that requires the addition of a new attribute in the `Schedule` class, you must take note of updating the `Model.addLesson(Student, Day, Time START_TIME, Time END_TIME)` method to reflect the new attribute.
549+
550+
==== Design Considerations
551+
552+
===== Aspect: Implementation of `Schedule`
553+
* *Alternative 1 (current choice)*: `Schedule` contains `Lesson` classes that is made up of one layer, with attributes directly attached to `Lesson`
554+
** Pro: It is easier implement, just add `Lesson` to a `Schedule`, which is a list of `Lessons`
555+
** Con: Results in more coupling, attributes could have been furthur separated out. It is inefficient to search by `Day`. Searching for empty slot requires linear searching.
556+
* *Alternative 2*: `Lesson` contains two layers of classes, `Day` is attached to `Schedule` and `Lesson` is attached to `Day`
557+
** Pro: Less coupling and more cohesive design
558+
** Con: Much harder to implement and gets overly complicated
559+
560+
// end::schedule[]
561+
524562
=== Logging
525563

526564
We are using `java.util.logging` package for logging. The `LogsCenter` class is used to manage the logging levels and logging destinations.

0 commit comments

Comments
 (0)