Skip to content

Latest commit

 

History

History
1241 lines (848 loc) · 56.6 KB

File metadata and controls

1241 lines (848 loc) · 56.6 KB

TeachConnect - Developer Guide

1. Introduction

Welcome to Teach Connect (TC)! TC is a command-line application which provides a convenient way for teachers and other educational professionals to better manage their contacts and schedules. This developer guide provides information that helps you to get started as a TC contributor, and aids you even if you are an experienced contributor.

The developer guide consists of the following sections:

  • Setting up

  • Design

  • Implementation

  • Documentation

  • Testing

  • Dev Ops

  • Appendices

2. Setting up

This section covers the steps needed to set up TeachConnect on a computer.

2.1. Prerequisites

  1. JDK 1.8.0_60 or later

    ℹ️
    Having any Java 8 version is not enough.
    This app will not work with earlier versions of Java 8.
  2. IntelliJ IDE

    ℹ️
    IntelliJ by default has Gradle and JavaFx plugins installed.
    Do not disable them. If you have disabled them, go to File > Settings > Plugins to re-enable them.

2.2. Setting up the project in your computer

  1. Fork this repo, and clone the fork to your computer

  2. Open IntelliJ (if you are not in the welcome screen, click File > Close Project to close the existing project dialog first)

  3. Set up the correct JDK version for Gradle

    1. Click Configure > Project Defaults > Project Structure

    2. Click New…​ and find the directory of the JDK

  4. Click Import Project

  5. Locate the build.gradle file and select it. Click OK

  6. Click Open as Project

  7. Click OK to accept the default settings

  8. Open a console and run the command gradlew processResources (Mac/Linux: ./gradlew processResources). It should finish with the BUILD SUCCESSFUL message.
    This will generate all resources required by the application and tests.

2.3. Verifying the setup

  1. Run the seedu.address.MainApp and try a few commands

  2. Run the tests to ensure they all pass.

2.4. Configurations to do before writing code

2.4.1. Configuring the coding style

This project follows oss-generic coding standards. IntelliJ’s default style is mostly compliant with ours but it uses a different import order from ours. To rectify,

  1. Go to File > Settings…​ (Windows/Linux), or IntelliJ IDEA > Preferences…​ (macOS)

  2. Select Editor > Code Style > Java

  3. Click on the Imports tab to set the order

    • For Class count to use import with '*' and Names count to use static import with '*': Set to 999 to prevent IntelliJ from contracting the import statements

    • For Import Layout: The order is import static all other imports, import java.*, import javax.*, import org.*, import com.*, import all other imports. Add a <blank line> between each import

Optionally, you can follow the UsingCheckstyle.adoc document to configure Intellij to check style-compliance as you write code.

2.4.2. Setting up CI

Set up Travis to perform Continuous Integration (CI) for your fork. See UsingTravis.adoc to learn how to set it up.

After setting up Travis, you can optionally set up coverage reporting for your team fork (see UsingCoveralls.adoc).

ℹ️
Coverage reporting could be useful for a team repository that hosts the final version but it is not that useful for your personal fork.

Optionally, you can set up AppVeyor as a second CI (see UsingAppVeyor.adoc).

ℹ️
Having both Travis and AppVeyor ensures your App works on both Unix-based platforms and Windows-based platforms (Travis is Unix-based and AppVeyor is Windows-based)

2.4.3. Getting started with coding

When you are ready to start coding,

  1. Get some sense of the overall design by reading Section 3.1, “Architecture”.

  2. Take a look at Appendix A, Product Scope.

3. Design

This section discusses the design of TeachConnect’s architecture and its components.

3.1. Architecture

Architecture
Figure 1: Architecture Diagram

Figure 1 given above explains the high-level design of the App. Given below is a quick overview of each component.

💡
The .pptx files used to create diagrams in this document can be found in the diagrams folder. To update a diagram, modify the diagram in the pptx file, select the objects of the diagram, and choose Save as picture.

Main has only one class called MainApp. It is responsible for,

  • At app launch: Initializes the components in the correct sequence, and connects them up with each other.

  • At shut down: Shuts down the components and invokes cleanup method where necessary.

Commons represents a collection of classes used by multiple other components. Two of those classes play important roles at the architecture level.

  • EventsCenter : This class (written using Google’s Event Bus library) is used by components to communicate with other components using events (i.e. a form of Event Driven design)

  • LogsCenter : Used by many classes to write log messages to the App’s log file.

The rest of the App consists of four components.

  • UI: The UI of the App.

  • Logic: The command executor.

  • Model: Holds the data of the App in-memory.

  • Storage: Reads data from, and writes data to, the hard disk.

Each of the four components

  • Defines its API in an interface with the same name as the Component.

  • Exposes its functionality using a {Component Name}Manager class.

For example, the Logic component (refer to Figure 2) defines it’s API in the Logic.java interface and exposes its functionality using the LogicManager.java class.

LogicClassDiagram
Figure 2: Class Diagram of the Logic Component

Events-Driven nature of the design

Figure 3 shows how the components interact for the scenario where the user issues the command delete 1.

SDforDeletePerson
Figure 3: Component interactions for `delete 1` command (part 1)
ℹ️
Note how the Model simply raises a AddressBookChangedEvent when the TeachConnect data are changed, instead of asking the Storage to save the updates to the hard disk.

Figure 4 shows how the EventsCenter reacts to that event, which eventually results in the updates being saved to the hard disk and the status bar of the UI being updated to reflect the 'Last Updated' time.

