8. ● Post quotes
● View quotes (latest / best)
● Vote for quotes (like / dislike)
● Email subscription to new quotes
Features
9. Old Quote Pad
● Written in 2012 by iOS developer in order to learn Ruby on Rails
● Rails 3.2.6
● SQLite in production ¯_(ツ)_/¯
● Email/password authentication using Devise gem
● Non-responsive UI
● No moderation functionality
● No admin area/dashboard
10. New Quote Pad
● Elixir/Phoenix
● Authentication via Google Apps / G Suite / whatever they name it tomorrow
● Amazon RDS / PostgreSQL
● UI facelift, make it responsive
● Moderation, admin. dashboard, blah-blah-blah...
● Migrate data/content
27. ● Do Elixir stuff non-Elixir way
● Do Phoenix stuff Rails-way
● Tend to OOP
● Erlang OTP gives you a lot out of the box, keep it in mind
● On the other hand, there are not that many
production-ready packages yet (like RubyGems)
Pitfalls
28. Do Elixir stuff non-Elixir way
Non-Elixir:
list = Enum.map(1..100_000, &(&1 * 3))
list = Enum.filter(list, odd?)
list = Enum.sum(list)
Elixir:
list =
1..100_000
|> Enum.map(&(&1 * 3))
|> Enum.filter(odd?)
|> Enum.sum
29. Elixir:
def sum_list([head | tail], acc) do
sum_list(tail, head + acc)
end
def sum_list([], acc) do
acc
end
Non-Elixir:
sum = 0;
for (i=0; i<sizeof(array); i++)
sum += array[i]
Do Elixir stuff non-Elixir way
30. Do Phoenix stuff kind of Rails-way
defmodule User do
schema "users" do
# ...
field :quote_count, :integer, virtual: true
end
# ...
end
# …
def list_users(user, params) do
page = User |> Repo.paginate(params)
# Don't do this ;)
%{page | entries: Enum.map(page,
fn u -> %User{u | quote_count: Quotes.user_quote_count(u)} end)}
end
47. ● t2.micro (1 GB RAM) fails to build Erlang from source:
virtual memory exhausted
● it takes sooooo long to build Erlang from source…
Deployment pitfalls