After studying this code and completing the corresponding exercises, you should be able to,
- Assume you are planing to expand the functionality of the address book (but keep it as a CLI application).
What other user stories do you think AddressBook support. Add those user stories to the
DeveloperGuide.md
.
- Add a use case to the
DeveloperGuide.md
to cover the use case of editing an exiting tag.
e.g. change tagfriends
tobuddies
Assume that AddressBook confirms the change with the user before carrying out the operation.
- Add some more NFRs to the
DeveloperGuide.md
Note how the Command::execute()
method shows polymorphic behavior.
- Add an
abstract
methodboolean isMutatating()
to theCommand
class. This method will returntrue
for command types that mutate the data. e.g.AddCommand
- Currently, AddressBook data are saved to the file after every command.
Take advantage of the the new method you added to limit file saving to only for command types that mutate data.
i.e.add
command should always save the data whilelist
command should never save data to the file.
Note: There may be better ways to limit file saving to commands that mutate data. The above approach, while not optimal, will give you chance to implement a polymorphic behavior.
Covered by [LO-Polymorphism]
- Add a
throws Exception
clause to theAddCommand::execute
method. Notice how Java compiler will not allow it, unless you add the same clause to thethrows
clause to the parent class. This is because if a child class throws an exception that is not specified by the Parent's contract, the child class is no longer substitutable in place of the parent class. - Also note that while in the above example the compiler enforces LSP, there are other situations where it is up to
the programmer to enforce it. For example, if the method in the parent class works for
null
input, the overridden method in the child class should not rejectnull
inputs. This will not be enforced by the compiler.
Resources
- JavaFX 8 Tutorial by Marco Jakob
- If you are new to JavaFX, follow Marco's tutorial given above.
- Do some enhancements to the AddressBook GUI. e.g. add an application icon, change size/style