SDforDeletePersonEventHandling
Figure 4: Component interactions for `delete 1` command (part 2)
ℹ️
Note how the event is propagated through the EventsCenter to the Storage and UI without Model having to be coupled to either of them. This is an example of how this Event Driven approach helps us reduce direct coupling between components.

The sections below give more details of each component.

3.2. UI component

The structure of the UI component is shown in Figure 5.

UiClassDiagram
Figure 5: Structure of the UI Component

API : Ui.java

The UI consists of a MainWindow that is made up of parts e.g.CommandBox, ResultDisplay, PersonListPanel, StatusBarFooter, BrowserPanel etc. All these, including the MainWindow, inherit from the abstract UiPart class.

The UI component uses JavaFx UI framework. The layout of these UI parts are defined in matching .fxml files that are in the src/main/resources/view folder. For example, the layout of the MainWindow is specified in MainWindow.fxml

The UI component,

  • Executes user commands using the Logic component.

  • Binds itself to some data in the Model so that the UI can auto-update when data in the Model change.

  • Responds to events raised from various parts of the App and updates the UI accordingly.

3.3. Logic component

The structure of the logic component is shown in Figure 6. Figure 7 shows finer details concerning XYZCommand and Command in Figure 6.

LogicClassDiagram
Figure 6: Structure of the Logic Component
LogicCommandClassDiagram
Figure 7: Structure of Commands in the Logic Component

API : Logic.java

  1. Logic uses the AddressBookParser class to parse the user command.

  2. This results in a Command object which is executed by the LogicManager.

  3. The command execution can affect the Model (e.g. adding a person) and/or raise events.

  4. The result of the command execution is encapsulated as a CommandResult object which is passed back to the Ui.

Figure 8 is the Sequence Diagram for interactions within the Logic component for the execute("delete 1") API call.

DeletePersonSdForLogic
Figure 8: Interactions Inside the Logic Component for the `delete 1` Command

3.4. Model component

The structure of the Model component is shown in Figure 9.

ModelClassDiagram
Figure 9: Structure of the Model Component

API : Model.java

The Model,

  • stores a UserPref object that represents the user’s preferences.

  • stores TeachConnect data.

  • exposes an unmodifiable ObservableList<Person> that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.

  • does not depend on any of the other three components.

3.5. Storage component

The structure of the Storage component is shown in Figure 10.

StorageClassDiagram
Figure 10: Structure of the Storage Component

API : Storage.java

The Storage component,

  • can save UserPref objects in json format and read it back.

  • can save TeachConnect data in xml format and read it back.

3.6. Common classes

Classes used by multiple components are in the seedu.addressbook.commons package.

4. Implementation

This section describes some noteworthy details on how certain features are implemented.

4.1. Undo/Redo feature

4.1.1. Current Implementation

The undo/redo mechanism is facilitated by an UndoRedoStack, which resides inside LogicManager. It supports undoing and redoing of commands that modifies the state of TeachConnect (e.g. add, edit). Such commands will inherit from UndoableCommand.

UndoRedoStack only deals with UndoableCommands. Commands that cannot be undone will inherit from Command instead. Figure 11 shows the inheritance diagram for commands:

LogicCommandClassDiagram
Figure 11: Logic Command Class Diagram

As you can see from Figure 11, UndoableCommand adds an extra layer between the abstract Command class and concrete commands that can be undone, such as the DeleteCommand. Note that extra tasks need to be done when executing a command in an undoable way, such as saving the state of TeachConnect before execution. UndoableCommand contains the high-level algorithm for those extra tasks while the child classes implements the details of how to execute the specific command. Note that this technique of putting the high-level algorithm in the parent class and lower-level steps of the algorithm in child classes is also known as the template pattern.

Commands that are not undoable are implemented this way:

public class ListCommand extends Command {
    @Override
    public CommandResult execute() {
        // ... list logic ...
    }
}

With the extra layer, the commands that are undoable are implemented this way:

public abstract class UndoableCommand extends Command {
    @Override
    public CommandResult execute() {
        // ... undo logic ...

        executeUndoableCommand();
    }
}

public class DeleteCommand extends UndoableCommand {
    @Override
    public CommandResult executeUndoableCommand() {
        // ... delete logic ...
    }
}

Suppose that the user has just launched the application. The UndoRedoStack will be empty at the beginning.

The user executes a new UndoableCommand, delete 5, to delete the 5th person in TeachConnect. The current state of TeachConnect is saved before the delete 5 command executes. The delete 5 command will then be pushed onto the undoStack (the current state is saved together with the command).

UndoRedoStartingStackDiagram
Figure 12: Undo Redo Starting Stack Diagram

As the user continues to use the program, more commands are added into the undoStack. For example, the user may execute add n/David …​ to add a new person.

UndoRedoNewCommand1StackDiagram
Figure 13: Undo Redo New Command Stack Diagram
ℹ️
If a command fails its execution, it will not be pushed to the UndoRedoStack at all.

The user now decides that adding the person was a mistake, and decides to undo that action using undo.

We will pop the most recent command out of the undoStack and push it back to the redoStack. We will restore TeachConnect to the state before the add command executed.

UndoRedoExecuteUndoStackDiagram
Figure 14: Undo Redo Execute Undo Stack Diagram
ℹ️
If the undoStack is empty, then there are no other commands left to be undone, and an Exception will be thrown when popping the undoStack.

The following sequence diagram shows how the undo operation works:

UndoRedoSequenceDiagram
Figure 15: Undo Redo Sequence Diagram

The redo does the exact opposite (pops from redoStack, push to undoStack, and restores TeachConnect to the state after the command is executed).

ℹ️
If the redoStack is empty, then there are no other commands left to be redone, and an Exception will be thrown when popping the redoStack.

The user now decides to execute a new command, clear. As before, clear will be pushed into the undoStack. This time the redoStack is no longer empty. It will be purged as it no longer make sense to redo the add n/David command (this is the behavior that most modern desktop applications follow).

UndoRedoNewCommand2StackDiagram
Figure 16: Undo Redo New Command 2 Stack Diagram

Commands that are not undoable are not added into the undoStack. For example, list, which inherits from Command rather than UndoableCommand, will not be added after execution:

UndoRedoNewCommand3StackDiagram
Figure 17: Undo Redo New Command 3 Stack Diagram

The following activity diagram summarize what happens inside the UndoRedoStack when a user executes a new command:

UndoRedoActivityDiagram
Figure 18: Undo Redo Activity Diagram

4.1.2. Design Considerations

Aspect: Implementation of UndoableCommand
  • Alternative 1 (current choice): Add a new abstract method executeUndoableCommand()

    • Pros: We will not lose any undone/redone functionality as it is now part of the default behaviour. Classes that deal with Command do not have to know that executeUndoableCommand() exist.

    • Cons: Hard for new developers to understand the template pattern.

  • Alternative 2: Just override execute()

    • Pros: Does not involve the template pattern, easier for new developers to understand.

    • Cons: Classes that inherit from UndoableCommand must remember to call super.execute(), or lose the ability to undo/redo.

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 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.

Aspect: Type of commands that can be undone/redone
  • Alternative 1 (current choice): Only include commands that modifies TeachConnect (add, clear, edit).

    • Pros: We only revert changes that are hard to change back (the view can easily be re-modified as no data are * lost).

    • Cons: User might think that undo also applies when the list is modified (undoing filtering for example), * only to realize that it does not do that, after executing undo.

  • Alternative 2: Include all commands.

    • Pros: Might be more intuitive for the user.

    • Cons: User have no way of skipping such commands if he or she just want to reset the state of the address * book and not the view. Additional Info: See our discussion here.

Aspect: Data structure to support the undo/redo commands
  • Alternative 1 (current choice): Use separate stack for undo and redo

    • Pros: Easy to understand for new Computer Science student undergraduates to understand, who are likely to be * the new incoming developers of our project.

    • Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update * both HistoryManager and UndoRedoStack.

  • Alternative 2: Use HistoryManager for undo/redo

    • Pros: We do not need to maintain a separate stack, and just reuse what is already in the codebase.

    • Cons: Requires dealing with commands that have already been undone: We must remember to skip these commands. Violates Single Responsibility Principle and Separation of Concerns as HistoryManager now needs to do two * different things.

4.2. Import Contacts

4.2.1. Current Implementation

The ImportCommand uses XmlAddressBookStorage to generate a temporary AddressBook object from a given path. It takes in a String value path. The command then adds the contacts or the classes found in the temporary AddressBook object into the model. Below is the rough idea of the constructor for the class:

public ImportCommand(String importPath) {
        requireNonNull(importPath);
        this.filePath = importPath;
        addressBookStorage = new XmlAddressBookStorage(filePath);
}
ImportCommandFlowChart
Figure 19: Import command flow chart

Import command extends Undoable Command and hence Undo can be called on it. It also initially checks if the given file path is valid and if so initialises the contacts from there, creates a Person object and adds it to the current TeachConnect with the help of model.For importing classes Class objects are first created and students related to the classes are stored before being added to the model. The code can be found below.

public CommandResult executeUndoableCommand() throws CommandException {
     peopleToBeImported(people);
     studentToBeImported(students);
     classesToBeImported(students, classes);

     return new CommandResult(MESSAGE_SUCCESS);
}

4.2.2. Design Considerations

Aspects : Implementation Import Command
  • Alternative 1 (current choice): User can only import from an XML file.

    • Pros: This implementation goes well with the idea of TeachConnect. It’s easier to implement and also there is a clear distinction of the file that needs to be imported by the user with the help of the .XML extension.

    • Cons: Users might want to import from Excel only to realise this isn’t possible.

  • Alternative 2: Users can import from an Excel file too.

    • Pros: This implementation might be more intuitive for the user and might come in handy.

    • Cons: This implementation will not really help the user to distinguish the exact file to be imported. Care has to be taken so that the input by the user follows a certain format to parse the content properly.

4.3. Export Contacts

4.3.1. Current Implementation

The ExportCommand uses XmlAddressBookStorage class to generate a xml file based on a given range/index/tag and save it to the location specified with the chosen file name. It takes in String name String range Tag tag String path String type.It is also possible to export classes with String path String name String type as parameters. The tag is not compulsory and can be excluded or included depending on the user. Below is the basic idea of the constructor for the class:

ExportCommand(String range, Tag tag, String path, String nameOfExportFile, String type) {
        this.range = range;
        this.path = path;
        thispublic.tag = tag;
        this.nameOfExportFile = nameOfExportFile;
        this.type = type;

        teachConnectBook = new AddressBook();
}
ExportCommandDiagram
Figure 20: Export command flow chart

The method handleRange() splits the range using a separator "," and returns a String array with the upper bound and lower bound as values. In some cases it also returns the String all or the single integer index that has to be exported. Based on the type it also exports to an excel format (CSV file) or XML format (XML file).

Below is an extract of the method handleRange():

