6. Ecto is not
your Model
— Michał Muskała
“
”Member of the Ecto core team
maintainer of the MongoDB adapter.
7. Be defensive at your
boundaries, trust
your internals
DATA
VALIDATION
INTERNALS
Validation at storage boundary
leads to an anemic domain model
8. Why do you stick
everything in a
database?
“
”— Joe Armstrong
9. MicroservicesDo you need a storage abstraction?
Your storage must be
independent from the
storage of other services
and the storage must be
close to your problem, so
my answer is no
It′s an abstraction or just indirection?
15. defmodule HelloPhoenix.Router do
use HelloPhoenix.Web, :router
!
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
!
pipeline :api do
plug :accepts, ["json"]
end
!
scope "/", HelloPhoenix do
pipe_through :browser
!
get "/", PageController, :index
end
!
# ...
end
Poor HTTP support
16. defmodule Chat.RoomChannel do
use Phoenix.Channel
!
# ...
!
def handle_in("new:msg", msg, socket) do
broadcast! socket, "new:msg", %{user: msg["user"], body: msg["body"]}
{:reply, {:ok, %{msg: msg["body"]}}, assign(socket, :user, msg["user"])}
end
end
Bidirectional sockets
Reinventing HTTP over WS
• error conditions
• response status
• chaching
• …⚠