Project: Tourist-Book
Code contributed: [Functional code] [Test code]
Enhancement Added: Bookmarking
External behavior
Start of Extract [from: User Guide]
Bookmark a place: bookmark
Adds a bookmark tag to the specified place from the address book.
Format: bookmark INDEX
Examples:
-
list
bookmark 1
Bookmarks the first place in the address book. -
find attractions
bookmark 3
Bookmarks the 3rd place in the results of thefind
command.
Display bookmarks: show_bookmark
List all bookmarked places in Tourist Book
Format: show_bookmark
Clearing all bookmarks: clear_bookmark
Clears all bookmarks from the address book.
Format: clear_bookmark
End of Extract
Justification
Bookmarking was a key feature part of the user story, as the tourist would like to track favourite places. Implementation was done via tag manipulation since the Tag class was well suited to support this feature. However, tag manipulation was cumbersome in the old addressbook, only from the edit command which was very slow.
My solution has seperate commands to speed up the process of adding/removing a specific tag ("Bookmarked") from each place, by passing the need to use the slower edit command.
Implementation
Start of Extract [from: Developer Guide]
Bookmark & Clear Bookmark mechanism
The underlying implementation of Bookmark (BM) and Clear Bookmark (CBM) is tag manipulation in the model component.
Two methods were added to Model
interface to support this feature (addTag
and removeAllTags
).
Both BM and CBM extends from UndoableCommand
as shown in Figure 2.3.2 , which allows Undo/Redo by the user.
Also, BM is an index based command like (delete
or edit
)
The following are the sequence diagrams each command
bookmark
command
Note
|
Bookmarking a place which is already bookmarked will throw DuplicateTagException since addTag can
be used by other commands or methods.
|
clear_bookmark
command
Both commands are quite similar, only slightly difference is additional index argument for bookmark
, and calling different
methods in ModelManager
.
Design Considerations
Aspect: Implementation of bookmark
/ clear_bookmark
Alternative 1 (current choice) Tag
manipulation through methods in ModelManager
Pros: Easy to implement over existing Tag
class.
Cons: Tags are randomly ordered, bookmark tag position is not consistent in the place list.
Alternative 2: Create a new class and have it as a new attribute in Place
Pros: Able to have fixed positioning of bookmark when listing places.
Cons: Tedious to implement, testing has added complexity.
Aspect: User experience for bookmark
/ clear_bookmark
Alternative 1 (current choice) Have 2 dedicated commands for manipulation on single specific tag
Pros: Standardization of "bookmark" tag, user cannot vary the tag for the same purpose E.G ("favourite", "saved", "like").
Cons: Only 1 bookmark "list" for user to put their favourite places.
Alternative 2: A more general command for user to change tags of specific place
Pros: More concise version of edit
, allows user to have different bookmark "lists" E.G ("Near_West", "Near_East").
Cons: A general version of clear_bookmark
will be remove_tag
, which would allow the user to delete important pre-allocated tags in the initial list.
End of Extract
Enhancement Added: Direction from place to place
External behavior
Start of Extract [from: User Guide]
Get directions to selected destination
Displays the directions from location A to selected destination.
Format: dir [INDEX_FROM] [INDEX_TO]
Examples:
-
dir 1 2
Returns the directions from the location at index 1 to index 2 of the places listing. -
dir 4 1
Returns the directions from the location at index 4 to index 1 of the places listing.
End of Extract
Justification
Highlighted as a "nice to have" feature in the user story. The usage would be the tourist has a schedule to visit several places in a day. It is very likely the tourist would seek direction to get from one listed place to another listed place.
"dir" command is implemented as a shortcut to manually entering 2 places on Google maps. It uses the name and postal code data found in the Tourist-Book to help the tourist search for the direction in the browser panel.
(Pull request #62)