Skip to content

Instantly share code, notes, and snippets.

@cap10morgan
Last active February 16, 2017 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cap10morgan/d98c260159bc386b5d56 to your computer and use it in GitHub Desktop.
Save cap10morgan/d98c260159bc386b5d56 to your computer and use it in GitHub Desktop.
Clojure dev candidate exercise

TODO List

NOTE: This is version 1 of the exercise. We used it for the first 2 rounds of dev hiring in which we had an anonymous coding exercise at all. There is now a version 2 developed in collaboration with staff developers who were subjected to this one as candidates. They had... opinions.

This assignment is designed to gauge how well you know or can pick up Clojure and some common libraries to build a simple web application.

You should spend no more than a week on it. In fact, it is due one week after it is assigned. You should also focus on depth rather than breadth. Do as much good work as you can on each step rather than trying to do a little work on more steps.

Since we want to evaluate all of these projects anonymously, you should not include any identifying data in the code (your name, city, email address, phone number, school, etc.). We will also not be able to give feedback on it until the recruitment process is over.

However, you may ask questions of the Democracy Works employee that you received the assignment from (and them only since the others will be evaluating all of the exercises and should know as little as possible about which project belongs to you).

Assignment

For this project, you should implement as much of the following as you can in one week:

  1. Start a new Clojure project using the leiningen build tool.
  2. Pull in an HTTP library (ring is a common choice) and add a / HTTP endpoint that serves a headline and a nice "under construction" animated GIF. We love animated GIFs.
  3. Add an /about HTTP endpoint that gives a brief description of the project.
  4. Use a database of your choice to store TODO items (don't try to support multiple TODO lists yet).
    1. For the choice of database, SQLite and PostgreSQL are 2 common options. We use Datomic and welcome submissions using that, but it has a steep learning curve if you are new to it.
    2. Each TODO item should keep track of its text and its doneness state (for now either :todo or :done).
  5. Make the TODO items stored in the database show up on the / page in place of the "under construction" GIF you started with.
    1. Use the Hiccup library to render the HTML.
    2. Add some dummy data to the database with at least 2 items in each doneness state.
    3. Do not worry about making the items editable (even to mark them as :done) yet. We'll tackle that next.
  6. Add a form to the / page for adding new TODO items to the list.
    1. The form should accept the text of the item, and when submitted, put it at the bottom of the list in :todo state.
  7. Add a button next to each TODO item to "complete" it (mark it as :done).
    1. Change the button to "undo" marking it as complete when clicked and make it put that item back to :todo if clicked.
    2. Make an item in :done state have its text struckthrough like this.
  8. Add a button next to each TODO item to delete it.
  9. Modify the app to support multiple TODO lists (each with a name and their own set of TODO items).
  10. From here you should get creative. Some ideas:
    1. Make it update in realtime across different browsers showing the same TODO lists.
    2. Add user account support with data segration across accounts (i.e. when logged in I should only see my TODO lists).
    3. Replace the server-rendered UI with a ClojureScript-based client-side UI (use your favorite React wrapper library; Om, Om.next, Reagent, etc.).

You should:

  1. Use git for version control (we'll want the entire git repo submitted).
  2. Make a commit that runs for each step above so we can see your progress as you built the project.
    1. Name these commits "Complete step 1", "Complete step 2", etc. so we can tell which they are.
    2. Feel free to commit as often as you like besides that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment