<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ ELM - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ ELM - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 30 May 2026 22:26:20 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/elm/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to use Netlify Functions in Elm ]]>
                </title>
                <description>
                    <![CDATA[ This worked example creates a simple Netlify Function and integrates it with an Elm application. Netlify functions provide a very convenient way of working with AWS Lambdas, and they have an impressive array of example use cases, such as sending emai... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-use-netlify-functions-in-elm/</link>
                <guid isPermaLink="false">66bb926adeef71ff683a6d46</guid>
                
                    <category>
                        <![CDATA[ create-elm-app ]]>
                    </category>
                
                    <category>
                        <![CDATA[ netlify-functions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ aws lambda ]]>
                    </category>
                
                    <category>
                        <![CDATA[ ELM ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Netlify ]]>
                    </category>
                
                    <category>
                        <![CDATA[ serverless ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Cedd Burge ]]>
                </dc:creator>
                <pubDate>Wed, 28 Aug 2019 07:37:39 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/08/netlify-functions-elm.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>This worked example creates a simple <a target="_blank" href="https://functions.netlify.com/">Netlify Function</a> and integrates it with an Elm application.</p>
<p>Netlify functions provide a very convenient way of working with AWS Lambdas, and they have an <a target="_blank" href="https://functions.netlify.com/examples">impressive array of example use cases</a>, such as sending emails, processing payments and logging.</p>
<p>This example reads secrets from environment variables (to avoid them being exposed in the browser), but it is mostly generic, and can be adapted for other use cases easily.</p>
<h2 id="heading-step-1-prerequisites">Step 1 - Prerequisites</h2>
<ul>
<li>Create a repository for the code, probably on GitHub</li>
<li><code>npm i -g elm</code></li>
<li><code>npm install -g netlify-cli</code></li>
<li><code>npm i -g create-elm-app</code></li>
</ul>
<h2 id="heading-step-2-create-vanilla-elm-app">Step 2 - Create vanilla Elm app</h2>
<ul>
<li><code>create-elm-app elm-app-with-netlify-function</code></li>
<li><code>cd elm-app-with-netlify-function</code></li>
<li><code>elm-app start</code></li>
</ul>
<p>This should start a development server and load the app in your browser.</p>
<p>You can look at <a target="_blank" href="https://github.com/ceddlyburge/netlify-functions-with-elm/commit/d976b2391f98f07113d1e41a64b0359caddf3452">this commit in the companion repository</a> to check that everything is ok.</p>
<h2 id="heading-step-2-deploy-on-netlify">Step 2 - Deploy on Netlify</h2>
<ul>
<li><code>npm init</code> (and fill in sensible values)</li>
<li><code>npm i create-elm-app --save-dev</code> (this adds create-elm-app to package.json, which is used by netlify)</li>
<li>Push the code to GitHub</li>
</ul>
<p>You can see the results of this at <a target="_blank" href="https://github.com/ceddlyburge/netlify-functions-with-elm/commit/aa52ccfabacae69591a920f0675eedf620ae8b03">this commit in the companion repository</a></p>
<ul>
<li>Log in / Sign up / register with <a target="_blank" href="https://www.netlify.com/">Netlify</a></li>
<li>Create a <a target="_blank" href="https://app.netlify.com/start">new site</a> on Netlify</li>
<li>Choose your repository</li>
<li>Set the "Build command" to <code>elm-app build</code></li>
<li>Set the "Public directory" to <code>build</code></li>
<li>Click on "Deploy Site"</li>
</ul>
<p>Netlify will now deploy the site, installing the dependencies specified in package.json, then running <code>elm-app build</code> and then serving the dist directory.</p>
<p>From now on, Netlify will attempt to deploy the latest code every time you push to GitHub.</p>
<h2 id="heading-step-3-link-netlify-dev">Step 3 - Link Netlify Dev</h2>
<ul>
<li><code>netlify login</code></li>
<li><code>netlify link</code> and choose the “Use current git remote url” option</li>
<li>Add “./netlify” to .gitignore</li>
<li>Add a netlify.toml file (from <a target="_blank" href="https://github.com/ceddlyburge/netlify-functions-with-elm/commit/6514012000ea82fb6625fa3686adafa321723d28">this commit in the companion repository</a>)</li>
<li><code>netlify dev</code></li>
</ul>
<p>This should start a local development server and load the app in your browser, in a similar way to step 1.</p>
<h2 id="heading-step-4-add-a-netlify-function">Step 4 - Add a netlify function</h2>
<p>Run <code>netlify functions:create</code> to create a new netlify function. Choose the “js-token-hider” template, and name it "call-api".</p>
<p>This will create a javascript file for the function, and a package.json for its dependencies in “functions/call-api”.</p>
<p>Replace functions/call-api/call-api.js with this one in <a target="_blank" href="https://github.com/ceddlyburge/netlify-functions-with-elm/commit/79381b9c1a7731b01f0c81b58a772d9576f76732">the companion repository</a></p>
<p>Now if you run <code>netlify dev</code>,  the function will be served as well as the app, albeit on different  ports. You can view the function in the browser to check that it is  working (probably at <a target="_blank" href="http://localhost:34567/call-api">http://localhost:34567/call-api</a> or <a target="_blank" href="http://localhost:34567/.netlify/functions/call-api">http://localhost:34567/.netlify/functions/call-api</a>)</p>
<h2 id="heading-step-5-call-the-netlify-function-from-elm">Step 5 - Call the netlify function from Elm</h2>
<p>Install depdencies</p>
<ul>
<li><code>elm install elm/json</code></li>
<li><code>elm install elm/http</code></li>
<li><code>elm install krisajenkins/remotedata</code></li>
</ul>
<p>Update Main.elm to call the function and display the results (from <a target="_blank" href="https://github.com/ceddlyburge/netlify-functions-with-elm/commit/4dc9e8e4b60d061b5d5ef0fb2ce6ab856741236f">the companion repository</a>).</p>
<p>Instruct create-elm-app to proxy api calls to the function, by adding elmapp.config.js, as shown in <a target="_blank" href="https://github.com/ceddlyburge/netlify-functions-with-elm/commit/90a63178e38f2919770e37fcc94e7ee0bec343ab">the companion repository</a>.</p>
<p>At  this point, thee application runs, and successfully calls the api, but  there are no secrets / environment variables yet, so the UI shows an error.</p>
<h2 id="heading-step-6-add-the-secrets">Step 6 - Add the secrets</h2>
<p>Go  to the “Site Settings” - “Build &amp; Deploy” - “Continuous Deployment”  - “Environment Variables” section on the Netlify website for your application.</p>
<p>Add environment variables for API_TOKEN and API_URL</p>
<p>Now when you run ‘netlify dev’ the app should now load in the browser and call the locally hosted netlify function, which will return the API_TOKEN and API_URL environment variables that you set on Netlify.</p>
<p>The  same should be true on the live deployment on Netlify. You may need to  “Trigger Deploy” manually on Netlify, so that it uses the new environment variables.</p>
<p>You can see the deployment of the companion repository at <a target="_blank" href="https://netlify-functions-with-elm.netlify.com">https://netlify-functions-with-elm.netlify.com</a></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Netlify  / serverless functions are extremely useful for creating / connecting to the backend services that your front end needs. They are also very east to set up, as this artcile (hopefully!) shows.</p>
<p>Create-elm-app is a great tool for developing Elm applications, and its simple proxy feature works well when developing Netlify functions.</p>
<p>Netlify Dev is great for replicating the production Netlify setup when developing locally (in this case by automatically providing the environment variables).</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Scale Elm Views with Master View Types ]]>
                </title>
                <description>
                    <![CDATA[ A concept to help Elm Views scale as applications grow larger and more complicated. In Elm, there are a lot of great ways to scale the Model, and update, but there is more controversy around scaling the view. A lot of the debate is around Reusable Vi... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/scaling-elm-views-with-master-view-types/</link>
                <guid isPermaLink="false">66bb9271deef71ff683a6d48</guid>
                
                    <category>
                        <![CDATA[ ELM ]]>
                    </category>
                
                    <category>
                        <![CDATA[ scaling ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Cedd Burge ]]>
                </dc:creator>
                <pubDate>Thu, 18 Jul 2019 07:29:29 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2019/07/2014-Haute-Route-Imperiale51.JPG" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>A concept to help Elm Views scale as applications grow larger and more complicated.</p>
<p>In Elm, there are a lot of great ways to scale the <code>Model</code>, and <code>update</code>, but there is more controversy around scaling the <code>view</code>. A lot of the debate is around <a target="_blank" href="https://gist.github.com/rofrol/fd46e9570728193fddcc234094a0bd99#reusable-views-instead-of-nested-components">Reusable Views versus Components</a>. Components are not recommended, but a lot of people are still advocating for them.  This article presents an idea that hopefully strengthens the argument for Resuable Views.</p>
<p>In almost all cases, the scaling problem comes down to enforcing consistency, which usually means allowing child views to make some adjustments to the master view, while at the same time not allowing child views to make a mess.</p>
<p>I will be using Richard Feldman's excellent <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example">Real World app</a> (specifically written to demonstrate scaling in Elm) as an example, as it is contains a lot of current best practice techniques, it is well known (2000+ stars and 300+ forks) and Richard is a well known Elm expert. </p>
<p>I will be suggesting some improvements to this code, so I want make a clear at this point that I mean no disrespect by this (I would bet large sums of money that he did it in about one tenth of the time it would have taken me!). You could also argue that the problems are small and not worth fixing. Ultimately, this decision is yours, but by the end of the article I hope to persuade you that there are problems, and that they are fixable if you think it is worthwhile.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2019/07/ski-touring.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-master-view-functions-with-conditionals">Master view functions with conditionals</h2>
<p>One option is to define a master view function. This function takes care of shared concerns, like the header bar and overall layout. Then it calls child view functions depending on the current view and / or has parameters to control child specific behaviour.</p>
<p>This works, but can quickly lead to:</p>
<ul>
<li>An explosion of parameters, potentially forcing your child views to return a lot of things they don't care about.</li>
<li>A mixing of responsibilities between master and child views.</li>
<li>Extra code and duplication.</li>
</ul>
<p>In the Real World App, a parameter of type <code>Page</code> is passed to the master view so that it can render a navbar link as active. There is a <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example/blob/b5064c6ef0fde3395a7299f238acf68f93e71d03/src/Page.elm#L113">large case statement</a> that uses this parameter to work out what which link is active, and it would be a lot easier for the child just to specify this.</p>
<p>The <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example/blob/b5064c6ef0fde3395a7299f238acf68f93e71d03/src/Main.elm#L85">line below</a> shows the master view passing <code>Page.Home</code>, which has to match up with <code>Home.view home</code>. This is easy to get wrong, there is no help from the compiler or type system, and really it is the responsibility of the child view the specify this.</p>
<p><code>viewPage Page.Home GotHomeMsg (Home.view home)</code></p>
<p>There is some duplication when <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example/blob/b5064c6ef0fde3395a7299f238acf68f93e71d03/src/Page.elm#L62">creating the NavBarLink Html</a>, and the <code>linkTo</code> function will accept any Html, although only very particular Html is valid.</p>
<h2 id="heading-convention-and-trust">Convention and trust</h2>
<p>Another possibility is for child views to be responsible for keeping shared elements consistent, by convention and trust. </p>
<p>Arguably this also happens in the Real World App. The <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example/blob/b5064c6ef0fde3395a7299f238acf68f93e71d03/src/Page/Home.elm#L146">Home</a>, <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example/blob/b5064c6ef0fde3395a7299f238acf68f93e71d03/src/Page/Article.elm#L119">Article</a> and <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example/blob/b5064c6ef0fde3395a7299f238acf68f93e71d03/src/Page/Profile.elm#L197">Profile</a> views all have the concept of a banner. The banner is different in each view, but presumably is meant to be a consistent and recognisable visual element (essentially, it's the title / header for the view). The views don't share any code for these banners, and as a result of this they are not the same size or colour. You could theoretically try and enforce a convention using tests, but it would be difficult, and probably not worthwhile.</p>
<h2 id="heading-helper-functions">Helper functions</h2>
<p>Another possibility is for child views to be responsible for keeping shared elements consistent, but by using some helper functions. This is definitely a step forward, and is probably the most common solution I see in the wild. The functions can go in the same file and be next to each other. This makes it easier to see that they are related and are representing the same visual element, and easier to make them consistent. </p>
<p>However, there are still some drawbacks. The main one is that the child views have to know to use the helper functions, and there is nothing enforcing this. This isn't a huge deal when you only have one shared element and one function to call, but as applications get bigger, you end up with a combinatorial explosion of differences in the shared visual elements. Most people tame this by providing a number of small, focused functions for the various differences. Then the child view has to know about all these functions, and how to compose them, and there no help from the compiler. </p>
<p>Again, this arguably occurs in the Real World App: for example in <a target="_blank" href="https://github.com/rtfeldman/elm-spa-example/blob/b5064c6ef0fde3395a7299f238acf68f93e71d03/src/Page/Profile.elm#L211">this part of the Profile.view function</a>, which needs to know how to use the <code>viewTabs</code>, <code>Feed.viewArticles</code> and <code>Feed.viewPagination</code> helper functions, and what Html they need to be contained in.</p>
<h2 id="heading-scaling-with-master-view-types">Scaling with Master View Types</h2>
<p>In order to overcome these problems, I propose using a <code>Type</code> to define your site structure (I rather pompously call this a "Master View Type"). Child views then return this type, and the master view takes it as a parameter and returns the html. </p>
<p>For the Real World App examples we have been looking at, the Master View Type is below (<code>Viewer</code> is the person viewing the page in the Real World App). You could arguably have more general banner types here, such as AvatarBanner, or even IconBanner (instead of ViewerBanner) depending on your domain.</p>
<pre><code class="lang-elm"><span class="hljs-keyword">type</span> <span class="hljs-keyword">alias</span> <span class="hljs-type">Page</span> =
    {   activeNavBarLink: <span class="hljs-type">NavBarLink</span>
        , banner: <span class="hljs-type">Banner</span>
        , body: <span class="hljs-type">Html</span> <span class="hljs-type">Msg</span>
    }

<span class="hljs-keyword">type</span> <span class="hljs-type">Banner</span> =
    <span class="hljs-type">TextBanner</span> <span class="hljs-type">TextBannerProperties</span>
    | <span class="hljs-type">ViewerBanner</span> <span class="hljs-type">Viewer</span>
    | <span class="hljs-type">ArticleBanner</span> <span class="hljs-type">Viewer</span> <span class="hljs-type">ArticlePreview</span>

<span class="hljs-keyword">type</span> <span class="hljs-type">NavBarLink</span> =
    <span class="hljs-type">NavBarLink</span> <span class="hljs-type">NavBarLinkProperties</span>
</code></pre>
<p>To demonstrate this, I have create a repository with just the <a target="_blank" href="https://github.com/ceddlyburge/elm-without-master-view-types">Header and Banner parts of the Real World App</a>  and then created a new repository after refactoring to use a  <a target="_blank" href="https://github.com/ceddlyburge/elm-master-view-types/blob/master/src/Page.elm">Master Page Type</a>, <a target="_blank" href="https://github.com/ceddlyburge/elm-master-view-types/blob/master/src/NavBarLink.elm">NavBarLink Type</a> and <a target="_blank" href="https://github.com/ceddlyburge/elm-master-view-types/blob/master/src/Banner.elm">Banner Type</a>. You can peruse the code to get a feel for how it works.</p>
<p>To my mind, using a Master Page Type has the following benefits:</p>
<ul>
<li>Writing the master view code is easier</li>
<li>Writing the child view code is easier</li>
<li>Communication and understanding are improved, as UI concepts now have names</li>
<li>Theming / redesigning a site is a lot easier</li>
<li>Elm packages can provide UI templates</li>
</ul>
<p>The master view can precisely define what it will accept / support via the types, with <a target="_blank" href="https://guide.elm-lang.org/types/custom_types.html">union types</a> and <a target="_blank" href="https://medium.com/@ckoster22/advanced-types-in-elm-opaque-types-ec5ec3b84ed2">opaque types</a>. Non supported combinations can be made unrepresentable or uncreatable. </p>
<p>In my example repository the <a target="_blank" href="https://github.com/ceddlyburge/elm-master-view-types/blob/master/src/NavBarLink.elm">NavBarLink type is opaque</a>, so it is only possible to create supported NavBarLinks (<code>home</code>, <code>article</code> and <code>viewer</code>). In a similar way <a target="_blank" href="https://github.com/ceddlyburge/elm-master-view-types/blob/master/src/Banner.elm">Banner is a union type</a>, which means that only supported variants can be represented. </p>
<p>It would be possible for a programmer to simply change these files, but a proficient programmer would recognise the patterns and follow them. If this isn't enough and you are feeling paranoid, then you can require stricter code review on such files, potentially taking advantage of <a target="_blank" href="https://help.github.com/en/articles/about-code-owners">CODEOWNERS</a> functionality on GitHub and GitLab. In the extreme you can  provide the modules via an elm package, and restrict push access to the underlying repository.</p>
<p>Child views don't have to do anything more than create an instance of the types. The helper functions all return types, so it's easy to see which functions can be used in a particular context, and is impossible to use functions in the wrong context. For example, if a function returns a <code>HeaderBarLink</code>, it is impossible to mistakenly use this function to create a link in the <code>FooterBar</code>, or elsewhere on the page. Child views can also leave some of the complexity to the master view. For example, the child view can define a list of options to choose from, and the master view can render this using buttons, a drop down list or an autocomplete list, depending on the number of options. </p>
<p>The master page type also provides names for UI concepts, which can then be discussed. For example, a designer could say "Let's move the NavBarLinks to the left hand side", and everybody would know what they meant. A product owner could say "Let's create a new page with an IconBanner, and we'll use the current weather api for the icon" and again, everybody would know what they mean. You can look at this <a target="_blank" href="https://www.thoughtworks.com/insights/blog/ui-components-design">excellent thoughtworks article</a> for more details of this.</p>
<p>Since the responsibility for turning the Master View Type in to html is all in the same place, it is easy to make drastic changes to the look and feel of a website, and to do theming. These changes and themes can alter the Css <em>and the Html</em>, which is something that the normal theming techniques just can't do. Pragmatically, your Master View Type will often have a <code>body: Html Msg</code> property (to allow child views complete flexibility on the child specific parts of the page) so there would still be some sprawling code to fix up, but it will definitely be a lot easier.</p>
<p>Finally, it opens up possibility of providing ready made themes and site layouts as packages. This would allow you to just do the following to get a working app, complete with layout and styling:</p>
<ul>
<li><code>create-elm-app</code></li>
<li><code>elm install elm-bootstrap-starter-template</code></li>
<li>Write some code to create the Master Page Type</li>
<li><code>elm-app start</code></li>
</ul>
<p>Companies could create packages like these to ensure a consistent look and feel across their applications. Open source designs and layouts could emerge and become commonplace, similar to the way that Bootstrap has revolutionised html and css design. Developers with limited design skills (like me) could concentrate on the the bits they are best at (the logic), but still produce produce elegant websites using these packages.</p>
<p>To demonstrate this I have created a <a target="_blank" href="https://package.elm-lang.org/packages/ceddlyburge/elm-bootstrap-starter-master-view/latest/">bootstrap starter master view package</a>. It mimics the layout and design of the <a target="_blank" href="https://getbootstrap.com/docs/4.0/examples/starter-template/">bootstrap starter template</a>. I have then used this package in a demo elm application. You can <a target="_blank" href="https://elm-bootstrap-starter.netlify.com/">browse the demo application</a> to see how it looks, and <a target="_blank" href="https://github.com/ceddlyburge/elm-bootstrap-starter-demo">view the source</a> to see how it works.</p>
<p>All these advantages come at a small to negative cost. There is a little more code for the new types, but some duplication is removed. You can view the source of the Real World App repositories <a target="_blank" href="https://github.com/ceddlyburge/elm-without-master-view-types">from before</a> and <a target="_blank" href="https://github.com/ceddlyburge/elm-master-view-types">after refactoring to use a Master Page Type</a> for the full details.</p>
<h2 id="heading-conclusions">Conclusions</h2>
<p>Master View Types bring a lot of benefits (view code is easier to write and maintain, UI concepts are named and UI packages are possible) for little or no cost. They should improve the code of any Elm application that has issues around enforcing consistency (while allowing flexibility) in their view code, which in my experience is most medium and large applications.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Web is ready for you, Elm ]]>
                </title>
                <description>
                    <![CDATA[ By Birowsky Tears of joy from a developer who got to build a PWA Growing up, being movie director was what my werewolf teeth were made for. Who knew that this front-end thing was gonna consume me like this. But it’s all good because creating art tha... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/web-is-ready-for-you-on-line-elm-d3aa14dbf95/</link>
                <guid isPermaLink="false">66c364fc0002df282f2225ba</guid>
                
                    <category>
                        <![CDATA[ ELM ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Productivity ]]>
                    </category>
                
                    <category>
                        <![CDATA[ progressive web app ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Web Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 07 Jun 2017 11:49:04 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*QdfzoCfX6qTBGzZXR7AdnQ.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Birowsky</p>
<h4 id="heading-tears-of-joy-from-a-developer-who-got-to-build-a-pwahttpsdevelopersgooglecomwebprogressive-web-apps">Tears of joy from a developer who got to build a <a target="_blank" href="https://developers.google.com/web/progressive-web-apps/">PWA</a></h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*QdfzoCfX6qTBGzZXR7AdnQ.jpeg" alt="Image" width="800" height="183" loading="lazy"></p>
<p>Growing up, being movie director was what my werewolf teeth were made for. Who knew that this front-end thing was gonna consume me like this. But it’s all good because creating art that actually helps people might be the one job to rule them all.</p>
<p>I’ve been enjoying it since the days when Flash was one of two ways to have rounded corners on screen. I was the happiest when I was able to demonstrate that the web can be a source of delight.</p>
<p>And since then it’s only been getting better.</p>
<p>Nowadays however, I’ve observed how companies still prioritize native app development. I need to show how the web, too, is ready for the amazing mobile experiences.</p>
<p>In my own circles, I am known as the guy who invests irrational effort in animations and performance. To me, the prettiest thing in the world is nothing without well crafted transitions narrative that helps guide the visual experience.</p>
<p>Recently I got handed an opportunity that was dear to my heart. It would allow my users feel when using it, the way I felt when creating it.</p>
<p>Meet <a target="_blank" href="https://dscova.com/">Dscova.com</a> — the platform that lets us openly share and brag about our experiences worth enjoying.</p>
<p>It grows, it shrinks, it dances, it slides, it gets excited when you touch it. And should you choose to add it to your home screen, it’s gonna follow you forever. It’s your overly attached web app that you are not ashamed to introduce to friends.</p>
<p>One thing that is clear is that it doesn’t blindly follow any design guideline. It has it’s own unique tone. We have mi hombre <a target="_blank" href="http://perezdiego.com/#/">Diego</a> to thank for that. I love working with designers who bring their own perspective.</p>
<p>Dscova should be the definition of everything I was convinced was possible on the mobile web. It’s my favorite baby thus far. Wish I could <a target="_blank" href="https://youtu.be/jPdHaNr0OAY">call it George</a>.</p>
<p>Do you notice? I too am not following the <strong>almost</strong> strict guidelines of delivering app shell. Instead, I’m embedding a splash with the initial response from the server. This is how I’m able to let the users know that they’re in the right spot, in a quick, yet smooth way.</p>
<p>OF COURSE I understand that many of the big guys take the app shell approach.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*7yuHZVGphmZCi1TF1XWY6A.png" alt="Image" width="800" height="101" loading="lazy">
<em>But if you are like me, you are <strong>almost</strong> pissed off too when you’re faced with a useless/broken UI for seconds at a time.</em></p>
<p>I am convinced that the slowly fading splash prepares the user in a better way for the well known app behavior that always comes after a splash.</p>
<p>Demoing Dscova around, I’ve had casual users forgetting they were on the web. Not surprising, since they care for the experience, not the platform.</p>
<p>So I’d like you to drop everything and come join the wave. Especially if you turn out to be one of the artists that have ever delighted me on my phone.</p>
<p>I’m aware that you might be reluctant to make this transition today. As big and undisputed you think the current app stores are, imagine how sooner or later, the web itself is gonna turn into an app store, without the store part. No landing pages. Just apps that integrate with the OS and with each-other.</p>
<p>If you consider today’s users as lazy and aware of their time, hold your breath for the unexpected complaint:</p>
<blockquote>
<p>“I had already opened their app, but then they wanted me to go to some app store and install something else. They said it’s their app. I’m confused.”</p>
</blockquote>
<p>Today’s users generally know web when they see it. I have the greatest laughs with them. To understand what I mean, and appreciate the PWA (Progressive Web App) installation process, show it to a non-techy user, and wait for the cutest “um.. [conspicuously looks at you] was that it??” reaction.</p>
<p>We have Google to thank for the efforts they made for us and our users in this regard. Still, the one thing that’s always going to matter more is what’s inside.</p>
<p>Delightful is possible. 60 fps is possible. All the Olympic gymnastics that these views do, as well as being fun, aim to help the user understand what is happening. Where everything went, and where everything came from. But as lovely as they are, they weigh on our heads with their need for complex state management. Look at this beauty:</p>
<p>This is my favorite piece of interaction. It couldn’t be any more seamless for the user. Yet behind the scenes, seemingly unrelated contexts are doing some elegant communication to accomplish this goal. While untrue for OO (Object Oriented) systems, here any view element has access to any piece of app state without ANY consequence. I’ll wait here till it sinks in.</p>
<p>We don’t need to call for an external state, and we don’t need to wait for it. It’s because of the nature of the system. It’s because of how the whole app state is a single bag of data that is available everywhere. And because the state is immutable, only contexts with explicit requirements to update their contextual sub-bags of data are able to do so. What a sentence.</p>
<p>In this example, the developer designs the map state and implements the pan based on location state updating. The jolly fun happens when in the context of experience creating wizard, all the next developer needs to do is:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*aVtdGZS_YhPQAfTWku6rrg.png" alt="Image" width="800" height="200" loading="lazy"></p>
<p>I mean, I could’ve used words to explain this, but look at it. That’s English.</p>
<p>Notice how <code>currMapCenter</code> is there for the taking. It requires no special strategy of how to React™ when there are new map center coordinates. They are just.. there.</p>
<p>Not only does it make solving this use-case a joke, but the data guarantees that come prepackaged with the immutability allow us to not worry about manipulating the map state outside of it’s context. And what do we call development without worries?</p>
<p>Thats joy, my invisible-bug-squashing friends.</p>
<p>Joy!</p>
<p>I haven’t mentioned that we use <a target="_blank" href="http://elm-lang.org/">Elm</a> yet, have I? Sorry bout that. Well, I run this small team that somehow, after Elm, became a lot bigger, even tho the number of people remained. We can’t pass the free plan on Sentry. We don’t have any testing work left for our family members either. And we ship features like алва[1]. So pardon me when I assume that EVERYONE is on the Elm train or getting there.</p>
<p>Look, I don’t know how much this matters to you, as no number measures user’s delight, but let’s see anyway:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*wxG-rLNELy89no_O4vuhFA.png" alt="Image" width="800" height="401" loading="lazy">
<em>Just a little something that comes as a bonus with Elm builds.</em></p>
<p>Consider how this app, with it’s 37K lines of Elm, and it’s 280KB gzipped size, 40% of which are libraries, generally has a first load in 4 seconds. I have no idea when the hell would I ever need to even think about splitting and loading modules lazily. Something that is imperative with the other platforms.</p>
<p>Dark story time: last year we were working on an Angular 2 project. Started with the early betas. When we completed it, NG was stable, but it took the app 20 seconds to start. It was because it needed to compile the views on the device on every start. First, it took us time to realize that. Then, we had to wait for the ahead of time compiler to get released before we released the app. As I said, a <a target="_blank" href="http://www.games-wiki.org/wiki/Black_Stories/">dark story</a>. Go play it with friends. Start with: “A product launch got delayed”. [2]</p>
<p>I believe you can feel my relief when in the first run of this test we got<br><strong>100, 98, 98</strong>. We then enabled long-term caching and.. well you see the hundreds.</p>
<p>I am keeping distance from implementation details throughout this article because in the end, this is what matters. This feeling that I have.. it’s.. let me try it this way: have you been noticing how popular it is for a front-end guy to feel stressed out? How much effort needs to be invested to be on top of the game? Has there ever been a bigger tools and techniques explosion compared to what’s happening now on the front-end? As self-abusive as it sounds, If I didn’t actually love this craze, I wouldn’t have discovered functional reactive programming. I wouldn’t have discovered Elm. [3]</p>
<p>I finally live in a world where technicalities are irrelevant. For any challenge there is an obvious approach to solving it. I’m just focused on what I love the most: fading and blurring and moving things around.</p>
<p>Not only do I not suffer the <a target="_blank" href="https://www.smashingmagazine.com/2016/11/not-an-imposter-fighting-front-end-fatigue/">impostor syndrome</a> anymore, but I feel something that rests comfortably on the opposite side on that spectrum. Ever since the days I started following Elm, every time I see a massive new feature roll-out in any of the popular frameworks or tools, I usually think: “Oh look, another idea taken from Elm.”, either Redux or immutability or stateless view components. Or even better, I realize that it’s a solution to a problem that is nonexistent in Elm Town.</p>
<p>I want you to realize the advantage Elm gives you. They can go nutz in trying to improve JS. But they’ll never be able to fix it unless they change it. And you know that I know that you know that they cannot do that. So instead of endlessly learning how to build stuff, you’ll start building stuff, endlessly. <a target="_blank" href="https://en.wikipedia.org/wiki/Pulitzer_Prize">Pulitzer</a> please!</p>
<p>Elm is totally new and different. It couldn’t be this good any other way. The hardest thing you’ll have to do is unlearn all the OO patterns you use to handle problems that are (together!) nonexistent in Elm. Seriously.</p>
<p>Have you started using underscore to transform data? Have you been moving away from classes and use modules as encapsulation contexts? These are great first steps that would ease you in into the productivity boost in Elm’s pure functional world.</p>
<p>But, if you are already using React or Angular in a functional reactive way, you’ll find that Elm is where everybody got their ideas from and how they look like in their purest form. You alone will be able to replace 20 of the you before you became Elm.</p>
<p>Here’s the hard question: Who’s gonna help you once you get stuck? I know this is what you are afraid of. It’s a small community, so the support is questionable. How do I put this.. you will nowhere find more dedicated and more capable group of people in <a target="_blank" href="http://elmlang.herokuapp.com/">one room</a>. I don’t know how they breathe in there! Everyone trying to beat everyone else for who gets to help the newcomer first!</p>
<p>He fights about everything with everybody.But when you ask something on Slack, chances are, he’ll be there to help you.</p>
<p>And then get this, there is a weekly thing called <a target="_blank" href="https://www.reddit.com/r/elm/">“No dumb questions”</a> on Reddit. What? They didn’t use that name?? Oh well..</p>
<p>So what was I saying.. oh yes, delight users with PWA, enjoy doing so with Elm. And if you absolutely need to be present on the app stores, for extra 5% effort, <a target="_blank" href="https://cordova.apache.org">Cordova</a> will take you there. We spent the extra time because one of the core features of Dscova is notifying users as they move around when something awesome is nearby. And since background geolocation is still not conceptualized for the Web, we did it in the hybrid versions. That, and the fact that Apple doesn’t love Safari the way Google loves Chrome.</p>
<p>Let’s start wrapping up. This is too much not writing Elm for me.</p>
<p>Resources: When we were following beginner material, these were the greatest ones:</p>
<ul>
<li>Book: <a target="_blank" href="https://www.manning.com/books/elm-in-action">Elm in Action</a> by <a target="_blank" href="https://twitter.com/rtfeldman">Richard Feldman</a> (a great great guy. just. great.)</li>
<li>Video course: <a target="_blank" href="http://courses.knowthen.com/p/Elm-for-beginners">Elm for Beginners</a> by <a target="_blank" href="https://twitter.com/uknowthen?lang=en">James Moore</a></li>
<li>Video course: <a target="_blank" href="https://pragmaticstudio.com/courses/elm">Building Web Apps with Elm</a> by <a target="_blank" href="https://pragmaticstudio.com">The Pragmatic Studio</a></li>
<li>Go make some noise on <a target="_blank" href="http://elmlang.herokuapp.com">Slack</a></li>
<li>Listen to our spiritual leader on <a target="_blank" href="https://elmtown.github.io">Elm Town</a></li>
<li>I wanna put a special note here for the folks who like me, when I was starting, want to begin on a production app right away. Go learn Webpack. We were used to Gulp chains, but now our build process is nice and tight thanks to the <a target="_blank" href="https://github.com/elm-community/elm-webpack-loader">great</a> <a target="_blank" href="https://github.com/NoRedInk/elm-assets-loader">tools</a> that exist for Webpack.</li>
</ul>
<p>Hold the applause fellas, special props are coming:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*czS2OpA_tFQD2hJ4KBnf9A.jpeg" alt="Image" width="200" height="200" loading="lazy">
_The [Somebody](https://github.com/pdamoc" rel="noopener" target="<em>blank" title=") from the Elm community that I really hope you find for yourself.</em></p>
<p>The kind of guy that holds your hand and helps you cross the road.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*wQgwF3CkwyGt71-ONNClng.jpeg" alt="Image" width="200" height="200" loading="lazy">
_The [associate](https://twitter.com/trajches" rel="noopener" target="<em>blank" title=") you can dream of.</em></p>
<p>The only guy who could ever outwork me.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*aSjsKhpl37cf4FV0PXgBdw.jpeg" alt="Image" width="200" height="200" loading="lazy">
_[Some dude](https://github.com/evancz" rel="noopener" target="<em>blank" title=") that is too smart for his own good.</em></p>
<p>And because of it, he now has to fight every other smart person who <strong>knows</strong> which direction Elm should take.</p>
<p>[1] S<a target="_blank" href="https://www.google.com/search?q=%D0%B0%D0%BB%D0%B2%D0%B0&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=0ahUKEwjD9uCcoZzUAhVEOBQKHYquCTEQ_AUICigB&amp;biw=1440&amp;bih=799">omething</a> that my country used to ship a lot.<br>[2] Angular is solid today. The <a target="_blank" href="https://github.com/shlomiassaf/ngc-webpack">AOT compiler</a> can easily be plugged in your Webpack config, or even simpler, you might just wanna use their <a target="_blank" href="https://github.com/angular/angular-cli">CLI</a>.<br>[3] Elm is actually not a reactive platform anymore. It became something way more intuitive than that.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
