Skip to content

Latest commit

 

History

History
134 lines (89 loc) · 4.44 KB

elixir.md

File metadata and controls

134 lines (89 loc) · 4.44 KB
lang syntax title author
Elixir
elixir
Elixir is a dynamic, functional language for building scalable and maintainable applications.
yashvardhan-verma
IO.puts("Hello, World!")

🤔 What is Elixir?

Elixir is a functional, dynamically typed, concurrent general-purpose programming language created by José Valim. It is built on the top of an Erlang virtual machine which is known for running low latency, distributed, and fault-tolerant systems. Elixir compiles down to Erlang's bytecode. Since its release in 2011, it has become one of the most loved languages, because Elixir applications are scalable, very reliable, and syntax is also nice.

🤷‍♂️ Why to use Elixir?

  • Scalability - Elixir code runs inside lightweight threads of execution (called processes) that are isolated and exchange information via messages. Isolation allows processes to be garbage collected independently, reducing system-wide pauses, and using all machine resources as efficiently as possible (vertical scaling).

  • Fault-Tolerance - To cope with failures, Elixir provides supervisors which describe how to restart parts of your system when things go bad. The combination of fault-tolerance and event-driven programming via message passing makes Elixir an excellent choice for reactive programming and robust architectures.

  • Functional - Functional programming promotes a coding style that helps developers write code that is short, concise, and maintainable. In Elixir immutable data structures help concurrency quite a lot, and pattern matching is great for writing declarative code.

  • Dynamic Typing - Dynamic typing means that types are checked in run-time, not during compilation. This increases the development speed for simple web and mobile applications. In Elixir, static types can be introduced in Elixir through typespecs.

⚙ Setting up Elixir development environment

🔨 Tools you will need

For setting up an environment for performing Elixir codes,
you need a machine with a minimum of 2 GB of RAM.

You will also need the following software:

  • Linux, macOS, or Windows XP/7/8/10 operating system
  • Erlang
  • Text Editors like Sublime Text, VS Code, Atom

On MacOS

  • Using Homebrew
foo@bar~$ brew install elixir
  • Using Macports
foo@bar~$ sudo port install elixir

On Linux

  • Arch Linux
foo@bar~$ pacman -S elixir
  • Debian or Ubuntu
foo@bar~$ wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb
foo@bar~$ sudo apt-get update
foo@bar~$ sudo apt-get install esl-erlang
foo@bar~$ sudo apt-get install elixir
  • Fedora
foo@bar~$ yum install elixir

On Windows

  • Using Chocolatey
foo@bar~$ cinst elixir

Or you can download the installer from here and simply follow the instructions.

On Raspberry Pi

foo@bar~$ echo "deb https://packages.erlang-solutions.com/debian buster contrib" | sudo tee /etc/apt/sources.list.d/erlang-solutions.list
foo@bar~$ wget https://packages.erlang-solutions.com/debian/erlang_solutions.asc
foo@bar~$ sudo apt-key add erlang_solutions.asc
foo@bar~$ sudo apt update
foo@bar~$ sudo apt install elixir

Using Docker

foo@bar~$ docker run -it --rm elixir bash

🚩 Some cool projects in Elixir

🏢 Companies using Elixir

WhatsApp

WhatsApp provides messaging services to more than 1 billion people around the world, and they do all this having a really small team

Adobe

Adobe used Elixir in production to create a client/cloud app for a collaborative photography workflow.

Discord

Instant messaging app for video, voice calls and text chats chose Elixir to build a large-scale messaging system with over 5 million concurrent users.

Conclusion

If want to build a robust, fault-tolerant scalable project with a small team, then Elixir is the best weapon for you.


Thanks For Reading! 🤗