π It's super easy to forget so aim to practice once per week!
This is the killer. If I step away from programming for a few weeks, you really feel the rust gathering. This repository is a testing ground for all things Elm, and it's a year-long learning curve to get building.
There's plenty of javascript guides out there, so here the focus is on a statically typed functional style that turns you into a good programmer. For a study aid, you can use Anki flashcards and these handy guides to get you started. It's great for revision, but no substitute for building things.
Elm is great for learning how to engineer.
Start with How To Design Programs and follow that up with Elm. It's better designed, more consistent, with better compiler error messages than Python.
After these two languages you'll have a decent grounding in Computer Science theory, and they're not too academic. I'm rubbish at maths, and am mostly focused on rapid prototyping, so I like to avoid deep academic learning. An artist ships!
My goals are not the same as yours; have a clear vision! This can change as you go. β [#! Here would be a great place for a book!]
Here are my goals:
- Prototyping a business model
- Write as little code as possible1
- Teaching beginners
If I were to start over and learn again, I would:
- Start with HTDP and then Elm
- Learn only a subset of CompSci2 (first two chapters of HTDP, for example)
- Learn the best practices for
http
servers,json
andREST
APIs - Learn how to use Ai as a teacher, or for pair-programming
- Learn from a mentor (good habits and what not to do)
- Learn how to frame and structure your learning (fail fast, just build!)
# Initialise an Elm project
elm init
# Install a package
elm install elm/<package>
# Make a HTML file from an Elm one
elm make src/Main.elm
# Compile to javascript file
elm make src/Main.elm --output=app.js
# View in the browser
elm reactor
Why do we need types? It's best illustrated by the old joke ...
A programmer's wife told him "Go to the store and buy milk and if they have eggs, get a dozen." He came back a while later with 12 cartons of milk!
This is where Elm really shines, everything is easy to install and just works! Unlike Python, where there's many ways to manage packages, the error messages are cryptic, and so on.
- Here's how packages are documented
- Elm package design guidelines
I'm lazy, and rarely test, but it's good practice to.
This mindset will land you in trouble if you're using Python, or a language that doesn't have strict typing. It's always wise to test your functions somehow, as typing only gets you so far. For example, I use Bruno when testing my APIs, but I don't write unit tests. Remember, Elm only checks for data types; it won't make sure your inputs and outputs are what you'd expect.
My goal is prototyping, so I'm a little lax, but for large programs with bigger teams, a lot can go wrong without tests! Always check your programs as your visitors would use them.
See your offline books in
Library/code/elm
!
- Official Elm guide
- Elm syntax (quick overview of syntax)
- Learn you an Elm (based on Haskell book)
- Beginning Elm
- Welcome to Elm (nice walkthrough)
- Richard Feldman's intro and advanced Elm
- Exercism's Elm track
- 7 GUIs for practice
- Elm Workshop (e.g: stopwatch)
- Life of a file
- Teaching Elm to beginners
- Scaling Elm apps
- Making impossible states impossible3
- Make data structures
- From Rails to Elm and Haskell
- Elm in Action
- Learn you an Elm
- Learn Elm (Elm Craft)
- Minification
- Hot reload or
elm-watch
/elm-live
- Elm Doc Preview (great for offline documentation)
- Elm land (or the older elm-spa
- Everything else (massive list)
- Elm community FAQs
- Why large records are OK
- Why do I have to use Json decoders?
- What, exactly, is a
Msg
for? (no state please!) - Avoiding import cycles and normalising records
- Andy Balaam's Elm examples
- Built with Elm
- Elm Patterns (Might be a little outdated)
- Fuzz tests in Elm4
- Sorting comparables (record)
Footnotes
-
Meaning efficient with my time, not lazy (ok, a little lazy). A simple route with less code and complexity? I'll take it. Take this carousel in Elm, for example. Want to be a great programmer? Go ahead, take your time! Prefer the easy route? Use
scroll-snap
with CSS. It all depends on your vision: I'd rather have more time to pursue other things, keep things simple. β© -
A lot of programming books can be highly academic, and although books like these can be very thorough (and suit some learning styles), for me that was the wrong approach. For example, learning how to code recursively can be intellectually stimulating and it teaches you a lot, but after a certain point, it provides diminishing returns. It's hard to know exactly what you need to learn, but if your goal is to build things, aim for industry knowledge and pragmatic goals, rather than academic ones. Learn the basics well and start building things. You'll learn a lot along the way (with help from mentors), and you can do the heavier academic texts later if you enjoy that kind of thing! β©
-
All (or most) of Richard Feldmans talks β©
-
I'm lazy, and not a proper programmer, so I rarely write unit tests. This isn't the correct way, but Elm types give you quite a lot of guarantees, and I test the program as a regular user (or QA) might do. If any bugs arise, a visitor can raise a ticket and tests can be written. β©
-
There's an alternative by Dwayne called Elm Conduit β©