Élixir ça Déchire

Et  voila pourquoi....

Thomas WICKHAM

@radiothomas_

2019

ERLANG ? C'est vieux ça...

%%--------------------------------------------------------------------
%% Description: Starts the ssh application. Default type
%% is temporary. see application(3)
%%--------------------------------------------------------------------
-spec start() -> ok | {error, term()}.

start() ->
    start(temporary).

-spec start(Type) -> ok | {error, term()} when
      Type :: permanent | transient | temporary .

start(Type) ->
    case application:ensure_all_started(ssh, Type) of
        {ok, _} ->
            ok;
        Other ->
            Other
    end.

Elixir, the new kid in the block

defmodule Phoenix.Endpoint.Supervisor do
  # This module contains the logic used by most functions in Phoenix.Endpoint
  # as well the supervisor for sockets, adapters, watchers, etc.
  @moduledoc false

  require Logger
  use Supervisor
  alias Phoenix.Endpoint.{CowboyAdapter, Cowboy2Adapter}

  @doc """
  Starts the endpoint supervision tree.
  """
  def start_link(otp_app, mod) do
    case Supervisor.start_link(__MODULE__, {otp_app, mod}, name: mod) do
      {:ok, _} = ok ->
        warmup(mod)
        ok
      {:error, _} = error ->
        error
    end
end

Elixir apporte

Phoenix Framework

  • https://phoenixframework.org/
  • RoR en mieux
    • toute son expressivité
    • les mêmes concepts, on reste à l'aise
  • L'ORM est encore mieux que ActiveRecord: https://github.com/elixir-ecto/ecto
  • DDD built-in, archi hexagonale built-in, mocks d'API externes (behaviors)
  • Performant, scalable (duh !), distribué, real-time... que demande le peuple ?
  • Des techniques de debug et d'introspection encore plus balèze avec la console

WRAP-UP

  • C'est pas Java ou JS
  • Il y a une continuité historique qui le rend robuste et varié
    • les trucs vieux et balèze ont été sélectionnés par le temps
    • les trucs jeunes et cools ont été implémentés
  • ANB a trouvé ça un peu dur, mais moi j'ai pas eu de problème, YMMV
  • Tout pour s'éclater. J'en referais avec plaisir, j'ai vraiment kiffé

Elixir ça déchire, et voila pourquoi

By Thomas Wickham

Elixir ça déchire, et voila pourquoi

  • 714