Familiarity or Guarantees? Functional Programming for the front-end

location_city Online schedule Mar 25th 02:00 - 02:20 PM IST place Zoom people 60 Interested

In the front-end world, we finally can take an important decision: Familiarity or Guarantees?

Do we keep using frameworks that are familiar to JavaScript (bringing with them all JS idiosyncrasies) or do we embrace a world of guarantees where functions are pure, data is immutable, types are correct, and runtime exceptions don’t exist?

In Rakuten, we went the way of guarantees three years ago, choosing Elm.

In this talk, I am going to explain what are the benefits of Elm in the front-end, and what was our experience.

I will showcase examples, best practices, things that we liked, and things that we didn't like.


Outline/Structure of the Experience Report

  • (1 min) Introduction of myself, agenda, etc.
  • (2 mins) Our requirements and why we chose Elm three years ago.
  • (2 mins) Introduction to Elm and its main selling points. How Elm fitted our requirements.
  • (2 mins) What we believe are the pros and cons of Elm (in relation to an extensive blog post we wrote a few months ago: https://engineering.rakuten.today/post/elm-at-rakuten/)
  • (2 mins) Demo of some of our projects built in Elm publicly accessible.
  • (2 mins) Some of the useful tools and packages that we use in our projects, such as elm-review, elm-ui, elm-ui-with-context.
  • (2 mins) Overview of the training materials that we produced to train our developers and that is available to the public
  • (2 min) Small excursion about patterns
  • (2 min) "Be explicit is", one of our guidelines about writing code that is friendly to junior coders.
  • (3 mins) Trade-Offs - This is the conclusion of the talk where I summarize the fact that we can have the guarantees provided by the Functional paradigm if we break free from JavaScript.

Learning Outcome

  • Attendees will learn about one option of using Elm, a purely functional language, in the front-end.
  • They will learn what are the benefits of using Elm, compare to the mainstream frameworks, but also what are the downsides of it, that is the lost familiarity with JavaScipt.
  • They will learn some insights about what are the packages that a large company adopted, together with Elm and some of the best practices after three years of experience using Elm in production.
  • Attendees will also see examples of code and applications running in production built with Elm.
  • The presentation will shed some light on a new perspective about using FP in the front-end and possibly spark some curiosity to seek out more.

Target Audience

Anybody interested in FP, especially if they are considering applying it to the front-end. The talk can be followed by any level of developers, from beginners to advanced.

Prerequisites for Attendees

There are no specific prerequisites for this talk. I will sometimes make the comparison to TypeScript or JavaScript, so some knowledge of the front-end could help to understand better some concepts.


schedule Submitted 7 months ago

  • Bartosz Milewski

    Bartosz Milewski - Teaching Optics through Conspiracy Theories

    Bartosz Milewski
    Bartosz Milewski
    Math Evangelist
    Programming Cafe
    schedule 7 months ago
    Sold Out!
    45 Mins

    With polymorphic functions you can often tell how they are implemented by looking at their outputs. The more polymorphic the function, the more you can tell about its internal workings. Lenses, as well as more general optics, have convenient polymorphic implementations in terms of functors and profunctors. But under layers of abstractions they are hiding some simple truths. We are going to get to the bottom of this conspiracy.

  • Saurabh Nanda

    Saurabh Nanda - Dhall as a Gateway-drug to Typed Functional Programming

    Saurabh Nanda
    Saurabh Nanda
    Vacation Labs
    schedule 5 months ago
    Sold Out!
    45 Mins

    Haskell (and the kind of Statically Typed Functional Programming that it promotes) is notoriously hard to learn. I have struggled with the learning curve. I have seen others struggle with it. And I have seen developers struggling to wield the language effectively even after months of learning.

    But it is not necessary to jump into the weird world of Monad, Monoid, and Endofunctors. There are neighbouring languages that can be immediately put to good use and introduce some of the Typed FP concepts more gradually.

    We'll talk about one of them - Dhall: A Typed FP language specifically for configuration management.

  • Grahame Dixon

    Grahame Dixon - Extending Railway Oriented Programming in Elm to Make Complex User Flows Simple

    20 Mins

    What do you do with a multi-step function with different kinds of user input that may be required at different steps? 

    I'm using Elm to build a game client for Codex, a complex strategy board game by David Sirlin with lots of interesting side effects in the game design. The pure functional programming of Elm is very powerful for managing these side effects, but how should I handle when there are many different kinds of user input required to complete the behaviour of a single feature?

    There’s a “railway oriented programming” metaphor to understand how to handle multiple-steps of errors. I’ll extend this metaphor – with stations – to show how to make what looks like a complex functional problem into a simple pattern of abstraction.

    Some familiarity with functional programming idioms is recommended, though the examples themselves are easy to follow. Attendees will walk away seeing functional programming applied in a fresh way, perhaps opening their mind to alternative perspectives to approach the complicated problems in their projects.

  • Akshay Kumar Arumugasamy

    Akshay Kumar Arumugasamy / Christopher Anand - Teaching Functional Programming to Children

    20 Mins

    Is functional programming for experts? We have found that children learning programming also benefit!

    Over the last 5 years, we have taught 25K children through the McMaster University’s outreach program McMaster Start Coding (Canada), and started training undergraduates from peer institutions, including Vellore Institute of Technology, Cihan University (Kurdistan), and Narasu’s Sarathy Institute of Technology (India), so that they they can create their own programs.

    Our main motivation for teaching functional programming to children is the similarity between algebra and functional programming. Algebra is a barrier to secondary and postsecondary education, and helping children overcome this barrier can have a huge impact.

    We continued to develop our program because both children and teachers loved it. Children find it easy to learn about functions when the functions draw shapes on their screen using a compositional language they find easy to learn. Teachers love it, because children immediately understand concepts including Cartesian coordinates which are difficult to motivate for some.

    In this talk we will explain the design philosophy behind our open-source graphics library GraphicSVG for Elm, and why we think Elm (with pure functions, and well-typed standard library) is the best language to teach 10- to 14-year olds.

    We will give you a toolkit for advocating functional programming in your local schools, and show what children can create, including children from Vikas School in Hyderabad who were isolating at home with only a smartphone to learn programming on.