Developer Guide
- Table of Contents
Acknowledgements
- This project is based on the AddressBook Level-3 application.
- Class names were renamed from AB3 defaults to CatPals-related names to better match the project domain.
- AI-assisted development tools used: Claude Code and Cursor.
Setting up, getting started
Refer to the guide Setting up and getting started.
Design
.puml files used to create diagrams are in this document docs/diagrams folder. Refer to the PlantUML Tutorial at se-edu/guides to learn how to create and edit diagrams.
Architecture

The Architecture Diagram given above explains the high-level design of the App.
Given below is a quick overview of main components and how they interact with each other.
Main components of the architecture
Main (consisting of classes Main and MainApp) is in charge of the app launch and shut down.
- At app launch, it initializes the other components in the correct sequence, and connects them up with each other.
- At shut down, it shuts down the other components and invokes cleanup methods where necessary.
The bulk of the app’s work is done by the following four components:
-
UI: The UI of the App. -
Logic: The command executor. -
Model: Holds the data of the App in memory. -
Storage: Reads data from, and writes data to, the hard disk.
Commons represents a collection of classes used by multiple other components.
How the architecture components interact with each other
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command delete 1.

Each of the four main components (also shown in the diagram above),
- defines its API in an
interfacewith the same name as the Component. - implements its functionality using a concrete
{Component Name}Managerclass (which follows the corresponding APIinterfacementioned in the previous point.
For example, the Logic component defines its API in the Logic.java interface and implements its functionality using the LogicManager.java class which follows the Logic interface. Other components interact with a given component through its interface rather than the concrete class (reason: to prevent outside component’s being coupled to the implementation of a component), as illustrated in the (partial) class diagram below.

The sections below give more details of each component.
UI component
The API of this component is specified in Ui.java

The UI consists of a MainWindow that is made up of parts e.g. CommandBox, ResultDisplay, CatListPanel, CatDetailPanel, StatusBarFooter etc. All these, including the MainWindow, inherit from the abstract UiPart class which captures the commonalities between classes that represent parts of the visible GUI. A SplashScreen is also shown on startup before the MainWindow is initialised; it does not extend UiPart.
The UI component uses the JavaFx UI framework. The layout of these UI parts are defined in matching .fxml files that are in the src/main/resources/view folder. For example, the layout of the MainWindow is specified in MainWindow.fxml
The sequence diagram below illustrates how the UI handles a user command:

The UI component,
- executes user commands using the
Logiccomponent. - listens for changes to
Modeldata so that the UI can be updated with the modified data. - keeps a reference to the
Logiccomponent, because theUIrelies on theLogicto execute commands. - depends on some classes in the
Modelcomponent, as it displaysCatobjects residing in theModel.
Logic component
API : Logic.java
Here’s a (partial) class diagram of the Logic component:

The sequence diagram below illustrates the interactions within the Logic component, taking execute("delete 1") API call as an example.

DeleteCommandParser should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
How the Logic component works:
- When
Logicis called upon to execute a command, it is passed to anAddressBookParserobject which in turn creates a parser that matches the command (e.g.,DeleteCommandParser) and uses it to parse the command. - This results in a
Commandobject (more precisely, an object of one of its subclasses e.g.,DeleteCommand) which is executed by theLogicManager. - The command can communicate with the
Modelwhen it is executed (e.g. to delete a cat).
Note that although this is shown as a single step in the diagram above (for simplicity), in the code it can take several interactions (between the command object and theModel) to achieve. - The result of the command execution is encapsulated as a
CommandResultobject which is returned back fromLogic.
Here are the other classes in Logic (omitted from the class diagram above) that are used for parsing a user command:

How the parsing works:
- When called upon to parse a user command, the
AddressBookParserclass creates anXYZCommandParser(XYZis a placeholder for the specific command name e.g.,AddCommandParser) which uses the other classes shown above to parse the user command and create aXYZCommandobject (e.g.,AddCommand) which theAddressBookParserreturns back as aCommandobject. - All
XYZCommandParserclasses (e.g.,AddCommandParser,DeleteCommandParser, …) inherit from theParserinterface so that they can be treated similarly where possible e.g, during testing.
Model component
API : Model.java

The Model component,
- stores the address book data i.e., all
Catobjects (which are contained in aUniqueCatListobject). - stores the currently ‘selected’
Catobjects (e.g., results of a search query) as a separate filtered list which is exposed to outsiders as an unmodifiableObservableList<Cat>that can be ‘observed’ e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. - stores a
UserPrefobject that represents the user’s preferences. This is exposed to the outside as aReadOnlyUserPrefobjects. - does not depend on any of the other three components (as the
Modelrepresents data entities of the domain, they should make sense on their own without depending on other components)
Storage component
API : Storage.java

The Storage component,
- can save both address book data and user preference data in JSON format, and read them back into corresponding objects.
- inherits from both
AddressBookStorageandUserPrefStorage, which means it can be treated as either one (if only the functionality of only one is needed). - depends on some classes in the
Modelcomponent (because theStoragecomponent’s job is to save/retrieve objects that belong to theModel)
Common classes
Classes used by multiple components are in the seedu.address.commons package.
Implementation
This section describes some noteworthy details on how certain features are implemented.
Add feature
The add command allows users to add a new cat profile to the cat notebook. It is implemented via AddCommand, which extends Command, and AddCommandParser, which parses the user’s input.
Format: add n/NAME t/TRAIT l/LOCATION [h/HEALTH_STATUS]
-
n/NAME,t/TRAIT, andl/LOCATIONare required. -
h/HEALTH_STATUSis optional. - You can specify up to 3
t/TRAITprefixes, but duplicate traits are not allowed.

The add command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParseridentifies theaddkeyword and creates anAddCommandParser, which parses the remaining arguments (name, trait, location, and optional health status) into aCatobject wrapped in anAddCommand. -
LogicManagercallsAddCommand#execute(model). -
AddCommandchecks for duplicates viaModel#hasCat(cat). If a cat with the same name already exists, aCommandExceptionis thrown. - If no duplicate is found,
Model#addCat(cat)is called to persist the new cat. - A
CommandResultis returned with a success message.
Attach feature
The attach command allows users to attach an image to an existing cat profile, or reset a previously attached image back to auto-detection. It is identified by index or name. It is implemented via AttachCommand, which extends Command, and AttachCommandParser, which parses the user’s input.
Format:
-
attach INDEX IMAGE_PATHorattach CAT_NAME IMAGE_PATH— attach an image -
attach INDEX --resetorattach CAT_NAME --reset— clear the explicit image path and fall back to auto-detection
AttachCommandParser splits on the last space to separate the identifier from the image path or --reset flag. This allows cat names with spaces (e.g. Snowy White) to be used as identifiers.

The attach command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParseridentifies theattachkeyword and creates anAttachCommandParser, which splits the arguments on the last space. If the last token is--reset, a resetAttachCommandis created (no image path). Otherwise, the last token is parsed as an image path. -
LogicManagercallsAttachCommand#execute(model). - If this is not a reset,
AttachCommandverifies that the image file exists on disk. If not, aCommandExceptionis thrown. - The target cat is resolved:
- If an index was given, the cat is retrieved from the filtered list via
Model#getFilteredCatList(). An out-of-bounds index throws aCommandException. - If a name was given, the cat is searched case-insensitively across the full cat list via
Model#getAddressBook(). A missing name throws aCommandException.
- If an index was given, the cat is retrieved from the filtered list via
- A new
Catobject is constructed with the updated image path (or an emptyCatImagefor reset), andModel#setCat(catToEdit, updatedCat)is called. - A
CommandResultis returned with a success message (MESSAGE_ATTACH_SUCCESSorMESSAGE_RESET_SUCCESS).
images/Bowie.png) in the images/ folder. Both attach and attach --reset are undoable.
Delete feature
The delete command allows users to remove an existing cat profile from the cat notebook, identified by index or name. It is implemented via DeleteCommand, which extends Command, and DeleteCommandParser, which parses the user’s input.
Format: delete INDEX or delete CAT_NAME
The delete command works as follows:

