Project: Tourist-Book

Tourist-Book is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX.

Code contributed: [Functional code] [Test code]

Useful contact numbers in Singapore

Display a list of useful contact numbers by clicking on Help → Useful Contacts
or Display a list of useful contact numbers by using the CLI.
Format: emergency or sos

or

Using the shortcut key. Format: F2

End of Extract


Justification

Since the project is targeted at tourists who are visiting Singapore, it is important for them to have easy access to a list of emergency numbers in Singapore for easy reference should the need arises. The list of numbers include hospitals and ambulance hotlines.

Implementation


Start of Extract [from: Developer Guide]

Emergency/Useful Contacts

The Emergency/Useful Contacts function allows the user to quickly view a pre-defined list of contact numbers.
The underlying implementation is by invoking the browser window and changing the information it displays to the user.
The Emergency/Useful Contacts function is a CL command that can be invoked by the user.

The following is the class diagram of Emergency/Useful Contacts.

UsefulContactsClassDiagram

The following is the sequence diagram of the Emergency/Useful contacts command.

emergency or sos command

ContactsSequenceDiagram

Both commands will invoke the same contacts page.

Design Considerations

Aspect: Implementation of emergency / sos
Alternative 1 (current choice) Making use of the browser window to display the contacts information.
Pros: Easy to implement.
Cons: HTML file is hard to edit / cannot be edited.
Alternative 2: Create a new UI element (e.g. Text panel) and display when called.
Pros: Able to display contacts within the app itself.
Cons: Tedious to implement, GUI testing has added complexity.


Aspect: User experience for emergency / sos
Alternative 1 (current choice) Have 2 dedicated commands and quick key button (F2).
Pros: Allows user a more flexible choice of invoking the contacts list.
Cons: Takes up a quick key combination which can be used to invoke other shortcuts.

End of Extract


Enhancement Added: Find Command

External behavior


Start of Extract [from: User Guide]

Locating places by name or tag: find or fd

Finds places whose names or tags contain any of the given keywords.
Format: find [PREFIX]KEYWORD [MORE_KEYWORDS] or fd [PREFIX]KEYWORD [MORE_KEYWORDS]

  • The search is case insensitive. e.g zoo will match Zoo

  • The prefix will determine which field you are searching for.
    n/ is the prefix for name, while t/ is the prefix for tag.

  • The order of the keywords does not matter. e.g. Singapore Zoo will match Zoo Singapore

  • Only the name or tag is searched.

  • Only one field can be searched at a time, i.e. you cannot search both tag and name at the same time.

  • Only full words will be matched e.g. Singa will not match Singapore

  • Places matching at least one keyword will be returned (i.e. OR search). e.g. Singapore Gardens will return Singapore Zoo, Singapore Botanical Gardens

Examples:

  • find n/Singapore
    Returns Singapore Zoo and Singapore Flyer

  • fd n/Singapore Sands Botanic
    Returns any place having names Singapore, Sands, or Botanic

  • find t/attractions
    Returns a list of places tagged as attractions

  • fd t/onestar
    Returns a list of places tagged as onestar

End of Extract


Justification

Since the project is implemented with Places and using tags to describe a place (e.g. onestar), it is required for users to be able to search the list either by name or by the tag that the place is tagged to for easy reference. In addition, users may want to search for more than one name or tag at the same time as well.

Implementation


Start of Extract [from: Developer Guide]

Editing the Find Command to search by Name and Tag

The Find command is able to search the Tourist Book by Name of the place of by the Tags of the place.

The user is able to invoke the command with find or fd, followed by a PREFIX.

Prefixes * n/ : prefix for searching by Name. * t/ : prefix for searching by Tag.

Design Considerations

Aspect: Implementation of find
Alternative 1 (current choice) Enhancing the find command to find by name and tags.
Pros: User does not need to remember many commands.
Cons: User has to use prefixes to search for name or tags.
Alternative 2: Create a new command to search by other details.
Pros: Relatively easier to implement.
Cons: Tedious to test, not very intuitive for the user.


Aspect: User experience for find
Alternative 1 (current choice) Have 1 command and 2 dedicated prefixes.
Pros: Allows user a more flexible choice of find through the contacts list.
Cons: Can only search for one type of attribute at any time.

End of Extract


Enhancement Added: Backup Command

External behavior


Start of Extract [from: User Guide]

Tourist book save files can now be backed-up

Backup a copy of your data to the same folder of the save file.
Format: backup

+

Running the command again if you already have a previous backup will overwrite the previous
backup file!

End of Extract


Justification

This is to allow users to be able to backup their data. In the event their main file is corrupted or lost, there is still a backup file.

Implementation


Start of Extract [from: Developer Guide]

Storage component

Do take a look at the Design: Storage Component section before attempting to modify the Storage component.
  1. Add a new method backupAddressBook(ReadOnlyAddressBook), so that the address book can be saved in a fixed temporary location.

End of Extract


Enhancement Added: Export Command

External behavior


Start of Extract [from: User Guide]

Tourist Book save files are now exportable to .csv format

Export your data to .csv file format for printing purposes.
Format: export

End of Extract


Justification

As described in the User Stories, this is to allow users to be able to save and print out their files easily so that they are still able to know the information about a place without being connected to a computer.

Implementation


Start of Extract [from: Developer Guide]

Export

The ExportCommand extends the Command class. It allows users to export the current Address Book data into a CSV file.

The class diagram of the command is shown below:

ExportCommandClassDiagram

Figure 3.9A - Class Diagram of ExportCommand

From Figure 3.9A, the ExportCommand depends on java.io to carry out the file IO operations to create the CSV file. It also depends on the Model class and Place package in order to extract the required information to export.

The sequence diagram of the command is shown below:

ExportCommandSequenceDiagram

Figure 3.9B - Sequence Diagram of ExportCommand

Explanation of Figure 3.9B:

  1. The execute("export") command is called on the LogicManager.

  2. LogicManager calls the parse method on AddressBookParser.

  3. The parse method creates a new ExportCommand which returns an ExportCommand, e, all the way back to LogicManager.

  4. LogicManager calls the execute() method on e, an ExportCommand.

  5. ExportCommand obtains the PlaceList from the Model.

  6. ExportCommand checks if an exported file exists. If the file exists, it will delete the file.

  7. ExportCommand generates the exported file through a series of self calls and generates a new CommandResult, result.

  8. The result is returned to the LogicManager which returns it back to the UI.

Design Considerations

Aspect: Construction of Strings
Alternative 1 (current choice): Using StringBuilder
Pros: Able to easily construct the String due to the mutability of StringBuilder.
Cons: Dependency on the StringBuilder class.
Alternative 2: Using String only.
Pros: Reduced dependency on additional classes.
Cons: Constant re-assignment of resultant String is required as it is not mutable.


Aspect: Generating Place Data
Alternative 1 (current choice): "Hard-code" the data to obtain from a ReadOnlyPlace.
Pros: Code is executed at a faster rate.
Cons: Coupling is increased with ReadOnlyPlace/Code is not adaptable if new fields are added to ReadOnlyPlace.
Alternative 2: Generate place data according to the fields present in ReadOnlyPlace.
Pros: Code is adaptable should new fields be added to ReadOnlyPlace.
Cons: Additional processing overhead / Difficult and time-consuming to implement.

The implementation of the method is credited to Ryan Teo and
this issue.

End of Extract


Other contributions

  • Populated all the default places for the Tourist Book application. (Pull requests #64)

  • Created shortcut buttons for MRT Map and Useful Contacts function. (Pull requests #75)

  • Help to find bugs for other projects during Acceptance testing:
    (Issues Trackers #47, #53)