bound to objects Objects as representations of “real” concepts ‡ Aspirational- Freer / Freeish Object Oriented Language Immutable Stateless Functions as first-class citizens Data Transformations Free‡ from side-effects
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.‡ ‡ https://www.erlang.org/
libraries and design principles providing middleware to develop these systems. It includes its own distributed database, applications to interface towards other languages, debugging and release handling tools.‡ ‡ https://www.erlang.org/
building scalable and maintainable applications. Elixir leverages the Erlang Virtual Machine (VM), known for running low-latency, distributed and fault-tolerant systems, while also being successfully used in web development and the embedded software domain.‡ ‡ http://elixir-lang.org/
modules. Lists instead of Arrays and Maps instead of Hashes :atoms instead of :symbols BEAM (Erlang Virtual Machine) Tuples {:state_of_the_world, "The result of the function"} Use Recursion and Higher order functions like :map and :reduce Pattern Matching
show(conn, %{"data" =>data}) do # do something render conn, "show.html", _variables end end module RailsConf class Athlete < ApplicationController def show # do something end end end
def show # do something end end end defmodule RailsConf.Admin.MyController use RailsConf.Web, :controller def show(conn, %{"data" =>data}) do # do something render conn, "show.html", _variables end end
request (this is invisible to you as the developer)†, ...‡ ‡ http://guides.rubyonrails.org/action_controller_overview.html#what-does-a-controller-do-questionmark † Emphasis mine.
and it does things. (But mostly that’s hidden) Plug in Phoenix is an explicit pipeline through with the connection (request lifecycle) flows. Plug: A module plug implements an init/1 function to initialize the options and a call/2 function which receives the connection and initialized options and returns the connection. Rack: A Rack application is a Ruby object (not a class) that responds to call. It takes exactly one argument, the environment and returns an Array of exactly three values: The status, the headers, and the body.
as the first argument to the right-side. defmodule Example do def transform(map, key, second_arg) do map |> Map.update!(key, fn(x) -> x <> second_arg end) end end
as the first argument to the right-side. defmodule Example do def transform(map, key, second_arg) do map |> Map.update!(key, fn(x) -> x <> second_arg end) end end
as the first argument to the right-side. defmodule Example do def transform(map, key, second_arg) do map |> Map.update!(key, fn(x) -> x <> second_arg end) end end
do %{} |> present_filters(terms) |> present_prefixes(terms) |> present_ranges(terms) |> present_query end end ‡ https://en.wikipedia.org/wiki/Series_of_tubes, https://en.wikiquote.org/wiki/Ted_Stevens
The request; a URL (function name) with one or more parameters Which sends the request through a series of transformations; and produces the output: As a user, I don’t care much more about it than that.
More boilerplate code. Functional paradigm maps better to a web request. (According to me) Immutable and easier to reason about. Asynchronous Fast! Phoenix ≠ Rails
Elixir transpiles to BEAM bytecode‡ The BEAM is the BOMB! ‡ With intermediate stops in Erlang Abstract Format (EAF), Erlang Core, etc. https://elixirforum.com/t/getting-each-stage-of-elixirs-compilation-all-the-way-to-the-beam- bytecode/1873
two. One should not look for anything else in the Way. It is the same for anything that is called a Way. If one understands things in this manner, he should be able to hear about all ways and be more and more in accord with his own.‡ ‡ Ghost Dog: The Way of the Samurai