I wrote a version of TodoMVC (sans styling) in an incremental manner that may help others learn how to approach building applications with Elm.
You can find the source code for the app, here.
It was done in roughly 10 steps. Here’s what I wanted to accomplish per step:
- To display “Hello, Elm!” in a browser.
- To be able to type the description of a task into a text field and have the description appear in the browser’s console when entered.
- To show the entered descriptions in a list, ordered from least recent to most recent.
- To be able to mark entries as completed.
- To be able to remove an entry.
- To add a variety of useful features.
- To be able to view a subset of the entries (all, active or completed).
- To be able to keep the visibility filter in sync with the URL in the address bar.
- To be able to edit existing entries.
- To be able to sync to local storage.
The completion point of each step was tagged step-<n>
in the repo. So for e.g. if you wanted to see what was done to get from step 5 to step 6 then you could use git log step-5...step-6
to see the commits.
Tutorial
In addition to the code I’m writing up a tutorial for it as well. The latest version of it can be found here. I still have step 9 and 10 to complete.
Suggestions
I welcome all feedback.
Also, if you have suggestions for other applications you’d like to see built in a similar way then let me know.
I’m particularly interested in doing a 2048 clone next. What do you think?