By: Team W14-B1 Since: Jan 2018 Licence: MIT
- 1. Introduction
- 2. Setting up
- 3. Design
- 4. Implementation
- 5. Documentation
- 6. Testing
- 7. Dev Ops
- Appendix A: Product Scope
- Appendix B: User Stories
- Appendix C: Use Cases
- Appendix D: Non Functional Requirements
- Appendix E: Glossary
- Appendix F: Product Survey
- Appendix G: Instructions for Manual Testing
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
This section covers the steps needed to set up TeachConnect on a computer.
-
JDK
1.8.0_60or laterℹ️Having any Java 8 version is not enough.
This app will not work with earlier versions of Java 8. -
IntelliJ IDE
ℹ️IntelliJ by default has Gradle and JavaFx plugins installed.
Do not disable them. If you have disabled them, go toFile>Settings>Pluginsto re-enable them.
-
Fork this repo, and clone the fork to your computer
-
Open IntelliJ (if you are not in the welcome screen, click
File>Close Projectto close the existing project dialog first) -
Set up the correct JDK version for Gradle
-
Click
Configure>Project Defaults>Project Structure -
Click
New…and find the directory of the JDK
-
-
Click
Import Project -
Locate the
build.gradlefile and select it. ClickOK -
Click
Open as Project -
Click
OKto accept the default settings -
Open a console and run the command
gradlew processResources(Mac/Linux:./gradlew processResources). It should finish with theBUILD SUCCESSFULmessage.
This will generate all resources required by the application and tests.
-
Run the
seedu.address.MainAppand try a few commands -
Run the tests to ensure they all pass.
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,
-
Go to
File>Settings…(Windows/Linux), orIntelliJ IDEA>Preferences…(macOS) -
Select
Editor>Code Style>Java -
Click on the
Importstab to set the order-
For
Class count to use import with '*'andNames count to use static import with '*': Set to999to prevent IntelliJ from contracting the import statements -
For
Import Layout: The order isimport static all other imports,import java.*,import javax.*,import org.*,import com.*,import all other imports. Add a<blank line>between eachimport
-
Optionally, you can follow the UsingCheckstyle.adoc document to configure Intellij to check style-compliance as you write code.
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) |
When you are ready to start coding,
-
Get some sense of the overall design by reading Section 3.1, “Architecture”.
-
Take a look at Appendix A, Product Scope.
This section discusses the design of TeachConnect’s architecture and its components.
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.
Each of the four components
-
Defines its API in an
interfacewith the same name as the Component. -
Exposes its functionality using a
{Component Name}Managerclass.
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.
Figure 2: Class Diagram of the Logic Component
Figure 3 shows how the components interact for the scenario where the user issues the command delete 1.
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.
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.
The structure of the UI component is shown in Figure 5.
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
Logiccomponent. -
Binds itself to some data in the
Modelso that the UI can auto-update when data in theModelchange. -
Responds to events raised from various parts of the App and updates the UI accordingly.
The structure of the logic component is shown in Figure 6. Figure 7 shows finer details concerning XYZCommand and Command in Figure 6.
Figure 6: Structure of the Logic Component
Figure 7: Structure of Commands in the Logic Component
API :
Logic.java
-
Logicuses theAddressBookParserclass to parse the user command. -
This results in a
Commandobject which is executed by theLogicManager. -
The command execution can affect the
Model(e.g. adding a person) and/or raise events. -
The result of the command execution is encapsulated as a
CommandResultobject which is passed back to theUi.
Figure 8 is the Sequence Diagram for interactions within the Logic component for the execute("delete 1") API call.
Figure 8: Interactions Inside the Logic Component for the `delete 1` Command
The structure of the Model component is shown in Figure 9.
Figure 9: Structure of the Model Component
API : Model.java
The Model,
-
stores a
UserPrefobject 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.
The structure of the Storage component is shown in Figure 10.
Figure 10: Structure of the Storage Component
API : Storage.java
The Storage component,
-
can save
UserPrefobjects in json format and read it back. -
can save TeachConnect data in xml format and read it back.
This section describes some noteworthy details on how certain features are implemented.
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:
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).
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.
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.
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:
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).
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:
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:
Figure 18: Undo Redo Activity Diagram
-
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
Commanddo not have to know thatexecuteUndoableCommand()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
UndoableCommandmust remember to callsuper.execute(), or lose the ability to undo/redo.
-
-
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.
-
-
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.
-
-
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
HistoryManagerandUndoRedoStack.
-
-
Alternative 2: Use
HistoryManagerfor 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
HistoryManagernow needs to do two * different things.
-
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);
}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);
}-
Alternative 1 (current choice): User can only import from an
XMLfile.-
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
Excelfile 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.
-
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();
}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
allis present in the user input, we will just export all the contacts from the last shown list.
-
-
All (With a Tag)
-
if the word
allis 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 theteachConnectBookincluding 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 theteachConnectBookif 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.
-
Alternative 1: Users can only export to
XMLfiles.-
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
Excelfiles 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.
-
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.
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
commandsPresentString array ofShortcutCommandclass.
-
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.
-
The ShortcutDouble can be deleted using the DeleteShortcutCommand. The sequence diagram is below :
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.
-
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.
-
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:
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.
-
Alternative 1 (current choice):
Studentclass extendsPersonclass.-
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.
-
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.
Figure 24: Appointment Class Diagram
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);
}
}-
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.
-
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.
Figure 26: Change Theme Command Sequence Diagram
-
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
ModelandStorage. -
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
ModelandStoragecomponents too.
-
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);
}
-
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.
-
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.
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.
-
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.
-
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
logLevelsetting in the configuration file (See Section 4.12, “Configuration”) -
The
Loggerfor a class can be obtained usingLogsCenter.getLogger(Class)which will log messages according to the specified logging level -
Currently log messages are output through:
Consoleand to a.logfile.
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
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. |
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.
See UsingTravis.adoc to learn how to deploy GitHub Pages using Travis.
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.
-
Follow the instructions in UsingGradle.adoc to convert the AsciiDoc files in the
docs/directory to HTML format. -
Go to your generated HTML files in the
build/docsfolder, right click on them and selectOpen with→Google Chrome. -
Within Chrome, click on the
Printoption in Chrome’s menu. -
Set the destination to
Save as PDF, then clickSaveto save a copy of the file in PDF format. For best results, use the settings indicated inFigure 27below.
Figure 27: Saving Document as pdf settings
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/javafolder and chooseRun '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)
We have two types of tests:
-
GUI Tests - These are tests involving the GUI. They include,
-
System Tests that test the entire App by simulating user actions on the GUI. These are in the
systemtestspackage. -
Unit tests that test the individual components. These are in
seedu.address.uipackage.
-
-
Non-GUI Tests - These are tests not involving the GUI. They include,
-
Unit tests targeting the lowest level methods/classes.
e.g.seedu.address.commons.StringUtilTest -
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 -
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
-
See UsingGradle.adoc to learn how to use Gradle for build automation.
We use Travis CI and AppVeyor to perform Continuous Integration on our projects. See UsingTravis.adoc and UsingAppVeyor.adoc for more details.
We use Coveralls to track the code coverage of our projects. See UsingCoveralls.adoc for more details.
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.
Here are the steps to create a new release.
-
Update the version number in
MainApp.java. -
Generate a JAR file using Gradle.
-
Tag the repo with the version number. e.g.
v0.1 -
Create a new release using GitHub and upload the JAR file you created.
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)
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
-
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.
-
-
-
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,lightorgalaxytheme.
-
-
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.
-
-
-
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.
-
-
-
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.
-
-
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 |
(For all use cases below, the System is TeachConnect and the Actor is the teacher, unless specified otherwise)
MSS
-
Teacher requests to list persons
-
TeachConnect shows a list of persons
-
Teacher requests to delete a specific person in the list
-
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.
-
MSS
-
Teacher requests to list contacts
-
TeachConnect shows a list of contacts
-
Teacher requests to create a class of a subject for a specified duration with specific students
-
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.
-
MSS
-
Teacher requests to add an appointment with a specific tittle at a specified time
-
TeachConnect adds the appointment
Use case ends.
Extensions
-
1a. Time given is invalid.
-
1a1. TeachConnect shows error message.
Use case ends.
-
MSS
-
Teacher requests to list appointments
-
TeachConnect shows list of appointments
-
Teacher requests to delete a specific appointment in the list
-
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}
-
Should work on any mainstream OS as long as it has Java
1.8.0_60or higher installed. -
Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
-
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.
-
Should be intutive for any first time user.
-
Should be able to handle any invalid input i.e should be able to inform the user and guide the user for valid input.
-
Should respond within a second.
{More to be added}
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. |
-
Initial launch
-
Download the jar file and copy into an empty folder
-
Double-click the jar file
Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum.
-
-
Saving window preferences
-
Resize the window to an optimum size. Move the window to a different location. Close the window.
-
Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained.
-
{ more test cases … }
-
Deleting a person while all persons are listed
-
Prerequisites: List all persons using the
list contactscommand. Multiple persons in the list. -
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. -
Test case:
delete 0
Expected: No person is deleted. Error details shown in the status message. Status bar remains the same. -
Other incorrect delete commands to try:
delete,delete x(where x is larger than the list size) {give more}
Expected: Similar to previous.
-
-
Adding a student to TeachConnect
-
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. -
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.
-
-
Forming a class while list view is on the student list
-
Prerequisites: List all students using the
list studentscommand. At least one student in list. -
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 withlist students, the student added will have the subject of the class included in his card. -
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.
-

