public String[] handleRange() throws IOException {
        String[] rangeStringArray = this.range.split(",");
        if (rangeStringArray.length > 2) {
            throw new IOException();
        }
        return rangeStringArray;
}

Choosing to export classes follows a different pattern. It exports all the classes and the students related to those classes.

Any range with more than 2 values in the String array returns an IO Exception. There are 4 individual cases when exporting contacts and multiple combinations of these:

  • All (Without a tag)

    • if the word all is present in the user input, we will just export all the contacts from the last shown list.

  • All (With a Tag)

    • if the word all is present along with a tag specified in the user input, we will just export all the contacts with that particular tag from the last shown list

  • Specific index (e.g. 1, 2, 3)

    • if the user input contains a specific index, we will add that index (one-based) to the teachConnectBook.

  • Range of indexes (e.g. 1,5)

    • if the user input contains a range which is identified by the , character, we will add that range of index (one-based) to the teachConnectBook including the lower range but excluding the upper bound.

  • Range of indexes (with a tag)

    • if the user input contains a range which is identified by the , character along with the tag, we will add that range of index (one-based) to the teachConnectBook if that contact contains that particular tag including the lower range but excluding the upper bound.

The final step is to create the xml/excel file from the teachConnectBook. This is done with the help of the method tryStorage().

Depending on the type of export it can also be exported to an excel format with the help of Arraylists called exportAdditionPeople, exportAdditionClasses, exportAdditionStudents.

4.3.2. Design Considerations

Aspects : Implementation Export Command
  • Alternative 1: Users can only export to XML files.

    • Pros: This is the easier implementation and it goes well with the import command as import can only be done from an XML file.

    • Cons: The exported file might not be very user friendly to read in the xml file format and hence later referencing to the file after exporting can be a nightmare.

  • Alternative 2 (current choice): Users can export to Excel files too.

    • Pros: This implementation might be more intuitive for the user and might come in handy especially when the user wants to print it later or read the contents in a user friendly format.

    • Cons: The implementation would be more complex and hence there could be more boundary cases to consider.

4.4. Personalised Shortcut

4.4.1. Current Implementation

The personalised shortcut uses a ShortcutDouble to hold the shortcut word and the command word. There is a UniqueShortcutDoublesList to which these ShortcutDoubles are added. The comparator in the ShortcutDouble accounts to check for any duplicates in the UniqueShortcutDoublesList. This list is then added to the addressbook.xml so as to load the shortcuts on initialisation. Below is a short code snippet of the constructor of the ShortcutDouble:

public ShortcutDoubles(String shortcutWord, String commandWord) {
        this.shortcutWord = shortcutWord;
        this.commandWord = commandWord;
}

This ShortcutDouble is called using the ShortcutCommand. Below is the constructor to the ShortcutCommand:

public ShortcutCommand(String commandWord, String shortcutWord) {
        this.shortcutWord = shortcutWord;
        this.commandWord = commandWord;
}

Shortcut command extends UndoableCommand and hence is undoable. It initially calls a filtered commandsList to which a new ShortcutDouble is added if it passes all validity checks.

There is a check to find if the command is already present and the method used for this is called checkIfCommandPresent().By default it returns false.

You can also choose to list all the shortcuts created until now. This displays the UniqueShortcutDoublesList instead of the contacts in the list panel. Figure 21 gives an example of a high level sequence diagram.

ListShortcutsHighLevelSequenceDiagrams
Figure 21: List Shortcut High Level Sequence Diagram

As of now the conditions to take note of are:

  • Shortcut can be only one word.

  • The command word should already exist.

  • New commands are to be added in the commandsPresent String array of ShortcutCommand class.

4.4.2. Design Considerations

Aspects : Implementation Shortcut Command
  • Alternative 1: There is a limit to the number of aliases a command word can have.

    • Pros: This implementation allows the developers to set up default shortcuts for each command word there by increasing the usability of the app.

    • Cons: It wouldn’t help much if the user keeps forgetting the shortcut word too because there is only one shortcut alias and the user might forget it.

  • Alternative 2 (current choice): Multiple number of shortcut words can be created for a single command word.

    • Pros: As users can create multiple aliases, this implementation gives them more personalisation and the flexibility of forgetting the words as they can always create more of them.

    • Cons: Developers need to consider several cases for duplicate shortcuts and maintain a dynamic list without forgetting the shortcuts when the app is closed without hardcoding the shortcut word into each command.

4.5. Deleting Personalised Shortcut

4.5.1. Current Implementation

The ShortcutDouble can be deleted using the DeleteShortcutCommand. The sequence diagram is below :

DeleteShortcutSequenceDiagram
Figure 22: Delete Shortcut Sequence Diagram

The ShortcutDouble is deleted from the UniqueShortcutDoublesList. It throws a CommandShortcutNotFoundException in case the shortcut is not found. Below is the constructor to the DeleteShortcutCommand:

public DeleteShortcutCommand(String commandWord, String shortcutWord) {
        this.commandWord = commandWord;
        this.shortcutWord = shortcutWord;
        commandShortcut = new ShortcutDoubles(shortcutWord, commandWord);
}

DeleteShortcut command extends UndoableCommand and hence is undoable. It calls the method deleteCommandShortcut() in the model class to achieve its objective.

As of now the conditions to take note of are: * DeleteShortcut can only delete a shortcut if the command is already present and the shortcut has been made previously.

4.5.2. Design Considerations

