Slide 1

Slide 1 text

Lotus A c o mp l e t e web framework @jodosha / #lotusrb

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Do we need yet another web framework?

Slide 4

Slide 4 text

Are you reinventing the wheel?

Slide 5

Slide 5 text

What if we never reinvented the wheel?

Slide 6

Slide 6 text

The wheel

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

We reinvented the wheel after observing it

Slide 9

Slide 9 text

Complexity should be managed, not hidden.

Slide 10

Slide 10 text

Why does this matter?

Slide 11

Slide 11 text

The ultimate goal is…

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

We should not trade control for convenience.

Slide 15

Slide 15 text

Cost of maintenance 0 20 40 60 80 Years 0 1 2 3 Covenience Simplicity

Slide 16

Slide 16 text

Silver bullets are a lie.

Slide 17

Slide 17 text

Philosophy

Slide 18

Slide 18 text

Standalone frameworks

Slide 19

Slide 19 text

Full stack applications

Slide 20

Slide 20 text

Few conventions More objects No monkey- patching

Slide 21

Slide 21 text

Few conventions More objects No monkey- patching

Slide 22

Slide 22 text

Few conventions More objects No monkey- patching

Slide 23

Slide 23 text

Simple

Slide 24

Slide 24 text

Simplicity is achieved by removing what isn’t essential

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

Lotus doesn’t enable optional features by default

Slide 30

Slide 30 text

We perceive as simple the things we are familiar with

Slide 31

Slide 31 text

BookRepository.find 23

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

Fast

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

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

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

Testable

Slide 41

Slide 41 text

Testability is a virtue

Slide 42

Slide 42 text

There is no “test-damaged” design

Slide 43

Slide 43 text

class Show include Lotus::Action ! expose :book ! def initialize(repository = BooksRepository) @repository = repository end ! def call(params) @book = @repository.find params[:id] end end

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

Demo

Slide 46

Slide 46 text

The future

Slide 47

Slide 47 text

Get involved

Slide 48

Slide 48 text

lotusrb.org #lotusrb @jodosha

Slide 49

Slide 49 text

Q&A

Slide 50

Slide 50 text

Thank you!