Skip to content

A-CodeQuality: Improve code quality - #1

Merged
trigg770 merged 3 commits into
masterfrom
branch-A-CodeQuality
Sep 10, 2026
Merged

trigg770 merged 3 commits into
masterfrom
branch-A-CodeQuality

Conversation

@trigg770

@trigg770 trigg770 commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Increment: A-CodeQuality

  • Makes the task fields private (final where they never change), adds Task#getDescription(), and moves the shared date format into Task.
  • Corrects stale comments and Javadoc, and rethrows a failed DialogBox FXML load as an IllegalStateException.
  • Accepts /by, /from and /to only as standalone words, so "lunch w/tom" is no longer split at "/to".
  • Trims input in Ted#getResponse, so GUI input with leading spaces works, and shows save-file warnings after the welcome.

🤖 Generated with Claude Code

trigg770 and others added 3 commits September 10, 2026 19:32
Task, Deadline and Event keep their fields protected and mutable, and
TaskList reads a task's description straight from the field. Deadline
and Event each hold their own copy of the display date format.

Several comments no longer match the code. ExitCommand describes the
old conversation loop, Ui's show methods say they print, and
TaskList#asList says it returns a view when it returns a copy.
DialogBox catches a failed FXML load to keep the app running, yet the
next line fails with a NullPointerException anyway.

Fields that any class in the package can reassign undercut the
guarantees Task exists to give, and comments that contradict the code
mislead the next reader.

Let's
* make the task fields private, and final where they never change,
  with Task#getDescription() for the search to use
* move the display format into Task so both subclasses share one copy
* correct the stale comments and Javadoc
* rethrow a failed DialogBox load as an IllegalStateException, since
  the FXML ships in the JAR and a missing one means a broken build

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Parser locates /by, /from and /to with indexOf, which also matches
them inside a word. "event lunch w/tom /from ... /to ..." is rejected
because the /to in "w/tom" is taken for the separator.

The GUI passes its text field to Ted#getResponse as typed, and only
the terminal trims input, so "  list" in the GUI is an unknown
command. A warning about the save file also appears above the welcome
banner, because the constructor queues it before the greeting exists.

The first two reject ordinary input, and all three show up in the
GUI, which is the version people use.

Let's
* accept an option only as a standalone word
* trim input in Ted#getResponse, where the terminal and the GUI meet,
  rather than in each front end
* hold the startup warnings back until getGreeting has shown the
  welcome
* add a regression test for each case

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@trigg770
trigg770 merged commit af44fda into master Sep 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant