Elixir
DEVELOPERS CONFERENCE
FUTURE
THE
FOR
DIGITAL WORLD 2017
TAwsif Aqib
ENGINEERING MANAGER


JOSE VALIM
Created Elixir on 2012
Ex-member of Rails Core Team
Platformatec

2 Million concurrent connections in a single machine using Erlang and just 10 developers.

Created on 1986
Ericsson Computer Science Lab
Open Telecom Platform (OTP)
Open sourced on 1996
Fault-tolerant
Concurrent
Distributed
Functional
I liked everything I saw in Erlang, but hated the things I didn't see.
- Jose Valim
ERLANG
Problems
Unfriendly Syntax
Unreadable Macros
No Polymorphism
Lack of Web Tools
Elixir
Runs in Erlang Virtual Machine
Can use any Erlang Module without penalty
Best suited for Web Application Development and Embedded System
Elixir is a dynamic, functional language designed for building scalable and maintainable applications.
- elixir-lang.org
USING ELIXIR/Erlang
Amazon
Yahoo!
Heroku
CouchDB
RabbitMQ
World of Warcraft
Ericsson
Lets write some code
No please ...
"Hello World"
First Project
$ mix new dev_conf
...First function
defmodule DevConf do
def factorial(n) do
if n == 0 do
1
else
DevConf.factorial(n-1) * n
end
end
endRunning code
$ iex -S mix
...
iex> DevConf.factorial(1000)
...elixir style
defmodule DevConf do
def factorial(0) do
1
end
def factorial(n) do
DevConf.factorial(n-1) * n
end
endperformance
iex> DevConf.factorial(1000)
...
iex> DevConf.factorial(10000)
...
iex> DevConf.factorial(100000)
...DISTRIBUTED SYSTEM
COMMUNICATION AMONG DISTRIBUTED APPS
$ iex --sname node_1$ iex --sname node_2Node 1
Node 2
$ iex --sname node_1
iex> Node.list
[]$ iex --sname node_2
iex> Node.connect(:node_2@host)
true
iex> Node.list
[:node_1@hostname]Node 1
Node 2
iex> defmodule DevConf do
iex> def say_hello() do
iex> "Hello Developers"
iex> end
iex> end
...iex> Node.spawn_link(:node_1@host, fn () ->
IO.puts DevConf.say_hello()
end)
"Hello Developers"
#PID<9785.108.0>Node 1
Node 2
THE FUTURE
The future will be functional and concurrent.
IoT
Realtime
Concurrency
Microservice
Distributed System
popular Tags
(REALTIME)
Channels
defmodule DevConf.TalkChannel do
use Phoenix.Channel
def join("talk", _payload, socket) do
{:ok, socket}
end
def handle_in("message:new", payload, socket) do
broadcast! socket, "message:new", %{user: payload["user"],
message: payload["message"]}
{:noreply, socket}
end
end(MICROSERVICE)
UMBREALLA PROJECT
$ mix new dev_conf --umbrella
dev_conf
├── README.md
├── apps
├── config
│ └── config.exs
└── mix.exs(CONCURRENCY)
ELIXIR PROCESS
defmodule DevConf.TableTennis do
def greet do
receive do
:hello ->
IO.puts "Hello Alchemist"
end
greet()
end
end
(IoT)
NERVES
Craft and deploy bulletproof embedded software in Elixir
Hardware Support
Production in huge scale
Well written libraries
(Distributed System)
OTP
State Management
Application Discovery
Failure Detection
Hot Code Swapping
Community
3000+
Elixir Forum Treads
17,415
Slack User
Registered
4,963
Stack Overflow
Question
Backed by Ruby, Erlang and Node.js community
Packages (HEx)
540,625
Downloads
Yesterday
5,539
Packages
Available
157,370,966
All Time Downloads
Phoenix Framework

Web Framework
Rails inspired
Developer Friendly
Super Fast (Microseconds)
Lots of Resources
Context (version 1.3)
WHERE to use elixir?

Comparison of Technologies
WHERE to use elixir?
EVERYWHERE
When you need
Clean, Readable Syntax
Mature Tooling (30 years)
Built-in Unit Testing
Meta-programming
Built-in Documentation
Distributed System
Concurrency
Fault-tolerant
High Availability
Choose Elixir for the code,
not the performance.
REsources
Screencasts
dailydrip.com
elixirsips.com
Most Important Link
Questions
GIVEAWAY
Thanks
Elixir for Future 2017 (Archived)
By Tawsif Aqib
Elixir for Future 2017 (Archived)
Developer Conference, Digitial World 2017, Dhaka, Bangladesh
- 1,059