Introduction

This project portfolio serves the purpose to showcase my contribution to NUStudy as our software engineering project and the various skills I have acquired and utilised in the process of development.

Project Overview

Our team consists of 5 software engineering students who are passionate about software development. We were assigned to enhance a basic command line interface desktop address book application for our Software Engineering project. We decided to morph it into a revision flashcard desktop application called NUStudy. This enhanced application enables NUS students to store and manage lecture notes, practice questions under exam conditions and plan revision tasks effectively.

This is what our project looks like:

full

My job is to design and write the code for question management features. Details of the enhancements and relevant documentation I have completed will be further explained in sections below.

Please take note of the following symbols and formatting used in this documentaion:

  • monospace indicates command-line input

  • italics indicates class names

  • # followed by a number indicates a pull request (PR) or issue (eg. #12)

Summary of contributions

This section shows a summary of my coding, documentation, and other helpful contributions to the team project.

Enhancement added:

What it does

  • I was responsible for implementing question management features.A question includes a question body, an answer, a subject and a difficulty level. I have modified the existing Person model to Question model, as well as some of its relevant fields in the original address book application. (starting from PR #44).

  • The question management commands are modified by the original person management commands as well. The commands include: AddQuestionCommand, EditQuestionCommand, DeleteQuestionCommand, ClearQuestionCommand, FindQuestionCommand, FindDifficultyCommand, FindSubjectCommand, ListQuestionCommand.

Justification

It is important for students to constantly practice questions to test their understanding as well as get familiarize with the concepts they have learned. This question management system allows students to store questions easily. They are able to use this app as a question bank for them to revise. Furthermore, by defining difficulty levels for each question, student can have a better sense of how well they have learned from this topic or this subject in general. The question bank can also support other features such as quiz mode and various statistics for attempts.

Code Contributed

Please click this link to see a sample of my code: link

Other contributions

  • Testing: As I am responsible for testing, I have added a significant number of test classes which increased coverage to a large extent (as seen from PR #84).

  • Documentation: I modified the user guide from a draft version to the standardised formal version. I have also standardised the command format for most of the features.

  • Community:

    • Reviewed Pull Requests #43, #53

    • Reported bugs and offered suggestions for other teams in the class. Please click this link to see a list of issues I have created for peer reviews. link

User guide contributions

The following is a part from my NUStudy User Guide, showing enhancements that I have made for the question management features.


Questions

NUStudy can also store different sets of questions and answers; at your command, the system will prompt you to answer those questions.

Adding Questions: addq

You can add a question and its answer together with the necessary fields to the app.
Format: addq q/QUESTION a/ANSWER s/SUBJECT d/DIFFICULTY

  • You can define any type of difficulty level that is customized to your understanding of the question.

Example:

  • addq q/How to represent 85 in binary? a/1010101 s/CS2100 d/medium

addqcommand
Figure 1. Add question command

The new question will be added to your question bank.

addqresult
Figure 2. Result for add question command

Editing a question: editq

You can edit the fields of an existing question by providing the fields you want to change.
Format: editq INDEX [q/QUESTION] [a/ANSWER] [d/DIFFICULTY] [s/SUBJECT]

  • Edits the question at the specified INDEX. The index refers to the index number shown in the displayed question list. The index must be a positive integer 1, 2, 3, …​

  • At least one of the optional fields must be provided.

  • Existing values will be updated to the input values.

Examples:

  • editq 6 a/16 d/easy

editqcommand
Figure 3. Edit question command

Edits the answer and difficulty of the 2nd question to be 16 and easy respectively.

editqresult
Figure 4. Result for edit question command

Locating questions by keyword: findq

This command will give you a list of questions whose body or answer contains the keyword(s) you specified.
Format: findq KEYWORD [MORE KEYWORDS]

  • The search is case insensitive.

  • The order of the keywords does not matter.

  • Only full words will be matched.

  • NUStudy will return a list of questions containing any one of the keywords you provided. For example, if you type the command findq word1 word2, questions with body or answer which contains "word1", "word2", "word 1 word2", "word2 word1", or "word1 word2 xxxxxx yyyy".

Examples:

  • findq coupling tcp

findqcommand
Figure 5. Find question command

Finds the questions whose body or answer contains the keyword coupling or tcp.

findqresult
Figure 6. Result for find question command

Other features coming in v2.0

Auto-complete for command

NUStudy will automatically complete the command as you type, just like how it behaves in most IDEs.

Sharing notes and questions with other users

You can share your notes and questions with other NUStudy users with Internet connection.

Login using email and password

You can create an account in the application and login with your email and password. This allows you to access to NUStudy on other platforms.

Developer guide contributions

The following section shows my additions to the NUStudy Developer Guide for the question management features.


Question management feature

Current implementation

The question management feature is facilitated by Model. The question-related commands extend Command with the question object if necessary. The commands update the Model which is implemented by ModelManager. This in turn updates AppData which stores all the questions internally as UniqueQuestionList. Local data will be updated in the end by LogicManager. The commands include:

  • AddQuestionCommand — Adds a new question to the app.

  • DeleteQuestionCommand — Deletes an existing question in the app.

  • ListQuestionCommand — Views the list of all questions available.

  • EditQuestionCommand — Edits an existing question in the app. (to be implemented)

  • FindQuestionCommand — Finds a question with a specified keyword. (to be implemented)

These operations are exposed in the Model interface as Model#addQuestion(Question question), Model#deleteQuestion(Question question), Model#getFilteredQuestionList() and Model#setQuestion(Question target, Question editedQuestion) respectively.

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

Step 1. The user launches the application for the first time. The app will load all existing information from storage.

Step 2. The user executes addq q/QUESTION a/ANSWER s/SUBJECT d/DIFFICULTY command to add a new question to the app. The addq command calls Model#addQuestion(Question question), causing the AppData to be updated with the new question.

Step 3. The user executes deleteq 5 command to delete the 5th question in the app. The deleteq command calls Model#deleteQuestion(Question target) and Model#updateFilteredQuestionList(Predicate<Question> predicate), causing the AppData to be updated with the target question removed.

Step 4. The user executes editq 2 a/NEW_ANSWER command to edit the answer of the 2nd question in the app. The editq command calls Model#setQuestion(Question target, Question editedQuestion) and Model#updateFilteredQuestionList(Predicate<Question> predicate), causing the AppData to be updated with the original question being replaced by the edited question.

The following sequence diagram shows the interaction between classes when EditQuestionCommand#execute(model) is called:

EditQuestionCommandExecuteSequenceDiagram
Figure 7. Sequence diagram for execute(Model) of EditQuestionCommand

The following activity diagram summarizes what happens when a user executes a new addq command:

AddQuestionActivityDiagram
Figure 8. Activity diagram for addq command

Question is implemented as a concrete class with its relevant fields consist of QuestionBody, Answer, Subject, and Difficulty.

The following class diagram illustrates how Question class is designed:

QuestionClassDiagram
Figure 9. Class diagram for Question
Design considerations: How addq/deleteq/editq commands execute
  • Alternative 1 (current choice): Update the internal storage UniqueQuestionList in AppData first, then save the updated appData in local storage when the command finishes executing.

    • Pros: Easy to implement.

    • Cons: Need the extra step to ensure that the internal list is correctly maintained.

  • Alternative 2: Update the local storage directly when the command is executing.

    • Pros: No need to implement the internal list.

    • Cons: Will access local memory more frequently. May have performance issues in terms of memory usage.

Design considerations: Data structure to support the question commands
  • Alternative 1 (current choice): Use a UniqueQuestionList to store questions in AppData.

    • Pros: Cater to the question model specifically. Question list operations are encapsulated in one class.

    • Cons: Logic is duplicated as other models also implement similar list structure.

  • Alternative 2: Use Java list to store the questions.

    • Pros: Do not need to maintain a separate list class.

    • Cons: Violates Single Responsibility Principle and Separation of Concerns as the model needs to maintain various list operations.

Use case: Add a question to question bank in NUStudy (Xueting)

MSS

  1. Student keys in add question and specifies the relevant fields - add q/QUESTION a/ANSWER s/SUBJECT d/DIFFICULTY

  2. Application adds the question with its fields.

  3. Application informs the user about the success addition of question.

Use case ends

Extensions

  • 1a. Student does not specify the difficulty level

    • 1a1. Application shows an error message to require difficulty level input

    • 1a2. Student inputs the difficulty level

    • Repeat 1a1 and 1a2 until a difficulty level is provided

  • Use case resumes from step 2

Use case: Delete a question (Xueting)

MSS

  1. User requests to view a list of questions from another command (eg. findq, difficulty, subject).

  2. Application shows the list of questions retrieved from this command.

  3. User enters the delete command with the index of the question to be deleted.

  4. Application removes the question from the question bank.

  5. Application informs the user about the success of deletion.

Use case ends

Extensions

  • 1a. There is no question listed from the previous command.

    • 1a1. Application informs the user that the index is invalid since the question list is empty.

  • Use case ends

  • 1b. Student inputs invalid index for a question (either negative or out of range).

    • 1b1. Application shows an error message to inform the user that the index is invalid.

    • 1b2. Student re-enter the command by providing a valid index.

    • Repeat 1b1 and 1b2 until valid index is provided

  • Use case resumes at step 2