Aspects : Validity of the Delete Shortcut Command
  • Alternative 1: TeachConnect doesn’t support Delete Shortcut Command.

    • Pros: The implementation would be more simple considering the fact that the shortcut has been added by the user.

    • Cons: This implementation would not give the user any room for mistake or change of mind as once added shortcut cannot be deleted.

  • Alternative 2 (current choice): TeachConnect also supports Delete Shorcut Command.

    • Pros: This implementation will give the user the room to make mistake and change the shortcuts if needed. It would also help him in clearing the clutter of shortcuts which would have developed over time.

    • Cons: The developers will have to take care of various edge cases when the shortcuts are not present and keep modifying the dynamic list. Several relevant exceptions have to be thrown and taken care of.

4.6. Student Management

4.6.1. Current Implementation

The student manangement allows the user of TeachConnect to manage a particular type of contact, a student. The user is capable of interacting with the student contact just like with any other contact, for example: adding, editing, deleting and so on. In addition, users will be able to form classes to group students of the same class together.

Each Class contains 4 variables:

  • Name of class: for users to distinguish between classes.

  • Subject being taught: for users to record what was taught to any particular class or student.

  • Duration of Class: for users to record when that particular class was taught by them.
    Shown as a range of dates, e.g 01 January 18 to 01 December 18.

  • List of students taught: for users to recorded which class was attended by which student and vice versa.

An overview of the Model Component after implementation is shown below in Figure 23:

EditedModelClassDiagram
Figure 23: Model Class after implementation of Student

As shown above, student class extends from the person class, giving student access to its constructor and getter methods for name, phone, email, address whereas only student will have access to class.

4.6.2. Design Considerations

Aspects : Implementation of student
  • Alternative 1 (current choice): Student class extends Person class.

    • Pros: This implementation allows students access to person methods while restricting person from accessing student methods.

    • Cons: The implementation is more complex as additional classes has to be added to facilitate storage and display.

  • Alternative 2: Developers only use a tag to distinguish a student from a person.

    • Pros: It is more simple to implement and tags are visible to user.

    • Cons: This implementation would require every operation to check the tags. Tags can also be removed.

4.7. Schedule Management

4.7.1. Current Implementation

There are two types of schedule: an Appointment or a Task. The model diagrams for Appointment and Task are shown in Figure 24 and Figure 25.

AppointmentModelClassDiagram
Figure 24: Appointment Class Diagram
TaskModelClassDiagram
Figure 25: Task Class Diagram

Appointment has 4 variables:

  • Title: Holds the description for the appointment.

  • Start Time: Holds the starting time of the appointment.

  • End time: Holds the end time of the appointment.

  • Person to meet: (optional) Holds the target in the appointment.

Task has 2 variables:

  • Title: Holds the description for the task.

  • Time: Holds the time the task is expected to be finished.

Similar to UniquePersonList and UniqueTagList, UniqueAppointmentList and UniqueTaskList is linked to AddressBook. Request to change to the AddressBook model is signalled through ModelManager.

Every Appointment in the UniqueAppointmentList is also added to CalendarFX 's Calendar Entry list to be rendered on the Calendar View in the GUI. When there is a change in the UniqueAppointmentList, an AppointmentListChangedEvent will be propagated through the EventsCenter. When it reaches the UI component, the result is re-syncing of UniqueAppointmentList and CalendarFx 's Calendar Entry list and the Calendar View in the GUI will be updated. The code below shows how the re-syncing works within the UI component.

private void handleAppointmentListChangedEvent(AppointmentListChangedEvent event) {
        appointmentList = event.appointmentList;
        Platform.runLater(
                this::updateCalendar
        );
}
private void updateCalendar() {
        calendar.clear();
        ArrayList<Entry> entries = getEntries();
        for (Entry entry : entries) {
                calendar.addEntry(entry);
        }
}

4.7.2. Design Considerations

Aspects : Implementation of set appointment/task
  • Alternative 1 (current choice): Users can set appointment/task with already elapsed starting time/deadline.

    • Pros: With this implementation, TeachConnect can help the user keep track of past schedules which weren’t added to the schedule list.

    • Cons: This is not the most intuitive implementation and the application could accept error-prone date input from the user side.

  • Alternative 2: Users can only set appointment/task with the starting time/deadline in the future.

    • Pros: This is the more intuitive approach and it can prevent the user from keying in "redundant" schedule.

    • Cons: As TeachConnect fetches the current time from the user’s system, if the user for some purposes sets the system’s time to deviate from the world clock, some difficulties may arise when he/she wants to add new event.

4.8. Changing GUI theme

4.8.1. Current Implementation

The current implementation of this command only involves Logic, EventsCenter and UI components of the application. To illustrate how the change theme command works, Figure 26 shows the sequence diagram for changing the theme to dark theme.

ChangeThemeSequenceDiagram
Figure 26: Change Theme Command Sequence Diagram

4.8.2. Design Considerations

Aspects : Saving of user selected theme to Storage
  • Alternative 1 (current choice): Theme selected is not saved to storage.

    • Pros: This implementation is more simple and we don’t need to interact with Model and Storage.

    • Cons: If the users want to use a theme other than the default one, it will be very inconvenient for them as they will have to manual change the theme from the default one every time they start up TeachConnect.

  • Alternative 2: Last selected theme by the users would be saved to storage.

    • Pros: Users experience can be enhanced as users can have the theme they like selected automatically each time they start up TeachConnect.

    • Cons: The command implementation would be more complex as we need to interact with Model and Storage components too.

4.9. Sorting Contacts