-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParseridentifies thedeletekeyword and creates aDeleteCommandParser, which attempts to parse the argument as an index first. If that fails, it treats the argument as a cat name (case-insensitive). -
LogicManagercallsDeleteCommand#execute(model). -
DeleteCommandretrieves the current filtered cat list viaModel#getFilteredCatList(). - The target cat is resolved:
- If an index was given, the cat at that position is retrieved. An out-of-bounds index throws a
CommandException. - If a name was given, the cat is located by exact name match. If no match is found, a
CommandExceptionis thrown.
- If an index was given, the cat at that position is retrieved. An out-of-bounds index throws a
-
Model#deleteCat(cat)is called to remove the cat from the address book. - A
CommandResultis returned with a success message.
Update feature
The update command allows users to change an existing cat’s name, traits, location, or health status. The cat is identified either by index or by name, both matched against the currently displayed (filtered) list. It is implemented via UpdateCommand, which extends Command, and UpdateCommandParser, which parses the user’s input.
Format: update CAT_NAME [n/NAME] [t/TRAIT]... [l/LOCATION] [h/HEALTH_STATUS] or update INDEX [n/NAME] [t/TRAIT]... [l/LOCATION] [h/HEALTH_STATUS]
- At least one of
n/,t/,l/, orh/must be present; otherwise aParseExceptionis thrown withMESSAGE_INVALID_COMMAND_FORMAT(showingUpdateCommand.MESSAGE_USAGE). If prefixes are present but all values are empty after parsing, aParseExceptionis thrown withUpdateCommand.MESSAGE_NOT_EDITED. -
n/,t/,l/, andh/are case-insensitive for theaddandupdatecommands (e.g.N/andn/are treated the same). This is done inUpdateCommandParser#normalizeUpdatePrefixesbefore tokenization. - Duplicate
n/,l/, orh/prefixes in one command are rejected viaArgumentMultimap#verifyNoDuplicatePrefixesFor. - Multiple
t/TRAITprefixes are allowed (subject to the usual cap of three traits and no duplicates within the parsed list). - Supplying
t/replaces the cat’s entire trait list with the traits given in that command. To keep existing traits, the user must include them again alongside any new ones. A lonet/with no value clears all traits (parsed as an empty trait list). - If the target is specified by name, lookup is case-insensitive (
equalsIgnoreCaseon the full name) and searches the filtered list (Model#getFilteredCatList()). If no cat matches, aCommandExceptionis thrown withUpdateCommand.MESSAGE_INVALID_CAT_NAME. - If the target is specified by index, it refers to the filtered list (
Model#getFilteredCatList()). An out-of-bounds index results inMessages.MESSAGE_INVALID_CAT_DISPLAYED_INDEX. - After applying edits, if the updated cat would duplicate another cat’s identity (same name as a different entry),
Model#hasCatcauses aCommandExceptionwithUpdateCommand.MESSAGE_DUPLICATE_CAT.
The following sequence diagram shows how an update operation is carried out:

UpdateCommandParser should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
The update command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParseridentifies theupdatekeyword and creates anUpdateCommandParser, which normalizes prefix casing, tokenizes arguments, and parses the preamble as either an index or a validName, together with anEditCatDescriptorfor the fields to change. -
LogicManagercallsUpdateCommand#execute(model). -
UpdateCommandresolves the cat to edit from the filtered list (by both index and name), then builds an updatedCatviacreateEditedCat, merging descriptor fields with the existing cat. - Duplicate-name checks and
Model#setCatare applied. If the updated cat no longer matches the current filter predicate, the filtered list is updated to keep the edited cat visible alongside the other filtered results. - A
CommandResultis returned with a success message.
Find feature
The find command updates which cats are shown in the UI by applying a CatContainsKeywordsPredicate over the address book. It is implemented via FindCommand and FindCommandParser.
Format: find [n/NAME]... [l/LOCATION]... [t/TRAIT]... [h/HEALTH_STATUS]... — at least one of n/, l/, t/, or h/ must be present, and there must be no preamble (anything before the first prefix causes a parse error).
-
FindCommandParsernormalizesn/t/l/hprefix casing (case-insensitive), then tokenizes and validates keywords (non-empty, single token per value). -
FindCommand#executecallsModel#updateFilteredCatList(predicate)with aCatContainsKeywordsPredicate. If the filtered list is empty,FindCommand.MESSAGE_NO_MATCHis returned; otherwise an overview message is shown.
The following sequence diagram shows how a find operation is carried out:

FindCommandParser should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
The find command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParseridentifies thefindkeyword and creates aFindCommandParser, which parses prefixed keywords into aCatContainsKeywordsPredicatewrapped in aFindCommand. -
LogicManagercallsFindCommand#execute(model). -
FindCommandupdates the filtered cat list viaModel#updateFilteredCatList(predicate). - A
CommandResultis returned (either a “no match” message or a listed-cats overview).
Export feature
The export feature allows users to export the currently displayed cat list to an HTML file. It is implemented via ExportCommand, which extends Command, and ExportCommandParser, which parses the optional title/filename argument.
Format: export [TITLE]
- If
TITLEis omitted, the file is saved asexport.htmlwith the heading “Cat List”. - If
TITLEis provided (e.g.export Utown Cats), spaces are replaced with hyphens for the filename (Utown-Cats.html), and the original text is used as the page heading (Utown Cats). -
TITLEmust not contain any of the characters\ / : * ? " < > |, otherwise aParseExceptionis thrown.
The following sequence diagram shows how an export operation is carried out:

The export command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParseridentifies theexportkeyword and creates anExportCommandParser, which trims the remaining arguments. If empty, a defaultExportCommandis returned. Otherwise, spaces are replaced with hyphens to form the filename and the original trimmed text becomes the page title; invalid filename characters cause aParseException. -
LogicManagercallsExportCommand#execute(model). -
ExportCommandretrieves the currently filtered cat list viaModel#getFilteredCatList(). This respects any activefindfilters — only the cats currently shown in the UI are exported. - An HTML string is built for each cat and written to
<filename>.htmlin the application’s working directory. - A
CommandResultis returned indicating how many cats were exported and the output filename.
export is not undoable — it does not modify address book data. As a read-only command, it leaves the undo state untouched, so a previous undoable command can still be undone after exporting.
Clear feature
The clear command removes all cats from the address book by replacing it with an empty AddressBook. It is implemented via ClearCommand, which extends Command. There is no dedicated parser — AddressBookParser instantiates ClearCommand directly when the user types clear (any extra text after the command word is not parsed and does not affect execution).
The following sequence diagram shows how a clear operation is carried out:

The clear command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParsercreates aClearCommand. - Before execution,
LogicManagerclears any saved undo state viaModel#clearUndoState()(sinceclearis not treated as an undoable single-cat command in the same way asadd/delete/update/attach). -
LogicManagercallsClearCommand#execute(model). -
ClearCommandcallsModel#setAddressBook(new AddressBook()), removing all cat entries. - A
CommandResultis returned with a success message. -
LogicManagerpersists the empty address book viaStorage#saveAddressBook.
List feature
The list command shows all cats in the address book. It is implemented via ListCommand, which extends Command, and requires no dedicated parser class. Like help, exit, and clear, extra parameters are silently ignored — AddressBookParser instantiates ListCommand directly regardless of any trailing arguments.
Implementation flow:
- User types e.g.
list(orlist foo) and presses Enter. -
AddressBookParser#parseCommand()matches the command word"list"and returns a newListCommand. -
ListCommand#execute()callsModel#updateFilteredCatList(PREDICATE_SHOW_ALL_CATS)and returns a success result.
Help feature
The help command shows usage information by returning a CommandResult that signals the UI to open the help window. It is implemented via HelpCommand, which extends Command. There is no dedicated parser — AddressBookParser instantiates HelpCommand directly when the user types help.
The following sequence diagram shows how the help command is handled:

The help command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParsercreates aHelpCommandwith no arguments. -
LogicManagercallsHelpCommand#execute(model)(the model is not modified). - A
CommandResultis returned withshowHelpset to true; the UI then opens the help window.
Exit feature
The exit command shuts down the application. It is implemented via ExitCommand, which extends Command. There is no dedicated parser — AddressBookParser instantiates ExitCommand directly when the user types exit.
The following sequence diagram shows how the exit command is handled:

The exit command works as follows:
-
LogicManagerreceives the command string and delegates parsing toAddressBookParser. -
AddressBookParsercreates anExitCommandwith no arguments. -
LogicManagercallsExitCommand#execute(model)(the model is not modified). - A
CommandResultis returned withexitset to true; the UI then terminates the application.
Undo feature
The undo mechanism uses a single-snapshot approach managed by ModelManager. Before executing any undoable command (add, delete, update, attach), LogicManager calls Model#saveUndoState(), which saves a deep copy of the current AddressBook into a previousAddressBook field. When the user runs undo, the saved snapshot is restored.
The mechanism exposes the following operations via the Model interface:
-
Model#saveUndoState()— Saves a snapshot of the current address book before an undoable command runs. -
Model#clearUndoState()— Clears the saved snapshot. Only called afterclear, since it is a destructive non-reversible command. -
Model#canUndo()— Returns true if there is a saved snapshot available. -
Model#undoLastChange()— Restores the address book to the saved snapshot and clears it. -
Model#getUndoSnapshot()— Returns the current undo snapshot (used for rollback on command failure). -
Model#setUndoSnapshot(snapshot, hasState)— Restores a previous undo snapshot (used for rollback on command failure).
Given below is an example usage scenario and how the undo mechanism behaves at each step.
Step 1. The user launches the application for the first time. No undo snapshot exists yet (previousAddressBook is null, hasUndoableState is false).
Step 2. The user executes add n/Mochi t/Calico l/UTown to add a new cat. Before the add command executes, LogicManager backs up the existing undo snapshot and calls Model#saveUndoState(), saving the current address book state. If the command succeeds, LogicManager also stores the full command text ("add n/Mochi t/Calico l/UTown") for use in the undo confirmation dialog. If the command fails, LogicManager rolls back the undo snapshot to its previous state.
Step 3. The user executes update Mochi l/PGPR to update the cat’s location. Before the update command executes, LogicManager calls Model#saveUndoState() again, overwriting the previous snapshot with the current state (post-add). The stored command text is updated to "update Mochi l/PGPR".
LogicManager rolls back the undo snapshot to its previous state using Model#setUndoSnapshot(). This ensures that a failed command does not corrupt the undo state of a previously successful command. Only one level of undo is supported — the most recent successful undoable command overwrites any previous snapshot.
Step 4. The user now decides that updating the location was a mistake, and executes the undo command.
-
MainWindowchecksLogic#canUndo()to see if a snapshot exists. - Since a snapshot exists,
MainWindowshows a confirmation dialog displaying the last undoable command: “Are you sure you want to undo the following command? > update Mochi l/PGPR”. - If the user confirms,
MainWindowcallsLogic#executeCommand(undoCommand). -
UndoCommand#execute()callsModel#undoLastChange(), which restores the address book to the snapshot (post-add state) and clears the snapshot.
clear), Model#canUndo() returns false. MainWindow skips the confirmation dialog, and UndoCommand returns a “Nothing to undo.” message.
The following sequence diagram shows how an undo operation goes through the UI and Logic components. Before the undo is executed, MainWindow calls Logic#canUndo() to check whether there is a saved state to restore. If there is, a confirmation dialog is shown. The undo is only carried out if the user confirms.

