Todo List

Level: Beginner 15–30 min

Concepts: Strings

Solutions: C# | TypeScript | Python


Write a todo list application with the following features:

  1. Enter a task to be completed specifying the task and due date. For simplicity sake save your data to a text file in csv format.

    todo.exe task -t Complete Application -d 2018-04-01
  2. List task specifying the status of the task. The available statuses are All or Incomplete. Incomplete will only show task not marked as completed.

    todo.exe list -s [All| Incomplete]

    The output should be something like

    Id: 1
    Task: Thing #1
    Due: 2018-04-01
  3. Mark a task as complete by passing in the task Id.

    todo.exe -c [Id]

Hint

Only worry about writing the library code to facilitate the todo list. There is no need to actually parse the arguments.

Bonus

  1. Allow the user to create sub-task for an existing task. Do this by amending the create function to take in a parent task Id.

    todo.exe task -t Sub Task -d 2018-04-02 -p 1
  2. Amend the task list output to list all sub-task under the parent task

    • If no children task exists do NOT show the > Child Task < header

    • Example output when task exist

      Id: 2
      Task: Thing #2
      Due: 2018-04-01 > Child Task <
      
      Id: 1
      Task: Thing #1
      Due: 2018-04-02
  3. Amend the complete task function to print an error if the user tries to mark the parent task as complete without all children task being marked as complete already.

Reference Walkthrough

Reference implementations in C#, TypeScript, and Python live at tddbuddy-reference-katas/todo-list. This is an F2 (light builder) kata: one aggregate (TodoList), one value type (Task), one domain exception (TaskNotFound), and one small test-folder TaskBuilder (10–30 lines). Ids are monotonic and never reused after removal.

Scope note — in-memory list only. The reference is scoped to the in-memory aggregate with add, markDone, remove, tasks(), pending(), and completed(). CSV persistence, CLI argument parsing, sub-tasks with parent ids, nested listing with the > Child Task < header, and the parent-completion guard are all out of scope for this reference and listed as stretch goals in the repo README. Those responsibilities introduce collaborators (file I/O, arg parser) or richer domain (task tree, recursion) — which is F3 territory, not F2.

C# rename note. The entity is named TodoTask (not Task) to avoid collision with System.Threading.Tasks.Task, and the aggregate is named TaskList (not TodoList) to avoid clashing with the TodoList namespace. Ubiquitous language stays “Task” and “TodoList” — only the C# type names shift.

This kata ships in Agent Full-Bake mode at middle gear, the F2 (light builder) tier. See the repo’s Gears section for why middle gear is the deliberate choice.