Originally published at programming-elm.com.
After 2 years, 2 months, and 29 days of waking early, sacrificing weekends, and rewriting for Elm 0.19, I can proudly say that Programming Elm is now available in print! Writing this book presented a challenging, but rewarding journey that taught me a ton about writing and teaching.
More and more front-end developers are choosing Elm to build applications for benefits such as:
- No runtime exceptions in practice: Elm's compiler catches problems early to prevent exceptions at runtime for your users.
undefinederrors: Elm offers more versatile types for representing
null. The compiler also ensures you handle all possible nulls in your application.
- Predictable code: All Elm code is free from side effects, so you can trust your functions to always produce the same result based on their arguments.
- Immutable data types: You don't have to worry about your code or third-party code changing data unexpectedly and causing bugs. Your data will be consistent and safe.
- Strong static types: Elm's compiler uses static types to ensure you call functions with the right types of arguments. You won't run into subtle type-coercion bugs.
- Custom types: Elm's custom types let you create entirely new types for clearly modeling your business domain. Powerful pattern matching prevents undefined situations by ensuring you handle your custom types consistently.
Advanced tools: Elm's
Debugmodule makes it easy to inspect data to catch bugs, and add placeholders to your code until you're ready to implement it. Third-party tools such as create-elm-app let you quickly bootstrap Elm applications and offer powerful development servers for immediate development feedback.
The first five chapters of this book focus on how to build applications. You will create a photo sharing application called Picshare and add new functionality in each chapter.
Chapter 1 introduces you to Elm, explains some of the basics of functional programming, and lets you create a basic Picshare application.
Chapter 2 explains Elm's framework for building applications, the Elm Architecture. You'll use the Elm Architecture to manage state and events in the Picshare application.
Chapter 3 expands on the Picshare application. You'll learn patterns for refactoring code and how to add new features to the Picshare application.
Chapter 4 lets you create a more realistic Picshare application. Front-end applications typically need to communicate with servers to be useful. You'll learn how to call APIs and safely decode JSON into static types.
Chapter 5 takes Picshare's interactivity further. You'll use Elm subscriptions with WebSockets to receive updates in real time.
The next six chapters focus on advanced patterns for scaling, debugging,
integrating, and maintaining Elm applications.
Chapter 6 addresses the problem of scaling complex applications containing lots of code. You'll use patterns such as reusable helper functions, extensible records, and message wrappers to refactor an application into a more maintainable state.
Chapter 7 introduces Elm's tooling. Although Elm's compiler prevents tons of bugs through static types, bugs can still occur from logic errors. You'll use Elm's
Debug module to debug values at runtime. You'll also bundle and deploy an application with powerful third-party tools.
Chapter 9 introduces testing to ensure your code is correct. You'll use elm-test to create a module with test-driven development, test properties of your code with fuzz testing, and test an Elm application with elm-html-test.
Chapter 10 teaches you how to build modern single-page applications with Elm. You'll learn how to handle routes and coordinate different page components.
Chapter 11 concludes with speeding up your code. You'll learn about common performance issues, how to measure performance, and how to optimize applications with efficient algorithms, lazy design patterns, and the
So, what are you waiting for? Say goodbye to runtime exceptions and unmaintainable code. Learn how to build safe and maintainable front-end applications. Grab a copy of Programming Elm from The Pragmatic Programmers today.