Right now, we can add and view tasks from our Web interface. Our persistence layer exposes an interface to let us delete tasks, also.
An essential part of task management software is to mark tasks as completed. Now is a reasonable time to work toward that goal.
There are at least two basic paths toward that goal that have some prima facie plausibility:
Taskobject. Modify the persistence layer to support changing a given
Task. Then expose a task completion mechanism in our Web interface.
I've chosen the second approach, but there is a real tradeoff here. Getting a deletion mechanism working gets us closer to some sort of minimally usable software faster. Getting more than one CRUD operation implemented at the Web level might expose weaknesses in our design faster. Those speak in favor of the first option.
For me, however, distingishing between completion and deletion is too important to leave out of even the very first and most minimal implementation. And modifying existing tasks is important enough, and tricky enough to get right in practice, that I want to address it before implementing task completion.
So I'm going to take the latter approach. But, to be clear: reasonable people could choose differently, and this is definitely not a case where taking the more deliberate approach is a direct reflection of wisdom or prudence.
Because distinguishing between "this task is done" and "I'm not going to do this task" is part of why I don't want to implement deletion before updating, I chose not to represent a
Task's completion status as a boolean value. Rather, I defined a
CompletionStatus enum. It very often happens that primitive types on your core domain objects eventually need to be wrapped as custom types. When it's a matter of turning a
bool into an
Enum, it's usually better to do this quickly. So, the sub-steps I took were:
Taskrepresenting its completion status.
Task(not its serialization logic at the repository level--having separated these concerns makes this change easier!) to show its status.
Here's the current commit in the
Next post: Python task manager from scratch, part 22: Another Task field