- 1.Why Elixir for Software Development?
- 2.Installing Elixir
- 3.Running Elixir
- 4.Useful links
- 5.Data types
- 6.Data collections
- 7.Immutability of data
- 8.Pattern matching
- 9.Control flow
- 10.Anonymous functions
- 11.Modules and named functions
Why Elixir for Software Development?
There are so many programming languages, why would you learn another one? In this chapter, you will learn about the strengths of Elixir and how its concept differs in a world dominated by an object-oriented paradigm.
What is Erlang?
Saying that Elixir programming language is your next choice because it's excellent is way too easy. We should find out why and when exactly it can help you with daily programming tasks. To understand its core concept we need to take a closer look at Erlang language.
Erlang programming language
Erlang was created with the aim of improving telephony applications development. As you know, almost everybody owns a mobile phone nowadays. We make calls, send messages and use internet through mobile phone couple of hours a day. As a user, we expect high availability of these services. That's why Erlang core concept is to maintain concurrency, distribution and fault tolerance.
Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance. ~ www.erlang.org
Erlang follows the functional paradigm which is very easy to understand since it's based on three assumptions (each of them will be covered in details in the next chapters):
treat computation as the evaluation of mathematical functions,
avoid changing state,
prevent data mutation.
To execute Erlang language, we need to compile it. We can do this with Erlang virtual machine (BEAM). It compiles Erlang to C language using a mix of natively compiled code.
Erlang use case nowadays
Erlang was initially built for telephony industry, but it doesn't mean it is its only use case. On the contrary, it can be used in any software where users expect a fast and real-time response. Nowadays most of the time we spend on the internet which is nothing else but servers connected to a global network. Such a network is very similar to telephony infrastructure, and therefore we should consider Erlang as the perfect fit for web applications.
Meet Elixir - the Erlang on steroids
Erlang provides excellent abstractions for managing highly-scalable, fault-tolerant systems, which is particularly useful in concurrent systems, where many independent or loosely-dependent tasks must be performed. ~ Saša Jurić, author of "Elixir in Action."
It seems like a perfect fit for a software developer, but is it?
Nowadays, we expect to write code in a productive and clean way, since it saves a lot of time and gets rid of frustration. That's why José Valim - founder of elixir, was not entirely enthusiastic about programming experience in Erlang. He created Elixir with the goal to bring productivity and extensibility to Erlang. You will see how it plays out in following chapters when we'll introduce core components of Elixir language. For now, it's just worth to mention, what are the main features of Elixir:
it compiles to bytecode interpreted by BEAM,
it can call functions written in Erlang without any runtime impact,
everything is treated as an expression,
polymorphism via protocols,
There is a great mini-documentary movie which explores the origins of the Elixir programming language: