Skip to content

Instantly share code, notes, and snippets.

@DavidGinzberg
Created December 21, 2016 21:09
Show Gist options
  • Save DavidGinzberg/358a88ed2425c22d26186662046158c9 to your computer and use it in GitHub Desktop.
Save DavidGinzberg/358a88ed2425c22d26186662046158c9 to your computer and use it in GitHub Desktop.
ToDo Bootcamp - A series of exercises around building a mundane todo list application from the underground up.

ToDo Bootcamp Week 1

Basic CLI Todo List

Description

Let's create a todo list. this first exercise is for when you have just started learning a language and will start out super simple. The whole "application" will be entirely text-based and run on a command line -- no fancy GUIs or databases here.

Part 1

Print the list

Instructions

Write a program that prints out youre to-do list. For this first list you can program the list right in and the program doesn't need any conditional logic or anything. You should just be printing out text. If you're not sure where to start, open up an old Hello World program in your language of choice and modify that.

Variations

We'll get to these later. Variations are changes or alternate goals to help you practice the content of a particular lesson or step.

Part 2

Print each list item

Instructions

You probably printed everything in one big print statement, like this example from Python:

print "Wash the cat. Feed the milk. Buy a fresh carton of car."

That's fine, but later on we're going to want to separate each to-do list item, so let's start moving in that direction. Adjust your program from Part 1 so that each item is in its own print statement. It's fine if your list items print out all on the same line, or each on their own line -- see if you can do both if you want to learn a little more about formatting text.

Varitions

Part 3

Instructions

Create a printTask function that takes each task as an argument and prints it out.

Variations

  • Instead of passing each task one at a time, you can refactor your function to take an array of tasks and print all of them. This requires knowledge of looping logic.

Part 4

Print the status of each task

Instructions

Let's change that function a little bit. Refactor it to take two argments -- the task to print (as a string) and a boolean (true/false) defining whether the task is done. Adjust the output of your function to print the status of each task next to the task.

Variations

Part 5

Tasks as objects

Instructions

The string defining a task and the boolean defining its status are logically related, so let's embody that relationship in our code. Create an object type (or a class or a struct, depending on your language) that represents a task. Define the two fields a task has (eg: name and doneStatus) and use this in place of the strings and booleans you were passing to your function. You will need to refactor the function to take a Task object and use its fields, and change your code to create Task objects for each task.

Variation

You could add other fields to Tasks, such as a more detailed description, and due date or completion date. Try adding one or more of these and changing your printTask function to show the relevant information as well. Be careful not to print the completion date of incomplete tasks. Try printing overdue tasks in all capital letters.

ToDo Bootcamp Week 2

Interactive CLI Todo List with objects

Part 1

Take user input to add tasks

Part 2

Let users mark tasks complete

Part 3

User can select which tasks to print (complete or incomplete)

Part 4

Sort tasks by status, name, date

Part 5

Cleanup -- make it modular, function-based, and ready to use in larger applications (that aren't necessarily CLI based)

Part 6

TESTS!!!

@DavidGinzberg
Copy link
Author

Once week 2 is fleshed out the next steps are:

  • Add flat file persistence exercises
  • Add conversion to existing persistence frameworks (maybe one SQL and one noSQL)
  • Add front end exercises (GUI, REST, Curses?) - need more planning here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment