Successfully reported this slideshow.
Your SlideShare is downloading. ×

End of-rails-wids

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad

Check these out next

1 of 52 Ad
Advertisement

More Related Content

Viewers also liked (13)

Advertisement

End of-rails-wids

  1. 1. THE END OF RAILS? @APOTONICK
  2. 2. THE ILLUSION OF STABLE APIS @APOTONICK
  3. 3. “Most Rails developers do not write object-oriented Ruby code. They write MVC-oriented Ruby code by putting models and controllers in the expected locations. It takes 2-3 years before developers realize: “Rails is just Ruby.” -- Mike Perham
  4. 4. RAILS’ OBSESSION WITH “MVC”
  5. 5. class User < ActiveRecord::Base validates :name, length: 20 validates :email, format: email validates :age, numericality: true
  6. 6. class User < ActiveRecord::Base validates :name, length: 20 validates :email, format: email validates :age, numericality: true User.create( name: “RISE!”, email: “rise@” age: 21 )
  7. 7. class User < ActiveRecord::Base validates :name, length: 20 validates :email, format: email validates :age, numericality: true
  8. 8. class User < ActiveRecord::Base validates :name, length: 20 validates :email, format: email validates :age, numericality: true
  9. 9. class User < ActiveRecord::Base validates :name, length: 20 validates :email, format: email validates :age, numericality: true User.create( name: “RISE! This user is by ADMIN!”, email: “rise@” age: 21 )
  10. 10. class User < ActiveRecord::Base validates :name, length: 20 validates :email, format: email validates :age, numericality: true User.create( name: “RISE! This user is by ADMIN!”, email: “rise@” age: 21 )
  11. 11. class User < ActiveRecord::Base validates :name, length: 20, unless: → { creator_is_admin? } validates :email, format: email validates :age, numericality: true User.create( name: “RISE! This user is by ADMIN!”, email: “rise@” age: 21 )
  12. 12. class User
  13. 13. defmodule User do use Ecto.Schema import Ecto.Changeset schema "users" do field :name field :email field :age, :integer end def changeset(user, params :empty) do user |> cast(params, ~w(name email), ~w(age)) |> validate_format(:email, ~r/@/) |> validate_inclusion(:age, 18..100) |> unique_constraint(:email) end end
  14. 14. defmodule User do use Ecto.Schema import Ecto.Changeset schema "users" do field :name field :email field :age, :integer end def changeset(user, params :empty) do user |> cast(params, ~w(name email), ~w(age)) |> validate_format(:email, ~r/@/) |> validate_inclusion(:age, 18..100) |> unique_constraint(:email) end end
  15. 15. defmodule User do use Ecto.Schema import Ecto.Changeset schema "users" do field :name field :email field :age, :integer end def changeset(user, params :empty) do user |> cast(params, ~w(name email), ~w(age)) |> validate_format(:email, ~r/@/) |> validate_inclusion(:age, 18..100) |> unique_constraint(:email) end end
  16. 16. class User
  17. 17. User User.Admin
  18. 18. class User::Create < Trailblazer::Operation model User contract do property :name property :email property :age, type: Integer validates :email, format: email validates :age, inclusion: 1..200 end def process(params) validate(params) do contract.save end end end
  19. 19. class User::Create < Trailblazer::Operation model User contract do property :name property :email property :age, type: Integer validates :email, format: email validates :age, inclusion: 1..200 end def process(params) validate(params) do contract.save end end end
  20. 20. class User::Create < Trailblazer::Operation model User contract do property :name property :email property :age, type: Integer validates :email, format: email validates :age, inclusion: 1..200 end def process(params) validate(params) do contract.save end end end
  21. 21. class User
  22. 22. User::Create User::Create::Admin
  23. 23. APIs MUST CHANGE!
  24. 24. APIs MUST CHANGE!
  25. 25. APIs MUST CHANGE!INNOVATION ==
  26. 26. @APOTONICK

×