<?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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jovanny Cruz on Medium]]></title>
        <description><![CDATA[Stories by Jovanny Cruz on Medium]]></description>
        <link>https://medium.com/@jovannypcg?source=rss-76daa3f19e03------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*INTq0jShqOHrdFFHAQr-7Q.jpeg</url>
            <title>Stories by Jovanny Cruz on Medium</title>
            <link>https://medium.com/@jovannypcg?source=rss-76daa3f19e03------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 09:45:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jovannypcg/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Back to the Future in Clojure]]></title>
            <link>https://levelup.gitconnected.com/back-to-the-future-in-clojure-934b85a3d08e?source=rss-76daa3f19e03------2</link>
            <guid isPermaLink="false">https://medium.com/p/934b85a3d08e</guid>
            <category><![CDATA[clojure]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[parallel-processing]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Jovanny Cruz]]></dc:creator>
            <pubDate>Wed, 15 Jan 2020 04:00:31 GMT</pubDate>
            <atom:updated>2020-01-15T04:00:31.930Z</atom:updated>
            <content:encoded><![CDATA[<h4>A small and straightforward case on parallel processing using futures</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6CeBXCx1wBP0tO-9fO7Sg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jamie452?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jamie Street</a> on <a href="https://unsplash.com/s/photos/parallel?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Parallel processing is an exciting topic, especially when talking about heavy processes that can be split into smaller tasks, executed in isolation, aggregated, and presented as a unique outcome.</p><p>Clojure provides different ways to accomplish this kind of job, and <em>futures</em> are a handy approach to split a big task into parallel threads that will eventually be gathered by the process that started them up, allowing it to aggregate the results to provide the same outcome in a faster way.</p><h3>Talking Futures</h3><p>You can think about a <em>future</em> as a piece of code that runs on its own and independent thread. More specifically, a <em>future</em> is a Clojure macro that takes a set of expressions in order to execute them in another thread. The macro returns a reference in memory to the triggered <em>future</em>. This allows to communicate with it via some helper functions:</p><ul><li><a href="https://clojuredocs.org/clojure.core/future_q">future?</a>: Verifies the provided argument is a future.</li><li><a href="https://clojuredocs.org/clojure.core/future-done_q">future-done?</a>: Takes a future as argument and verifies whether it has been completed.</li><li><a href="https://clojuredocs.org/clojure.core/future-cancel">future-cancel</a>: Attempts to cancel the given future.</li><li><a href="https://clojuredocs.org/clojure.core/future-cancelled_q">future-cancelled?</a>: Verifies if the future passed as argument was cancelled.</li></ul><p>The result of the <em>future</em> is stored and available somewhere in the cache, we can attempt to get its outcome even when not finished yet by calling (deref my-future). In this case, the thread that tries to deref is going to get blocked until the <em>future</em> is done.</p><h3>Getting the Stargazers from Github</h3><p>We are interested in getting the total amount of stars that <a href="https://github.com/clojure">Clojure</a> has on Github. That is, the sum of stars from each repository that belongs to the Clojure account.</p><p>This information can be readily fetched by the <a href="https://developer.github.com/v3/">Github API</a>. The GET /users/:username/repos <a href="https://developer.github.com/v3/repos/#list-user-repositories">endpoint</a> already responds with the star count of each repository. We can just loop over the returned JSON array, get the star counts and sum them up.</p><p>For the sake of this article, let’s assume the endpoint above does not return the star counts, but the name of the repositories, so that we can hit the GET /repos/:owner/:repo <a href="https://developer.github.com/v3/repos/#get">endpoint</a> to get the star count. This means that for each repository name, a request to GET /repos/:owner/:repo will be launched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*oKyNGafMFIi-EGsqlUyrbw.png" /><figcaption>Aggregate Repositories Synchronously</figcaption></figure><p>As the image above suggests, getting the stars from each repository is a sequential and synchronous task, which might take a considerable amount of time for each request to complete. Once all requests have successfully responded, the reduce function comes into play to sum up all the stars.</p><p>The following function, get-star-count, executes the HTTP request synchronously to get the repository details and then extracts the stargazers-count attribute from the response, which represents the star count.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/debbe5310d245b2bbf28eeb35f250d63/href">https://medium.com/media/debbe5310d245b2bbf28eeb35f250d63/href</a></iframe><p>Now, let’s take a look at the sum-stars function. It provides two arities, one that takes the username exclusively and another one that requires a sequence of repository names:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8ee857ea6403cfc9ac08028089ceecd/href">https://medium.com/media/a8ee857ea6403cfc9ac08028089ceecd/href</a></iframe><p>Note that the first arity in line 3 calls the 2-arity function and sends the result of github/repo-names as the second argument (repos). This involves an additional HTTP call that prevents us from manually entering the repo names using a previously defined sequence. We can avoid this additional HTTP call interfering with sum-stars by either providing a defined sequence containing the repository names or storing the result of github/repo-names in a symbol and then pass it in to the function.</p><p>Each repository is passed in to get-star-count in line 6, blocking the main thread until each single request is finished synchronously. Then the results are aggregated by reduce.</p><h3>Futures in Action</h3><p>Now we are going to implement the same functionality using <em>futures</em>. This time, for each repository a <em>future</em> that executes GET /repos/:owner/:repo will be launched.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*1jHR3i2Q1A4eqKyPwoBuUQ.png" /><figcaption>Aggregate Repositories Asynchronously</figcaption></figure><p>Every HTTP request is working in parallel, as shown by the image above. The <em>futures</em> are triggered in point A using the future macro. Once they all are ready with their response, a <em>list comprehension</em> can be utilized to make them meet in point B in order to be reduced to a unique result.</p><p>Note that some requests might take longer than others, as they depend on the network throughput, latency of the Github server or even the speed of the processor running the threads. So, the worst case for this scenario is the request that takes more time to complete, as that will be the time for sum-stars to be done.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74c1182ca25f17cb134e077a7601f826/href">https://medium.com/media/74c1182ca25f17cb134e077a7601f826/href</a></iframe><p>The 1-arity function remains pretty much the same as in the synchronous version. All the repos of the given username are passed in to the 2-arity function.</p><p>The interesting part begins in line 5, with the for statement, which creates a list comprehension of <em>futures</em>. That is, a sequence of <em>futures</em> (line 6) that represents the location in memory of the threads working independently. Having this sequence of <em>futures</em> allows us to communicate with them using the helper functions explained earlier or simply try to deref and get the result.</p><p>The pipeline in line 7 shows up the process to aggregate each result. The sequence of <em>futures</em> is passed in to map using deref. This is going to block the main thread until each parallel thread is done. Once derefed, the list comprehension of <em>futures</em> becomes a sequence of responses with the actual star counts. Then they are passed in to the reduce function that simply sums them up.</p><h3>Benchmarking</h3><p>Let’s see how fast the sync and async versions work. In order to do that, we are going to use the handy time function that is part of clojure.core.</p><h4>Considerations</h4><ul><li>Executed on MacBook Pro, macOS Catalina 10.15.1, 2.2GHz 6-Core Intel i7, 16 GB 2400 MHz DDR4.</li><li>The <a href="https://github.com/clojure">Clojure</a> account on Github is used for the tests.</li><li>github/repo-names is limited to return 30 repos, despite <a href="https://github.com/clojure">Clojure</a> owns 85+.</li><li>Based on the point above, the tests consider 30 repositories from the <a href="https://github.com/clojure">Clojure</a> account.</li></ul><pre>user=&gt; (def username &quot;clojure&quot;)<br>user=&gt; (def repos (github/repo-names username))<br>user=&gt;<br>user=&gt; (time (core/sum-stars username repos))<br>&quot;Elapsed time: 13841.095288 msecs&quot;<br>20263<br>user=&gt;<br>user=&gt; (time (core/sum-stars-async username repos))<br>&quot;Elapsed time: 587.558128 msecs&quot;<br>20263<br></pre><p>As you can see, the result of both versions is the same 20263, which represents the total stars of the first 30 repositories of Clojure on Github. But the elapsed time for the synchronous version is almost 14 seconds, unlike the 587.55 ms of the asynchronous call.</p><h3>Conclusion</h3><p>Parallel processing provides a powerful way to split a heavy task into smaller and independent problems that can be aggregated once they all are done. <em>Futures</em> in Clojure are a powerful and easy-to-use approach to accomplish this kind of task.</p><p>Next time you are dealing with a function that is taking so long to complete, consider using <em>futures.</em></p><p>Do not forget to clone and play around with the <a href="https://github.com/jovannypcg/parallel-processing">code of this article</a>.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=934b85a3d08e" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/back-to-the-future-in-clojure-934b85a3d08e">Back to the Future in Clojure</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Spring’s @ControllerAdvice]]></title>
            <link>https://medium.com/@jovannypcg/understanding-springs-controlleradvice-cd96a364033f?source=rss-76daa3f19e03------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd96a364033f</guid>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Jovanny Cruz]]></dc:creator>
            <pubDate>Mon, 22 Jan 2018 03:14:02 GMT</pubDate>
            <atom:updated>2018-09-21T02:15:52.503Z</atom:updated>
            <content:encoded><![CDATA[<p>The @ControllerAdvice annotation was first introduced in Spring 3.2. It allows you to handle exceptions across the whole application, not just to an individual controller. You can think of it as an <strong>interceptor of exceptions thrown by methods annotated with</strong> @RequestMapping or one of the <a href="http://www.baeldung.com/spring-new-requestmapping-shortcuts">shortcuts</a>.</p><p>This post discuss the advantages and points to consider when a controller advice is introduced into a REST API written in Spring through a simple application.</p><p>A news-enthusiast community is writing an application for people that want to share an article on its platform. The approach is creating a REST API that has three endpoints:</p><ul><li><em>GET /users/:user_id</em>: Gets the user details based on <em>:user_id</em></li><li><em>POST /users/:user_id/posts: </em>creates a new publication and sets <em>:user_id</em> as the owner</li><li>POST <em>/users/:user_id/posts/:post_id/comments</em>: creates a new comment for the <em>:post_id</em></li></ul><h3>Exception handler in controllers</h3><p>Work was going well until developers noticed the application crashed in some cases. For example, when retrieving details of a non-existing user or creating a publication/comment with inappropriate content. The first approach was to include @ExceptionHandler methods in each controller, as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56beab00d5a82704cbe25d430bc88b16/href">https://medium.com/media/56beab00d5a82704cbe25d430bc88b16/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9dcab25807ad1e9665efe98851c13b89/href">https://medium.com/media/9dcab25807ad1e9665efe98851c13b89/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/837e1efdfcfeb12f28c116733d68d588/href">https://medium.com/media/837e1efdfcfeb12f28c116733d68d588/href</a></iframe><p>After having written the above controllers, they realized the approach was not optimal, since exception handlers might be repeated in many controllers (PostController#create and CommentController#create throw the same exception). One of the developers thought it would be great if they could create a centralized point for exceptions, so that whenever an exception is thrown by any controller, it would be caught and handled by that point instead of having handler methods in each controller class. @ControllerAdvice came into play.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*_nnxHyZvrvB3hGyuvGyAQA.png" /><figcaption>Centralized exception handler</figcaption></figure><p>GlobalExceptionHandler was annotated with @ControllerAdvice, thus it is going to intercept exceptions from controllers accross the application.</p><p>In this class handlers are declared, one per exception, as <strong>every exception should be treated differently</strong>, so that the user of the API will get an understandable error message. In this app ContentNotAllowedException contains a list of inappropriate words, while UserNotFoundException only holds a message. Let’s write a controller advice class to handle those exceptions.</p><h3>Writing a controller advice</h3><p>Developers tested out many ways to make a controller advice class work. After hard work, they found the following points to take into account:</p><ol><li><strong>Create your own exception classes</strong>. Despite Spring provides many classes that represent common exceptions in an application, it is better practice to write your own or extending those existing.</li><li><strong>One controller advice class per application</strong>. It is a good idea to have all exception handlers in a single class instead of annotating multiple ones with @ControllerAdvice.</li><li><strong>Write a </strong>handleException<strong> method</strong>. This one is meant to be annotated with @ExceptionHandler and will handle all exceptions declared in it and then will delegate to a specific handler method.</li><li><strong>Add one method handler per exception</strong>. Imagine you want to handle a UserNotFoundException, then create a handleUserNotFoundException.</li><li><strong>Create a method that sends the response to the user</strong>. Handler methods are meant to do the logic to treat a given exception, then they will call the method that sends the respond. This method will receive a list of errors as body and the specific HTTP status.</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/18adf37a5d2aac0dfb63290284a08fc2/href">https://medium.com/media/18adf37a5d2aac0dfb63290284a08fc2/href</a></iframe><p>@ControllerAdvice is now able to intercept exceptions from controllers across the application. All the developers needed to do was to remove handler methods from the controllers. That’s it.</p><p>Consider writing your own controller advice class with the points exposed in this article. You will appreciate having all your exception handlers in a single class.</p><p>Complete application demonstrated in this post can be found <a href="https://github.com/jovannypcg/exception_handler">here</a>. Two branches were created: no_controller_advice and master, which contains the controller advice implementation. Also take a look at the tests to have a better understanding of what is going on.</p><p>Find out the sample project <a href="https://github.com/jovannypcg/exception_handler">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd96a364033f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Elm and Materialize]]></title>
            <link>https://medium.com/@jovannypcg/getting-started-with-elm-and-materialize-b877836d03de?source=rss-76daa3f19e03------2</link>
            <guid isPermaLink="false">https://medium.com/p/b877836d03de</guid>
            <category><![CDATA[tutoriales]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[elm]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Jovanny Cruz]]></dc:creator>
            <pubDate>Sun, 05 Nov 2017 17:52:32 GMT</pubDate>
            <atom:updated>2017-11-07T22:23:54.307Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyaoOwaQxY8RRIMXPrUlLA.png" /></figure><p>As part of my career path as a full-stack developer, I have faced that thundering situation of writing frontend code. At the beginning, it was creepy for me, since I thought doing that would mean learning a myriad of languages, frameworks and tools, so that my user interfaces look truly cool. Fortunately I discovered Elm.</p><h3>First Things First</h3><p><a href="http://elm-lang.org/">Elm</a> is a functional programming language, exclusively designed for writing frontend applications. The language itself provides both an architecture and a framework. This means, none third-party dependencies must be included to create a web app.</p><p>The Elm Architecture (TEA) is comprised by three elements:</p><ul><li><strong>Model</strong>: State of the application.</li><li><strong>Update</strong>: A way to modify/update the state of the app.</li><li><strong>View</strong>: A way to visualize the state as HTML.</li></ul><p>Since browsers only understand JavaScript, Elm compiles to that language. It is not another typical one, though. The resulting JS code is tremendously optimized, <a href="http://elm-lang.org/blog/blazing-fast-html-round-two">making it the fastest frontend language</a>.</p><p>On the other hand, <a href="http://materializecss.com/">Materialize</a> is a CSS framework used to create responsive websites. It provides a bunch of Material Design components to make frontend development friendly.</p><h3>Let’s get some code</h3><blockquote>Make sure you have <a href="https://nodejs.org/en/download/">NodeJS</a> and <a href="https://guide.elm-lang.org/install.html">Elm</a> installed on your system.</blockquote><p>In <a href="https://github.com/jovannypcg/elmseed.git">this repository</a> you can find the basis to get started. It is a seed project on Elm, built using WebPack and has Materialize already configured.</p><p>After running the instructions described in <em>README.md</em>, take a look at the following files to figure out how Materialize was set up.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7550cd7a6b4ecf609776f2b8a2df02e6/href">https://medium.com/media/7550cd7a6b4ecf609776f2b8a2df02e6/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d88b40c05055db2d0774a305f6aed86/href">https://medium.com/media/8d88b40c05055db2d0774a305f6aed86/href</a></iframe><h3>Imports and main function</h3><p>Due to its functional paradigm, Elm functions are organized into modules. A module is expected to provide a set of functions, so that they are used by other modules.</p><p>Moreover, TEA requires a main function that launches the app. It might be included in any module. In this example, <em>main</em> was set inside <em>Main.elm, </em>as shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9cd5ac2ba0b3d58ed72c66d49216a2a/href">https://medium.com/media/f9cd5ac2ba0b3d58ed72c66d49216a2a/href</a></iframe><p>The name, imports and main function are written at the beginning of the <em>Main</em> module. When naming a module, the line exposing (..) means that module is going to export all its functions. Certain functions can also be specified, for instance exposing (main, view, module). It is a similar meaning when using <em>exposing</em> in imports. It describes the functions to be imported, exposing (..) for all the functions in the module exposing(onClick) for specific ones.</p><p><em>Line 15</em> utilizes the program function from the Html module, which was priorly imported. It requires a <a href="http://elm-lang.org/docs/records">record</a> that contains attributes and functions as values. These are the ones known by TEA: <em>init</em> is the initial state of the app (model), <em>update</em> and <em>view. </em>Additionally, a <em>subscriptions</em><a href="#3667"><em>¹</em></a> function is provided, since it is required by Html.program, but it just returns Sub.none, as none is going to be used in this app.</p><h3>Model and update</h3><p>Model and update are functions required by Html.program. The following code snippet demonstrates how they are implemented.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/919b6b0319dc3349e059102cfb7e729c/href">https://medium.com/media/919b6b0319dc3349e059102cfb7e729c/href</a></iframe><p>It starts by declaring a <a href="https://guide.elm-lang.org/types/type_aliases.html">type alias</a>, which specifies the kind of data the model will hold. It can be read as <em>type alias Model is a record with a single ‘jokes’ attribute, whose value must be a list of strings</em>. Function init uses the Model constructor<a href="#68f0">²</a> to generate the initial state of the app. It is a tuple containing an empty <em>Model</em> and no command. <a href="https://www.elm-tutorial.org/en/03-subs-cmds/02-commands.html">Commands</a> are functions that run in background. They are generally useful when dealing with stuff that requires processing time, such as API calls or generating a random number. After they finish their work, a call to update is made and update, in turn, alters the model.</p><p>Observe the following diagram to get a better understanding of how subscriptions and commands work in elm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*4rKJb_GAGQeBazN7s4e3AA.png" /></figure><p>Basically, the <em>update</em> function is listening to multiple messages. They can be sent from the view, a command or a subscription. Once the message arrives to <em>update, </em>it alters the model and changes are automatically reflected to the view.</p><p>Line 17 declares type Msg. This is nothing but a <a href="https://guide.elm-lang.org/types/union_types.html"><em>Union Type</em></a>. It contains messages for the whole application. There are only two:</p><ul><li>FindJoke. Is sent when the user clicks on the <em>Joke </em>button. Once this message is received, the getRandomJoke function (it is a command) is executed.</li><li>NewJoke. update will receive this message when getRandomJoke gets a one from the Chuck Norris Database. This case will update the model, adding it the recently downloaded joke.</li></ul><p>Finally, the update function is expected to use <em>pattern matching</em> to verify the received message.</p><h3>The view</h3><p>This function is meant to have a group of components (subviews), as shown in the following code snippet.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dafeed0fd6e0dda4088cc62433c64969/href">https://medium.com/media/dafeed0fd6e0dda4088cc62433c64969/href</a></iframe><h4>HTML Functions</h4><p>Writing views in Elm is amazing. It provides a set of <em>tag-like functions</em>, which are converted to optimized HTML once the module gets compiled. These functions have two main features:</p><ol><li>The name is the tag you would use in plain HTML. For instance: <em>div</em>, <em>h4</em>, <em>section</em>, and so on.</li><li>They expect exactly two lists as parameters. The first one is for the tag attributes, and the second one is the children of that node<a href="#5f37">³</a>.</li></ol><p>The very first line of the view says that it is a function called <em>view, </em>receives a parameter of type <em>Model</em> and returns a union type <em>Html Msg</em>. Inside it, a call to div is made. Its first argument is an empty list (which indicates it have no attributes) and a list of children nodes (other functions that return HTML nodes).</p><h3>Components</h3><p>As seen in the <em>view </em>function, it has a couple of child nodes: a <em>header </em>and a <em>tagSection</em>. Their names are pretty descriptive, right? They both are functions that return Html Msg as well.</p><p>Let’s dig into the <em>header</em> view. It was built with a <em>nav</em> tag and this is one of the components that introduce Materialize stuff.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6c6706729441d65261a983bdb6c4cfb/href">https://medium.com/media/e6c6706729441d65261a983bdb6c4cfb/href</a></iframe><p>This time, <em>tag-like functions</em> have a list of attributes. In fact, those attributes are also functions imported from the Html.Attributes module<a href="#c0cc">⁴</a>. Since Materialize was previously configured, all its components can now be utilized as described on the <a href="http://materializecss.com/navbar.html">docs</a>.</p><h3>What is next?</h3><p>As you might have noticed, Elm is fascinating language. If it caught you like me, the resources below will give the the power to master it.</p><ul><li><a href="https://guide.elm-lang.org/">Official guide</a>. Pretty well explained.</li><li><a href="http://knowthen.com/">KnowThen</a>. Has two incredible courses. Highly recommended.</li><li><a href="https://medium.com/elm-shorts/an-intro-to-constructors-in-elm-57af7a72b11e">An intro to constructors</a>. Reading this post made me completely understand how constructors work.</li><li><a href="https://github.com/isRuslan/awesome-elm">Awesome Elm</a>. A curated list of useful tutorials, libraries and software.</li><li><a href="https://www.reddit.com/r/elm/">Reddit community</a>. Every week a thread for novice questions is created. Take advantage of it.</li></ul><h3>Notes</h3><ol><li><a href="#fb9c">^</a> Subscriptions are for handling web socket connections.</li><li><a href="#3eef">^</a> Constructors in Elm are not going to instantiate any object, remember the functional paradigm. So, what is a constructor? Well, it is just a helper function that returns <strong>new<em> </em>data</strong>. For instance type alias Model = { jokes : List String}, provides a helper (constructor) function to generate a Model: Model [] returns an empty record with no jokes. But Model [&quot;First Joke&quot;, &quot;Second Joke&quot;], will return the record: { jokes = [&quot;First Joke&quot;, &quot;Second Joke&quot;] }. <em>type alias</em> is not the only feature that created constructor functions, <em>union types</em> and other ones also do that.</li><li><a href="#dd9f">^</a> Each tag-like function is considered as a node in the DOM tree.</li><li><a href="#81d8">^</a> For a better understanding of HTML Attributes, take a look at the <a href="http://package.elm-lang.org/packages/elm-lang/html/2.0.0/Html-Attributes">module documentation</a>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b877836d03de" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>