Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AddressBook: remove unused containsTag()
AddressBook#containsTag() checks if the master list of Tags contains a Tag with the same value as the given Tag. This method is not used anywhere, and can be classified as unused code. There are no commands that support it, and it is also not part of any learning objectives. While it is used in tests, its functionality is superseded by AddressBookTest#isTagObjectInAddressBookList(), and can be replaced by the latter in these tests. AddressBook#containsTag() should be removed as unused code contributes to maintenance and comprehension overheads. Let's remove AddressBook#containsTag(). ddressBookTest#isTagObjectInAddressBookList() is chosen over AddressBook#containsTag() because the former supersedes the latter in functionalities, and the former has to exist with or without the latter as the former contains test-specific checks. AddressBookTest#isTagObjectInAddressBookList() checks if the master list of Tags from a given AddressBook contains the given Tag object by reference, thus not only checking if a Tag value is in the master list like AddressBook#containsTag() does, but also checks that Person objects points to Tag objects in the master Tag list instead of keeping its own copies of Tags. The alternative of updating AddressBook#containsTag() to compare by reference to take over the responsibilities of AddressBookTest#isTagObjectInAddressBookList() is inconsistent with our API design, as it would mean adding a method used only in tests to production code.
- Loading branch information