4.9.1. Current Implementation

This command sorts all the contacts in TeachConnect lexicographically. The command calls upon a sortByNameFilteredPersonList() method in Model, which then calls upon the sortList() method in UniqueContactList. The sortList() method sorts the entire contact list using a comparator. Below is the code snippet.

public void sortList() {
       Comparator<Person> sortByName = new Comparator<Person>() {
           @Override
           public int compare (Person contact1, Person contact2)  {
               return contact1.getName().fullName.compareToIgnoreCase(contact2.getName().fullName);
           }
       };
       FXCollections.sort(combinedList, sortByName);
   }

4.9.2. Design Considerations

Aspects : Automatic sorting of contacts
  • Alternative 1 (current choice): TeachConnect will only sort contacts after user keys in the command.

    • Pros: This implementation is simpler and more intuitive.

    • Cons: Users might find it a slight hassle to have to key in the sort command every time a new contact is added.

  • Alternative 2: TeachConnect automatically sorts contacts.

    • Pros: When new contacts are added, they are automatic sorted without the need to key in the command.

    • Cons: The command implementation might be more complex and it would make the command redundant. Users also might not always want their contact list to be sorted.

4.10. Encryption/Decryption [Proposed]

4.10.1. Proposed Implementation

TeachConnect will also have a data encryption feature to keep the teacher’s sensitive contact data safe from unauthorised persons. To illustrate how the encrypt command works, Figure 27 shows the sequence diagram when the command encrypt pw/<password> is entered.

EncryptionSequenceDiagram

Figure 27: Encrypt Command Sequence Diagram

The Decrypt command also follows the same flow, except that DecryptEvent is posted,handleDecryptEvent is called instead, and decryptUtil handles the decryption.

After encryption the result would be an encrypted addressBook.xml file, and after decryption the result is a decrypted and human-readable addressBook.xml file.

4.10.2. Design Considerations

Aspects : Saving of password to TeachConnect storage
  • Alternative 1 (current choice): Users remember their own passwords.

    • Pros: The password is also not stored locally within TeachConnect, hence it would be impossible to obtain the password from the application. No one else would have the password but the user, provided that he/she does not share it with any unauthorised persons.

    • Cons: If the user forgets the password, then the file cannot be decrypted. Also, the user needs to find secure means to share this password with other authorised persons.

  • Alternative 2: Password is saved within TeachConnect.

    • Pros: Users will find it more convenient as they do not have to remember their password.

    • Cons: The command implementation might be more complex. There is a risk of unauthorised persons breaking and reverse-engineering the password.

4.11. Logging

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

  • The logging level can be controlled using the logLevel setting in the configuration file (See Section 4.12, “Configuration”)

  • The Logger for a class can be obtained using LogsCenter.getLogger(Class) which will log messages according to the specified logging level

  • Currently log messages are output through: Console and to a .log file.

Logging Levels

  • SEVERE : Critical problem detected which may possibly cause the termination of the application

  • WARNING : Can continue, but with caution

  • INFO : Information showing the noteworthy actions by the App

  • FINE : Details that is not usually noteworthy but may be useful in debugging e.g. print the actual list instead of just its size

4.12. Configuration

Certain properties of the application can be controlled (e.g App name, logging level) through the configuration file (default: config.json).

5. Documentation

We use asciidoc for writing documentation.

ℹ️
We chose asciidoc over Markdown because asciidoc, although a bit more complex than Markdown, provides more flexibility in formatting.

5.1. Editing Documentation

See UsingGradle.adoc to learn how to render .adoc files locally to preview the end result of your edits. Alternatively, you can download the AsciiDoc plugin for IntelliJ, which allows you to preview the changes you have made to your .adoc files in real-time.

5.2. Publishing Documentation

See UsingTravis.adoc to learn how to deploy GitHub Pages using Travis.

5.3. Converting Documentation to PDF format

We use Google Chrome for converting documentation to PDF format, as Chrome’s PDF engine preserves hyperlinks used in webpages.

Here are the steps to convert the project documentation files to PDF format.

  1. Follow the instructions in UsingGradle.adoc to convert the AsciiDoc files in the docs/ directory to HTML format.

  2. Go to your generated HTML files in the build/docs folder, right click on them and select Open withGoogle Chrome.

  3. Within Chrome, click on the Print option in Chrome’s menu.

  4. Set the destination to Save as PDF, then click Save to save a copy of the file in PDF format. For best results, use the settings indicated in Figure 27 below.

chrome save as pdf
Figure 27: Saving Document as pdf settings

6. Testing

6.1. Running Tests

There are three ways to run tests.

💡
The most reliable way to run tests is the 3rd one. The first two methods might fail some GUI tests due to platform/resolution-specific idiosyncrasies.

Method 1: Using IntelliJ JUnit test runner

  • To run all tests, right-click on the src/test/java folder and choose Run 'All Tests'

  • To run a subset of tests, you can right-click on a test package, test class, or a test and choose Run 'ABC'

Method 2: Using Gradle

  • Open a console and run the command gradlew clean allTests (Mac/Linux: ./gradlew clean allTests)

ℹ️
See UsingGradle.adoc for more info on how to run tests using Gradle.

Method 3: Using Gradle (headless)

Thanks to the TestFX library we use, our GUI tests can be run in the headless mode. In the headless mode, GUI tests do not show up on the screen. That means the developer can do other things on the Computer while the tests are running.

To run tests in headless mode, open a console and run the command gradlew clean headless allTests (Mac/Linux: ./gradlew clean headless allTests)

