I love elm and hate static typing languages

History and lost love for static typing languages

I love design patterns; it adds an extra layer of beautiful complexity whenever you try and solve a problem.
For my years in college, I enjoyed reading about design patterns, during that period (and two years after) I’ve been using mainly static typing languages (C#, Java) and I loved it!! 
Static typing languages show design patterns the best, that’s why I was into that world for a good six years of my life

Check Design Patterns: Elements of Reusable Object-Oriented Software (Great Book)

After working on real projects for a couple of years, I always see the following
- I always find a lot of different layers even if the project was simple
- Using static type languages feel redundant, specifying types whenever a variable is defined, is good and all; but it just feels slow

What happened next, is that I used Rails, and everything changed, Developing was ten times easier, and also I was getting more involved in making SPA apps, I made a complete transition into working with dynamic languages on all stacks, and I loved it!!

Languages that compiles to Javascript

When Coffeescript first came out, I was super hyped and loved coding with it, I like Javascript, but at that time, it was never being updated.
That changed with ES2015, and with that, I am not a fan anymore with languages that compile to Javascript. Why make another language when Javascript is currently in active development

Elm is both of these things, why are you talking about it?

Elm is a language that is built on top of Javascript, but wait.. there is something different about it

Most languages built on top of Javascript are Javascript + more features.

Elm, on the other hand, is not concerned with Javascript at all, it tries to create the best language to build web apps (completely different language from Javascript)

Why elm is great (high level)

For now, lets say the best way to build a web app is by using React and Redux 
Elm embraced that idea and baked it into the core of the language itself

Redux is heavily influenced by Elm

The result: you have a language that is strongly opinionated on the best way to build web apps and gives you the appropriate tools on building them.

What is also great that all elm libraries works together and on top of elm’s imagination on how to create web apps, you won’t find libraries such as React, Angular, Ember.
Elm already embraces its way to be the way to build web apps, and all libraries will improve on that instead of each one trying to figure out the best way to built web apps.
The language itself already answered that question at the start

Why Elm is awesome (low level)

Elm has some great features that the reason why I love it even tho its a statically type language

Pure functions

A pure function is a function where the return value is only determined by its input values, without observable side effects.

What that means is basically you can’t change anything inside the function, see the following example

addIsCalled = false;
function add(x, y) {
addIsCalled = true; // Invalid in Elm
return x + y;
}

Smart ass compiler

What is beautiful in Elm compiler that it is like a debugging machine going over your code, 
- it will tell you if your function have side effects
- it will fail if you wrote an `if` without an `else` block
- it gives you great error messages on how to fix issues in your code

The reason why I don’t mind Elm of being a static type language is because in Elm you feel the compiler is built to make you write better code and fix any issues, it just helps you and doesn’t get in your way

Functional language
elm is functional, modern and easy to understand if you want an excuse to learn functional programming Elm is a great one

Conclusion

elm is still in an early stage; many would think there is a tiny chance that they would ever work with this language now in their company, so why bother?
Yes, you should check it out, for the following reasons:
- it will benefit you as a developer, and it change the way you think about solving problems 
- you will have a lot of discipline when writing functions and making them pure
- you will like functional programming a little bit more

If you want proof, redux one of the most famous state managers that is always used with react is heavily influenced by elm

What I want to get to is, learning a language is not just to learn another tool for tackling problems.

Whenever a language, library or framework is opinionated about its vision of the right way to build apps; learning them would make you a better developer

Resources if you want to get started with elm
- Elm getting started guide
- Highly recommend elm for beginners course by James Moore, it dives in both functional programming and elm (free)

Like what you read? Give Nadeem Khedr a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.