Lotus

76aa5b311fb40fdc2bb70c0282d66af3?s=47 Luca Guidi
October 14, 2014

 Lotus

Lotus: a complete web framework for Ruby.

76aa5b311fb40fdc2bb70c0282d66af3?s=128

Luca Guidi

October 14, 2014
Tweet

Transcript

  1. Lotus A c o mp l e t e web

    framework @jodosha / #lotusrb
  2. None
  3. Do we need yet another web framework?

  4. Are you reinventing the wheel?

  5. What if we never reinvented the wheel?

  6. The wheel

  7. None
  8. We reinvented the wheel after observing it

  9. Complexity should be managed, not hidden.

  10. Why does this matter?

  11. The ultimate goal is…

  12. Money https://flic.kr/p/aFAEHR

  13. Use case: http://bit.ly/github-rails-upgrade

  14. We should not trade control for convenience.

  15. Cost of maintenance 0 20 40 60 80 Years 0

    1 2 3 Covenience Simplicity
  16. Silver bullets are a lie.

  17. Philosophy

  18. Standalone frameworks

  19. Full stack applications

  20. Few conventions More objects No monkey- patching

  21. Few conventions More objects No monkey- patching

  22. Few conventions More objects No monkey- patching

  23. Simple

  24. Simplicity is achieved by removing what isn’t essential

  25. Coffee https://flic.kr/p/6rX8pn

  26. Convenient https://flic.kr/p/93Bk4K

  27. Simple https://flic.kr/p/mn57Zm

  28. The output https://flic.kr/p/9oG93w

  29. Lotus doesn’t enable optional features by default

  30. We perceive as simple the things we are familiar with

  31. BookRepository.find 23

  32. Rails.application.routes.draw do get '/' => 'home#index', as: :home resources :books

    end ! Rails.application.routes # => ???
  33. router = Lotus::Router.new do get '/', to: 'home#index', as: :home

    resources :books end ! router.path(:home) # => '/' router.call(env) # Rack env run router # in config.ru
  34. Fast

  35. Micro benchmarks http://bit.ly/lotus-micro-bench

  36. HTTP benchmarks http://bit.ly/lotus-http-bench

  37. Rails 1027.73 Sinatra 2207.73 Lotus 4175.90 http://bit.ly/lotus-http-bench req/s

  38. Rails 1027.73 Sinatra 2207.73 Lotus 4175.90 http://bit.ly/lotus-http-bench req/s

  39. Rails 1027.73 Sinatra 2207.73 Lotus 4175.90 http://bit.ly/lotus-http-bench req/s

  40. Testable

  41. Testability is a virtue

  42. There is no “test-damaged” design

  43. class Show include Lotus::Action ! expose :book ! def initialize(repository

    = BooksRepository) @repository = repository end ! def call(params) @book = @repository.find params[:id] end end
  44. book = Object.new repository = Minitest::Mock.new repository.expect(:find, book, [Integer]) !

    action = Show.new(repository) action.call(id: 23) # => [200, {}, nil] ! repository.verify action.book.must_equal book # assigns(:book) isn’t needed
  45. Demo

  46. The future

  47. Get involved

  48. lotusrb.org #lotusrb @jodosha

  49. Q&A

  50. Thank you!