I want to build for the web, why? Because that way you reach the most people the easiest & cheapest way. Building for native does not allow you to reach people that easily because:
- It takes longer to build the app because you need to build for different platforms. Therefor it's more expensive.
- People have to find your app in the platform specific app store.
- We don't need the possible performance benefits that native applications have to offer. At least not most of the time. Ofcourse native applications still have a target audience. But it's shrinking. (Progressive Web Apps!)
When building for the web, you have 3 basic architectures.
- dynamic websites: server rendered pages, with the application logic on the server and having a page refresh between each action
- single page application: client rendered pages, the application logic lives on the client, no page refreshes, feels like an application
- combination of the others: ideally the first page request will be answered with a server rendered page to immediately give the user a working app. Subsequent actions are handled on the client side by a SPA
The first page request being server rendered becomes less of a requirement, when you consider that you can have a SPA with PWA technologies. Say we pick the PWA architecture with a SPA. This means building in JavaScript, because JS is the only language we have on the web.
Elm is a functional language that compiles to JS. The Elm Architecture helps with structuring you application. With WebAssembly on the rise, soon any language can run in the browser.
Working in Elm requires a lot less discipline than working in JavaScript. Simple because of the tooling that comes with JavaScript, developing in JS can be quite exhausting.
Functional Programming is the way to go. But JS is not a strictly FP language. So it is up to the developer so maintain that strictness. This requires extra responsibility, extra attention, extra discipline. And that is something we should avoid. Since all the discipline should be saved for the real coding problenms. Not for the stuff a compiler can check for you.