UndoCommand should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
Similarly, how an undo operation goes through the Model component is shown below:

Step 5. The user then executes the command list. Read-only commands (list, find, help, export, exit) do not modify the address book and do not affect the undo state. If a snapshot existed before list, it remains available for undo afterwards.
Step 6. The user executes clear. Since clear is a destructive non-reversible command, LogicManager calls Model#clearUndoState() to discard any saved snapshot. The user cannot undo a clear.
Undo state behaviour summary
| Command type | Examples | Effect on undo state |
|---|---|---|
| Undoable |
add, delete, update, attach
|
Saves a new snapshot (overwrites any previous) |
| Destructive non-reversible | clear |
Clears the snapshot |
| Read-only |
list, find, help, export, exit, undo
|
No effect — snapshot is preserved |
Design considerations:
Aspect: How undo executes:
-
Alternative 1 (current choice): Saves the entire address book as a single snapshot.
- Pros: Easy to implement. One level of undo is sufficient for most use cases.
- Cons: May have performance issues in terms of memory usage for very large data sets. Only supports one level of undo.
-
Alternative 2: Individual command knows how to undo by itself.
- Pros: Will use less memory (e.g. for
delete, just save the cat being deleted). Could support multi-level undo. - Cons: We must ensure that the implementation of each individual command is correct.
- Pros: Will use less memory (e.g. for
Documentation, logging, testing, configuration, dev-ops
Appendix: Requirements
Product scope
Target user profile:
- is a member of NUS Cate Cafe CCA
- has a need to manage a significant number of stray cats in NUS Campus
- prefer desktop apps over other types
- can type fast
- prefers typing to mouse interactions
- is reasonably comfortable using CLI apps
Value proposition:
Provides fast, CLI-optimized access to information of stray cats living in NUS campus so volunteers can reliably identify cats and keep key status details up to date. Designed for personal or small-team use; not a veterinary medical system, shelter operations tool, or public registry.
User stories
Priorities: MVP - * * * *, High (must have) - * * *, Medium (nice to have) - * *, Low (unlikely to have) - *
| Priority | As a … | I want to … | So that I can… |
|---|---|---|---|
* * * * |
regular feeder | search a cat by name/alias in the CLI | identify it quickly on the spot |
* * * * |
volunteer | update a cat’s key status fields (e.g., sterilised/ear-tipped, friendliness, usual area) | our data stays accurate for small-team coordination |
* * * * |
volunteer | add cat entries | keep the record of a newly-found stray cat |
* * * * |
user | delete a cat profile | remove duplicate entries or data errors to keep the database clean |
* * * |
frequent user | use short-hand flags (e.g., -n for name, -t for territory) | type faster |
* * * |
volunteer | add and search by multiple identifiers (alias, coat color, landmark) | still find a cat when I don’t know its name |
* * * |
volunteer updating a cat’s record | prompted by the CLI for confirmation before applying changes | not accidentally overwrite important information |
* * * |
volunteer | export the list of cats data stored in this app | get a physical copy of the list |
* * * |
volunteer | undo or revert my last update | be away from the risk where accidental edits permanently corrupt records |
* * * |
volunteer | tag a cat with quick flags (e.g., “shy”, “approachable”, “avoid”) | interact safely and consistently |
* * * |
user | see a quick profile of each cat on the main page | get an overview of all the cats without diving into details |
* * * |
new user | run a guided “first-time” CLI help command | learn the workflow quickly |
* * * |
volunteer | filter cats by certain attributes | get the information of a group of cats that share some similarities |
* * * |
volunteer | attach an image of the cat | see how the cat is looked like in the most directly way |
* * |
user | use a personal account and a corresponding key to login | be away from the issue that unauthorized users will have access to this system |
* * |
user | attach a link that keeps an archive of the cat (videos, more pictures) for each cat recorded in this system | more information of cats can be retrieved without taking up storage inside of this app |
* * |
commitee member | edit a cat’s profile to change their status to “adopted” | stop deploying resources for cats that are no longer on campus |
* * |
volunteer | mark a cat’s entry grey to indicate that the cat has unfortunately died | show respect and R.I.P to cats |
* * |
first time user | learn how to use this app with a tutorial provided when I first open it | get myself familiar without exploring by myself |
* |
volunteer | auto-identify a cat from a photo using on-device recognition | be free from typing names at all |
* |
volunteer | see a list of “Missing in Action” cat | rescue them in time |
* |
volunteer | use fuzzy search and typo tolerance | find cats quickly even with imperfect spelling |
* |
volunteer | “favorite” a set of cats | pull up my usual watchlist with one command |
* |
volunteer | create a “needs follow-up” note (non-medical) | be in the situation where the next person knows what to check without guessing |
* |
volunteer | maintain a “cat family tree / social graph” (friendships, rivalries, territories) | understand colony dynamics over time |
* |
volunteer | record structured medical observations (symptoms checklist + severity) | get to the concerns consistently (not a diagnosis) |
* |
volunteer | log medication administration (drug name, dosage, time, handler) | track the treatment history and thus reduces mistakes |
* |
volunteer | get “triage suggestions” based on symptoms | know whether to monitor, isolate, or escalate (high-risk, needs careful disclaimers) |
* |
volunteer | use arrow keys (or command history) | quickly repeat a previous complex command without re-typing it entirely |
* |
volunteer | keep track of where the cat is last seen (especially if out of its own territory) | track the cat in a more detailed way |
{More to be added}
Use cases
(For all use cases below, the System is the CatPals app and the Actor is the user, unless specified otherwise)
Use case 1 (U1): Add a cat
MSS
- User requests to add a cat
-
CatPals adds the cat
Use case ends.
Extensions
-
1a. The provided name is blank.
- 1a1. CatPals shows an error message: “Name must not be blank!”. Use case ends.
-
1b. The name length exceeds 30 characters.
- 1b1. CatPals shows an error message: “Name must be no longer than 30 chars!”. Use case ends.
-
1c. The name contains symbols.
- 1c1. CatPals shows an error message: “The name must not contain symbols!”. Use case ends.
-
1c2. The name consists of only numbers (e.g.
123).- 1c2a. CatPals shows an error message: “Name must contain at least one letter and cannot be only numbers!”. Use case ends.
-
1d. A cat with the same name already exists in CatPals.
- 1d1. CatPals shows an error message: “The cat name already exists!”. Use case ends.
-
1e. The trait field is blank.
- 1e1. CatPals shows an error message: “Your Add command is incomplete. Please enter again.”. Use case ends.
-
1f. The user inputs more than 3 traits.
- 1f1. CatPals shows an error message: “You added more than 3 traits to the cat. Please only add up to 3 traits.”. Use case ends.
-
1g. The user inputs duplicate traits.
- 1g1. CatPals shows an error message: “You cannot add duplicate traits!”. Use case ends.
-
1h. The location field is blank.
- 1h1. CatPals shows an error message: “Location must not be blank!”. Use case ends.
-
1i. The location length exceeds 50 characters.
- 1i1. CatPals shows an error message: “Location must be no longer than 50 chars!”. Use case ends.
-
1j. The user inputs duplicate location prefixes (e.g.
l/Utown l/Science).- 1j1. CatPals shows an error message: “Multiple values specified for the following single-valued field(s): l/”. Use case ends.
-
1k. The trait length exceeds 50 characters.
- 1k1. CatPals shows an error message: “Trait must be no longer than 50 chars!”. Use case ends.
-
1l. The health status length exceeds 50 characters.
- 1l1. CatPals shows an error message: “Health status must be no longer than 50 chars!”. Use case ends.
Use case 2 (U2): Delete a cat
MSS
- User requests to list cats
- CatPals shows a list of cats
- User requests to delete a specific cat in the list
-
CatPals deletes the cat
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The user requests to delete by name.
- 3a1. The name is blank or contains invalid symbols.
- 3a1a. CatPals shows an error message: “Invalid command format! delete: Deletes the cat identified by the index number or name in the displayed cat list. Parameters: INDEX (must be a positive integer) or CAT_NAME Example: delete 1 Example: delete Whiskers”. Use case ends.
- 3a2. The name does not match any cat in CatPals.
- 3a2a. CatPals shows an error message: “No cat with the name ‘Mocha’ found in the displayed list.”. Use case ends.
- 3a1. The name is blank or contains invalid symbols.
-
3b. The user requests to delete by number (index).
- 3b1. The number is blank.
- 3b1a. CatPals shows an error message: “Invalid command format! delete: Deletes the cat identified by the index number or name (case-sensitive) in the displayed cat list. Parameters: INDEX (must be a positive integer) or CAT_NAME Example: delete 1 Example: delete Whiskers”. Use case ends.
- 3b2. The number is out of range (invalid index).
- 3b2a. CatPals shows an error message: “The cat index provided is invalid”. Use case resumes at step 2.
- 3b1. The number is blank.
Use case 3 (U3): Search for a cat using its name
MSS
- User requests to find a specific cat by name
- CatPals shows all cat profiles that match the search
-
User selects a cat profile from the search results to view its details
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. There is no profile with a matching name.
-
3a1. CatPals shows an error message: “There is no such profile in my records! Is there a typo?”.
Use case ends.
-
Use case 4 (U4): Help command
MSS
- User requests to see the help guide
-
CatPals shows a list of available commands and their formats
Use case ends.
Extensions
-
1a. The help command is typed incorrectly.
-
1a1. CatPals shows an error message: “No such command found!”.
Use case ends.
-
Use case 5 (U5): Update cat status
MSS
- User requests to list cats
- CatPals shows a list of cats
- User requests to update the status (traits, location, or health) of a specific cat in the list
-
CatPals updates the status of the cat
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The user requests to update by name.
- 3a1. The name is blank or the command format is invalid.
- 3a1a. CatPals shows an error message with the correct command format. Use case ends.
- 3a2. The name does not match any cat in the displayed list.
- 3a2a. CatPals shows an error message: “No cat with the name ‘
' found in the displayed list.". Use case ends.
- 3a2a. CatPals shows an error message: “No cat with the name ‘
- 3a1. The name is blank or the command format is invalid.
-
3b. The user requests to update by index.
- 3b1. The index is blank or the command format is invalid.
- 3b1a. CatPals shows an error message with the correct command format. Use case ends.
- 3b2. The index is out of range (invalid index).
- 3b2a. CatPals shows an error message: “The cat index provided is invalid”. Use case resumes at step 2.
- 3b1. The index is blank or the command format is invalid.
-
3c. The updated status data is invalid.
- 3c1. The user inputs more than 3 traits.
- 3c1a. CatPals shows an error message: “You added more than 3 traits to the cat. Please only add up to 3 traits.”. Use case ends.
- 3c2. The user inputs duplicate traits.
- 3c2a. CatPals shows an error message: “You cannot add duplicate traits!”. Use case ends.
- 3c3. The updated cat name already exists (duplicates another cat).
- 3c3a. CatPals shows an error message: “This cat already exists in the cat notebook.”. Use case ends.
- 3c1. The user inputs more than 3 traits.
Use case 6 (U6): Undo last action
MSS
- User requests to undo the previous command.
- CatPals shows a confirmation dialog displaying the command that will be undone.
- User confirms the undo.
- CatPals reverts the last change made to the notebook.
-
CatPals shows a success message confirming the restoration.
Use case ends.
Extensions
-
1a. There is no saved undo state (no undoable command has been run yet, or the state was cleared by
clear).-
1a1. CatPals shows a message: “Nothing to undo.”
Use case ends.
-
-
1b. Read-only commands (
list,find,help,export) were run after the last undoable command.- 1b1. The undo state is preserved across read-only commands, so the user can still undo the last undoable command. Flow continues at step 2.
-
3a. User cancels the confirmation dialog.
-
3a1. The undo is not performed. No state change occurs.
Use case ends.
-
Use case 7 (U7): Attach an image to a cat profile
MSS
- User provides the target cat (by index or name) and the image file path
- CatPals validates the file path and format, then attaches the image to the cat profile
-
CatPals shows a success message confirming the attachment
Use case ends.
Extensions
- 1a. The target index is out of bounds.
- 1a1. CatPals shows an error message: “The cat index provided is invalid”. Use case ends.
- 1b. The target cat name does not match any cat in CatPals.
- 1b1. CatPals shows an error message: “No cat with the name
<name>found.”. Use case ends.
- 1b1. CatPals shows an error message: “No cat with the name
- 1c. The user provides
--resetinstead of an image path.- 1c1. CatPals clears the explicit image path for the cat, reverting to auto-detection.
- 1c2. CatPals shows a success message confirming the reset. Use case ends.
- 2a. The provided file path does not exist.
- 2a1. CatPals shows an error message: “Image file not found:
<path>”. Use case ends.
- 2a1. CatPals shows an error message: “Image file not found:
- 2b. The file is not a supported image format (not
.jpg,.jpeg, or.png).- 2b1. CatPals shows an error message indicating the incorrect format and the supported types. Use case ends.
Use case 8 (U8): Export cat data
MSS
- User requests to export the currently displayed cat list, optionally providing a title (e.g.
export Utown Cats) - CatPals exports the cats to an HTML file named after the title (e.g.
utown-cats.html), using the title as the page heading -
CatPals shows a success message indicating how many cats were exported and the output filename
Use case ends.
Extensions
- 1a. No title is provided (user types just
export).- 1a1. CatPals exports to
export.htmlwith the default heading “Cat List”. Use case ends.
- 1a1. CatPals exports to
- 1b. The title contains invalid filename characters (e.g.
\ / : * ? " < > |).- 1b1. CatPals shows an error message listing the disallowed characters. Use case ends.
Use case 9 (U9): Filter cats by traits
MSS
- User requests to filter cats by specific traits (e.g.
find t/Friendly) -
CatPals displays a list of cats that match the specified traits
Use case ends.
Extensions
- 2a. No cats match the specified traits.
- 2a1. CatPals shows an error message: “There is no such profile in my records! Is there a typo?”. Use case ends.
Non-Functional Requirements
- Should work on any mainstream OS as long as it has Java
17or above installed. - Should be able to hold up to 1000 cats without a noticeable sluggishness in performance for typical usage.
- A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.
Compatibility
- Should work on any mainstream OS (Windows, macOS, Linux) as long as Java
17or above is installed.
Performance
- Should be able to hold up to 1000 cat records without noticeable sluggishness in performance for typical usage.
- Response time for adding, deleting, or editing a record should be under 1 second.
- Search results should be displayed within 0.5 seconds of input.
Usability
- A user with above average typing speed for regular English text should be able to accomplish most tasks faster using commands than using the mouse.
- A new user should be able to complete their first cat record entry within 5 minutes.
Reliability
- Data should be automatically saved after each operation without requiring manual saving.
- Data should be fully recoverable after an unexpected application crash.
Maintainability
- Adding new fields should not require significant code refactoring.
Portability
- The system’s data should be exportable to open, human-readable formats (e.g. HTML) to facilitate backup, migration, and interoperability with other systems.
{More to be added}
Glossary
- Mainstream OS: Windows, Linux, Unix, MacOS
- JavaFX: A Java library used to build the graphical user interface (GUI) of this application
- FXML: An XML-based file format used by JavaFX to define the layout and structure of UI components separately from application logic
- Component: A self-contained, replaceable part of the application (e.g., UI, Logic, Model, Storage), each responsible for a distinct concern and communicating with others only through defined interfaces
- Coupling: The degree of dependency between components. Low coupling is preferred, as it means changes to one component are less likely to break others
- Model: The component that holds all in-memory application data (cat entries)
- ObservableList: A JavaFX list that automatically notifies listeners (such as the UI) when its contents change, enabling the display to refresh without manual intervention
- Filtered List: A view of the full entry list showing only entries that match current search criteria. It updates dynamically as the underlying data or filter changes
- State/CatPals state: A complete snapshot of the application’s data at a given point in time. Used by the undo feature to restore previous versions
- Sequence Diagram: A UML diagram showing how objects interact with each other in a specific time-ordered sequence of method calls
- Activity diagram: A UML diagram showing the flow of control through a process, including decision points and parallel actions
- Class diagram: A UML diagram showing the structure of classes, their attributes, methods, and relationships (e.g., inheritance, association)
- MSS: Main Success Scenario. The primary, happy-path flow of a use case, describing what happens when everything goes as expected with no errors or exceptions
- PlantUML: A tool that generates UML diagrams from plain text descriptions. The .puml files in this project define all architectural diagrams
- Lifeline (in sequence diagrams): The vertical dashed line in a sequence diagram representing an object’s existence over time. It ends with a destroy marker (X) when the object is no longer needed
Appendix: Instructions for manual testing
Given below are instructions to test the app manually.
Test setup
- Download the latest
catpals.jarinto an empty folder. - Ensure Java
17or above is installed. - Launch with
java -jar catpals.jarfrom that folder. - Ensure
data/addressbook.jsonis created after first successful data-changing command. - Keep a backup copy of
data/addressbook.jsonbefore destructive tests (clear, malformed file tests).
Launch, shutdown, and UI state
- Initial launch
- Run
java -jar catpals.jar. - Expected: splash screen appears, then main window opens after pressing
Space. - Expected: sample cat entries are shown on first run.
- Run
- Window preference persistence
- Resize and reposition the app window.
- Close and relaunch.
- Expected: window size and position are restored.
- Keyboard navigation
- Use
Up/Downarrows in command box. - Expected: selected cat changes and detail panel updates.
- Use
- Graceful exit
- Run
exit. - Expected: app closes without errors.
- Run
Command parsing and basic validation
- Unknown command
- Test case:
foobar - Expected: error indicating unknown command.
- Test case:
- Case-insensitive command words where supported
- Test cases:
FIND n/Bowie,HeLp,LiSt. - Expected: command behavior matches lowercase equivalent.
- Test cases:
- Extra parameters policy checks
- Test cases:
help extra,clear extra,exit extra,list extra - Expected: command still executes (extra text ignored).
- Test cases:
Feature-level test cases
Add
- Valid add
- Test case:
add n/Brownie t/Friendly t/Orange l/Utown h/Healthy - Expected: new cat appears in list with all fields.
- Test case:
- Required fields missing
- Test case:
add n/Brownie l/Utown - Expected: parse/usage error.
- Test case:
- Trait constraints
- Test case: more than 3 traits.
- Expected: validation error.
- Test case: duplicate trait values.
- Expected: validation error.
- Location constraints
- Test case: duplicate location prefixes (e.g.
add n/Brownie t/Friendly l/Utown l/Science). - Expected: error message “Multiple values specified for the following single-valued field(s): l/”.
- Test case: duplicate location prefixes (e.g.
- Duplicate identity
- Add a cat, then add another with same name.
- Expected: duplicate-cat rejection.
Attach
- Attach by index
- Test case:
attach 1 images/bowie.png - Expected: selected cat displays image (if path exists).
- Test case:
- Attach by name
- Test case:
attach Bowie images/bowie.png - Expected: matching cat gets image.
- Test case:
- Invalid path
- Test case:
attach 1 images/does-not-exist.png - Expected: command fails with invalid path/file message.
- Test case:
- Invalid target
- Test case:
attach 999 images/bowie.png - Expected: invalid index error.
- Test case:
Update
- Update by index
- Test case:
update 1 n/Snowy t/White l/COM3 h/Vaccinated - Expected: cat fields update after confirmation.
- Test case:
- Update by current name
- Test case:
update Snowy h/Healthy - Expected: correct cat updated.
- Test case:
- No fields provided
- Test case:
update 1 - Expected: error indicating at least one field required.
- Test case:
- Trait replacement semantics
- Test case:
update 1 t/Shy - Expected: existing traits are replaced by only
Shy.
- Test case:
- Cancel path
- Run valid
update, then cancel at confirmation dialog. - Expected: no data change.
- Run valid
Find and list interaction
- Single-field find
- Test case:
find n/Bow - Expected: only matching names remain in filtered list.
- Test case:
2.Multi-field find
- Test case:
find l/Utown t/Friendly -
Expected: results satisfy all specified field groups.
- No match behavior
- Test case:
find n/NoSuchCat - Expected: empty list and no-match message.
- Test case:
- Reset after filtering
- Test case: run any
find, thenlist. - Expected: full cat list is shown again.
- Test case: run any
Delete
- Delete by filtered index
- Run
findto reduce list. - Test case:
delete 1 - Expected: first cat in filtered view is removed after confirmation.
- Run
- Delete by name
- Test case:
delete Brownie - Expected: cat with that name is removed after confirmation.
- Test case:
- Invalid index/name
- Test cases:
delete 0,delete 999,delete NoSuchCat - Expected: command fails without data change.
- Test cases:
- Cancel path
- Run valid delete, then cancel confirmation.
- Expected: no deletion occurs.
Export
- Default export
- Test case:
export - Expected:
export.htmlis created in app folder.
- Test case:
- Custom filename
- Test case:
export utown cats - Expected:
utown-cats.htmlis created.
- Test case:
- Filter-aware export
- Run
find l/Utown, thenexport subset. - Expected: exported file contains only currently displayed cats.
- Run
- Invalid filename characters
- Test case:
export bad:name - Expected: validation error; no file created.
- Test case:
Clear
- Confirm clear
- Test case:
clear - Confirm dialog.
- Expected: all cats removed.
- Test case:
- Cancel clear
- Test case:
clear, then cancel. - Expected: list remains unchanged.
- Test case:
Help
- Open help UI
- Test case:
help - Expected: help window/panel is shown.
- Test case:
Undo
- Undo supported commands
- Perform
add, thenundo. - Expected: confirmation dialog appears showing the full
addcommand. After confirming, added cat is reverted. - Repeat for
delete,update, andattach.
- Perform
- Undo after read-only commands (state preserved)
- Run
add, thenfind, thenundo. - Expected: undo still works — the
addis reverted because read-only commands preserve the undo state. - Run
add, thenlist, thenundo. - Expected: undo still works — the
addis reverted.
- Run
- Undo after
clear(state cleared)- Run
add, thenclear, thenundo. - Expected:
Nothing to undo.(clearclears the undo state).
- Run
- Undo with no prior undoable command
- Launch app fresh, then
undo. - Expected:
Nothing to undo.
- Launch app fresh, then
- Repeated undo
- Run one undoable command, then
undotwice. - Expected: first succeeds (with confirmation dialog), second reports nothing to undo.
- Run one undoable command, then
- Undo confirmation cancel
- Run
add, thenundo, then press Escape on the confirmation dialog. - Expected: undo is cancelled, the added cat remains.
- Run
Data persistence and recovery tests
-
Persistence across restart
- Add/update/delete at least one cat.
- Close app and relaunch.
- Expected: latest data state is preserved.
- Missing data file
- Close app.
- Rename
data/addressbook.jsontoaddressbook.backup.json. - Relaunch.
- Expected: app starts with empty/sample fallback state (no crash), and recreates data file when data changes are made.
- Corrupted data file
- Close app.
- Edit
data/addressbook.jsonand intentionally break JSON syntax. - Relaunch.
- Expected: app handles read failure gracefully (error log/message) and starts without crashing.
- Restore backup file and relaunch to continue normal testing.
Regression checklist (quick pass before release)
-
add,update,delete,attachstill work end-to-end. -
find+listinteraction remains correct. -
exportoutput file is generated and readable in browser. -
clearconfirmation works and clears all entries. -
undobehavior matches current one-level design and command support. - Data survives restart and window preferences persist.