6.2. Types of tests

We have two types of tests:

  1. GUI Tests - These are tests involving the GUI. They include,

    1. System Tests that test the entire App by simulating user actions on the GUI. These are in the systemtests package.

    2. Unit tests that test the individual components. These are in seedu.address.ui package.

  2. Non-GUI Tests - These are tests not involving the GUI. They include,

    1. Unit tests targeting the lowest level methods/classes.
      e.g. seedu.address.commons.StringUtilTest

    2. Integration tests that are checking the integration of multiple code units (those code units are assumed to be working).
      e.g. seedu.address.storage.StorageManagerTest

    3. Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together.
      e.g. seedu.address.logic.LogicManagerTest

6.3. Troubleshooting Testing

Problem: HelpWindowTest fails with a NullPointerException.

  • Reason: One of its dependencies, UserGuide.html in src/main/resources/docs is missing.

  • Solution: Execute Gradle task processResources.

7. Dev Ops

7.1. Build Automation

See UsingGradle.adoc to learn how to use Gradle for build automation.

7.2. Continuous Integration

We use Travis CI and AppVeyor to perform Continuous Integration on our projects. See UsingTravis.adoc and UsingAppVeyor.adoc for more details.

7.3. Coverage Reporting

We use Coveralls to track the code coverage of our projects. See UsingCoveralls.adoc for more details.

7.4. Documentation Previews

When a pull request has changes to asciidoc files, you can use Netlify to see a preview of how the HTML version of those asciidoc files will look like when the pull request is merged. See UsingNetlify.adoc for more details.

7.5. Making a Release

Here are the steps to create a new release.

  1. Update the version number in MainApp.java.

  2. Generate a JAR file using Gradle.

  3. Tag the repo with the version number. e.g. v0.1

  4. Create a new release using GitHub and upload the JAR file you created.

7.6. Managing Dependencies

A project often depends on third-party libraries. For example, TeachConnect depends on the Jackson library for XML parsing. Managing these dependencies can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives.
a. Include those libraries in the repo (this bloats the repo size)
b. Require developers to download those libraries manually (this creates extra work for developers)

Appendix A: Product Scope

Target user profile: teachers or educational professionals who

  • is a teacher or educational professional

  • has a need to manage a significant number of students and parents contact details

  • has a need to keep track of appointments with parents, students or other staff

  • has a need to keep track of tasks and their deadlines

  • prefer desktop apps over other types

  • can type fast

  • prefer typing over mouse input

  • is reasonably comfortable using CLI apps

Value proposition: TeachConnect provides a simple and intuitive interface to help teachers manage their contacts, events and tasks.

Feature Contribution

  1. Mukesh Gadupudi

    • Major Feature : Sharing of Contacts

      • Contacts can be imported or exported

      • They can be exported based on the tag or index

      • Import can be done given the file path of an XML file

    • Minor Feature : Email contacts

      • Contacts can be emailed by either by tag or an individual contact.

    • How the features fit into the product scope :

      • Major Feature: This feature can help teachers share contacts with other teachers. This is especially useful when teachers change classes or pass on the class to other teachers. Updating and losing data is also a common problem and to overcome this a backup can be stored by using this feature.

      • Minor Feature: This feature can help teachers email contacts. This might be really helpful when the teacher wants to remind parents with appointments or remind students with the work they need to finish. This also helps the teachers send group messages to class or parents regarding some important announcements.

  2. Rachel Ngo Phuong Thao

    • Major Feature : Managing Appointments & Tasks

      • Users can add and remove appointments & tasks in TeachConnect.

      • The appointments would be rendered in a calendar in the GUI.

    • Minor Feature : Changing the GUI theme

      • Users can set the theme of the GUI to dark, light or galaxy theme.

    • How the features fit into the product scope:

      • Major Feature: This feature can help teachers keeping track of any upcoming appointment or task they have. This can be useful for teachers or teaching associates who frequently need to meet up with students and parents for counselling or administrative purposes.

      • Minor Feature: This feature increases the aesthetic sense and helps people set the theme according to their taste.

  3. Jonathan

    • Major Feature : Data Encryption

      • Encrypts the data for increased safety

    • Minor Feature : Sort Contacts

      • Contacts can be sorted in alphabetical order of the name/tag or the phone number of the contacts.

    • How the features fit into the product scope :

      • Major Feature: Since TeachConnect has a lot of personal details of students and parents, the owner of the address book would want to encrypt the application data file to prevent outside access to sensitive information.

      • Minor Feature: This helps teacher relate and understand the index of the contacts in the TeachConnect better. Indexing becomes easy when they later want to export or set appointments.

  4. Randy Pang Pang

    • Major Feature : Management of classes

      • Classes can be formed and deleted.

    • Minor Feature : Management of student contacts

      • Student contact can be created and managed in a similar fashion as a default contact.

    • How the features fit into the product scope :

      • Major Feature: The ability to group students according to the classes will help manage student contacts better. Furthermore, this will help record the subjects a student has been taught as well as when has the student been taught.

      • Minor Feature: This feature is essential to TeachConnect as it helps teachers to remember and manage contacts with past and present students.

Appendix B: User Stories

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

Priority As a …​ I want to …​ So that I can…​

* * *

new user

see usage instructions

refer to instructions when I forget how to use the App

* * *

user

add a new person

* * *

user

delete a person

remove contacts that I no longer need

* * *

user

find a person by name

locate details of persons without having to go through the entire list

* * *

user

edit the details of a person

