Hi! I am Zhi Xiang, a Year 2 Computer Science student at the National University of Singapore (NUS). Below is a summary of my contributions to this project.
Overview
For our module CS2103T: Software Engineering, my team and I were tasked to enhance a desktop address book application called AddressBook.
We eventually turned it into a product called Seller Manager Lite (SML), which aims to help small-scale handphone resellers manage their sales and inventory with ease. Users interact with it using a Command Line Interface (CLI) and it has a Graphical User Interface (GUI) created with JavaFX. It is written in Java and has more than 15,000 lines of code.
My role was being in charge of the Logic component, implementing the commands and parsers for Customer, Phone and Order data. Also, I was tasked to implement undo/redo, find (search) and copy commands.
Summary of contributions
- 
Major enhancement: I added the ability to undo/redo previous commands - 
What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. 
- 
Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. 
- 
Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. 
- 
Credits: yamgent - I adapted some of his code to implement the UndoRedoStack and fixed the bugs that came with his approach. 
 
- 
- 
Minor enhancement: I added the ability to create/read/update/delete customer, phone and order. 
- 
Minor enhancement: I added find command(s) that allows the user to search for customers, phones or orders that match certain keywords. This required enhancing the existing find command. 
- 
Minor enhancement: I added copy command(s) that allows the user to copy the data that they want onto their clipboard. This would make it convenient for them to copy data out of the application. 
- 
Code contributed: 
- 
contributed more than 11,000 lines of code (LoC): - 
~5k functional code: https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=zhixianggg 
- 
6k+ test code: https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=zhixianggg 
- 
Over 30 Pull requests: PRs 
 
- 
- 
Functional 
- 
Test 
- 
Other contributions: - 
Project management: - 
Managed releases v1.3.1,v1.3.2andv1.3.4(3 releases) on GitHub
 
- 
- 
Enhancements to existing features: 
- 
Documentation: 
- 
Community: - 
PRs reviewed (with non-trivial review comments): #73, #76, #137, #145 
- 
Reported bugs and suggestions for other teams in the class: ExerHealth #217, ExerHealth #224 
 
- 
- 
Tools: 
 
- 
Contributions to the User Guide
| Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users. | 
Customer Commands
Commands that work on customers in SML.
Add a customer: add-c
Adds a Customer to the CustomerBook.
This can be done in any Tab Panel.
Format: add-c n/NAME c/CONTACT_NUMBER e/EMAIL [t/TAG]…
| Contact numbers should be 8-digits long. | 
| A customer can have any number of tags, including 0. | 
| Customers can share the same name. | 
| Customers cannot share the same contact number or email. | 
Examples:
- 
Adds a single customer - 
add-c n/Steve Jobs c/12345678 e/stevejobs@apple.com
 
- 
 
Delete a customer: delete-c
Deletes a customer in SML. Note that deleting a customer will also delete the orders and schedules associated with the customer.
Format: delete-c INDEX
Examples:
- 
Delete the 2nd customer. - 
list-c
- 
delete-c 2
 
- 
- 
Delete the 1st customer after performing a find customer command. - 
find-c alice
- 
delete-c 1
 
- 
Find a customer: find-c
Finds customers whose fields contain any of the given keywords.
Format: find KEYWORD [MORE_KEYWORDS]…
Examples:
- 
Find customers with keyword colleague- 
find-c colleague
 
- 
 
- 
Find customers with keywords charlotteoliveiro- 
find-c charlotte oliveiro
 
- 
 
Contributions to the Developer Guide
| Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project. | 
Undo/Redo feature
Current Implementation
The undo/redo mechanism is facilitated by UndoRedoStack.
UndoRedoStack contains 2 stacks, undoStack and redoStack.
undoStack and redoStack contain commands that are of type UndoableCommand.
UndoableCommand extends Command and has the following attributes and methods.
 
When an UndoableCommand is being executed, the methods saveCustomerBookSnapshot(Model model), savePhoneBookSnapshot(Model model), saveOrderBookSnapshot(Model model), saveScheduleBookSnapshot(Model model)
and saveArchivedOrderBookSnapshot(Model model) will be called. This ensures that the states of all 5 books are being stored.
After a command is executed, LogicManager will add it into the UndoRedoStack.
This will be explained in the activity diagram below.
 
Next, when UndoCommand is being performed, UndoStack will remove the first command in its stack and add it to RedoStack.
It will then call UndoableCommand#undo() of the command that is removed.
The undo() method will then set the model to the previous snapshots of CustomerBook, PhoneBook, OrderBook, ScheduleBook and ArchivedOrderBook.
After which, it will save the original state of the model (e.g. before Undo took place) by calling UndoableCommand#save(Model model).
Likewise, when RedoCommand is being performed, RedoStack will remove the first command in its stack and add it to UndoStack.
It will then call UndoableCommand#redo() of the command that is removed.
The redo() method will then set the model to the previous snapshots of CustomerBook, PhoneBook, OrderBook, ScheduleBook and ArchivedOrderBook.
Given below is an example usage scenario and how the undo/redo mechanism behaves at each step.
Step 1. The user launches the application for the first time. The UndoRedoStack will be initialized.
 
Step 2. The user executes delete-c 5 command to delete the 5th customer. The delete-c 5 command will be pushed into the UndoRedoStack.
 
Step 3. The user executes add-c n/David … to add a new customer. The add-c command will save all states of CustomerBook, PhoneBook, OrderBook, ScheduleBook and ArchivedOrderBook.
 
Step 4. The user now decides that adding the customer was a mistake, and decides to undo that action by executing the undo command.
 
| UndoCommand will check whether if there is any command to be undone by calling the UndoRedoStack#canUndo()method. | 
The following sequence diagram shows how the undo operation works:
 
| The lifeline for UndoCommandshould end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of the diagram. | 
| XYZ here refers to Customer, Phone, Order, Schedule and ArchivedOrder. | 
The redo command does the opposite — it calls UndoableCommand#redo().
Step 5. The user then decides to execute the command list-c. Commands that do not modify the 5 books (Customer, Phone, Order, Schedule and Archived Order), such as list-c, do not extend UndoableCommand.
 
Step 6. The user executes clear-c.
 
Design Considerations
Aspect: How undo & redo executes
- 
Alternative 1 (current choice): Saves the entire model. - 
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-c, just save the customer being deleted).
- 
Cons: We must ensure that the implementation of each command is correct. 
 
-