easily make changes to their details when they update their contact

* * *

teacher

create a class

group and manage students who are taking the same class

* * *

teacher

list all the classes I have taught or am teaching

know what classes have I taught

* * *

teacher

add appointment with a contact to my schedule

be reminded of the appointment

* * *

teacher

delete appointments from my schedule

clear appointments I no longer need to be reminded about

* * *

teacher

list all appointments in my schedule

check all the appointments I have

* * *

teacher

add tasks to my schedule

be reminded of a deadline

* * *

teacher

delete tasks from my schedule

clear tasks I no longer need to be reminded about

* * *

teacher

list all tasks in my schedule

check all the tasks I have

* *

teacher

add persons to a class

group them for easy perusal

* *

user

hide private contact details by default

minimize chance of someone else seeing them by accident

*

user with many persons in TeachConnect

sort persons by name

locate a person easily

*

user

tag a person

mark their contact with details

*

user

find all person with a given tag

see all persons with contact marked with a certain detail

*

user

change the colour of a tag

make it easier for me to distinguish the tags

*

user

change the background colour of the application

make the application more pleasing to my eyes

*

user

export persons from TeachConnect to an external file

have persons' contacts ready for import

*

user

import persons from an external file to TeachConnect

have persons' contact details added without having to reenter the information

Appendix C: Use Cases

(For all use cases below, the System is TeachConnect and the Actor is the teacher, unless specified otherwise)

Use case: Delete person

MSS

  1. Teacher requests to list persons

  2. TeachConnect shows a list of persons

  3. Teacher requests to delete a specific person in the list

  4. TeachConnect deletes the person

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 3a. The given index is invalid.

    • 3a1. TeachConnect shows an error message.

      Use case resumes at step 2.

Use case: Create class

MSS

  1. Teacher requests to list contacts

  2. TeachConnect shows a list of contacts

  3. Teacher requests to create a class of a subject for a specified duration with specific students

  4. TeachConnect creates the class

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 3a. The given subject or duration is invalid.

    • 3a1. TeachConnect shows an error message.

      Use case resumes at step 2.

  • 5a. One or more given index(s) is invalid.

    • 5a1. TeachConnect shows an error message.

      Use case resumes at step 2.

Use case: Add appointment

MSS

  1. Teacher requests to add an appointment with a specific tittle at a specified time

  2. TeachConnect adds the appointment

    Use case ends.

Extensions

  • 1a. Time given is invalid.

    • 1a1. TeachConnect shows error message.

      Use case ends.

Use case: Delete appointment

MSS

  1. Teacher requests to list appointments

  2. TeachConnect shows list of appointments

  3. Teacher requests to delete a specific appointment in the list

  4. TeachConnect deletes appointment

    Use case ends.

Extensions

  • 2a. The list is empty.

    Use case ends.

  • 3a. The given index is invalid.

    • 3a1. TeachConnect shows error message.

      Use case resumes at step 2.

{More to be added}

Appendix D: Non Functional Requirements

  1. Should work on any mainstream OS as long as it has Java 1.8.0_60 or higher installed.

  2. Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.

  3. Should allow a user with above average typing speed for regular English text (i.e. not code, not system admin commands) to accomplish most of the tasks faster using commands than using the mouse.

  4. Should be intutive for any first time user.

  5. Should be able to handle any invalid input i.e should be able to inform the user and guide the user for valid input.

  6. Should respond within a second.

{More to be added}

Appendix E: Glossary

Mainstream OS

Windows, Linux, Unix, OS-X

Private contact detail

A contact detail that is not meant to be shared with others

Appendix F: Product Survey

Product Name

Author: …​

Pros:

  • …​

  • …​

Cons:

  • …​

  • …​

Appendix G: Instructions for Manual Testing

Given below are instructions to test the app manually.

ℹ️
These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing.

G.1. Launch and Shutdown

  1. Initial launch

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

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

  2. Saving window preferences

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

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

{ more test cases …​ }

G.2. Deleting a person

  1. Deleting a person while all persons are listed

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

    2. Test case: delete 1
      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.

    3. Test case: delete 0
      Expected: No person is deleted. Error details shown in the status message. Status bar remains the same.

    4. Other incorrect delete commands to try: delete, delete x (where x is larger than the list size) {give more}
      Expected: Similar to previous.

G.3. Adding a student

  1. Adding a student to TeachConnect

    1. Test Case: add student n/John Doe p/0000000 e/johny@example.com a/nowhere t/unknown
      Expected: The list view is toggled to the contacts list, if the list view is currently on another list, where a new student card, with a blue marker at the corner, can be seen with the entered particulars. Subject list will be empty.

    2. Test Case: add friend n/Mary Doe p/9999999 e/mary@example.com a/elsewhere
      Expected: Nothing is added. Error message is shown and command remains in the command box. List is not toggled.

G.4. Forming a class of students

  1. Forming a class while list view is on the student list

    1. Prerequisites: List all students using the list students command. At least one student in list.

    2. Test Case: form English n/class 01 s/10/09/2018 e/10/09/2019 i/1
      Expected: The list view is toggled to the class list where a new class card is added showing the particulars entered and the name of the student at the top of the list. Toggling back to the student list with list students, the student added will have the subject of the class included in his card.

    3. Test Case: form Advance Math n/class 02 s/10/10/2018 e/09/12/2018 i/1
      Expected: No class is formed. Error message is shown. List view not toggled.

G.5. Saving data

  1. Dealing with missing/corrupted data files

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

{ more test cases …​ }