Lotus For Rails Developers

76aa5b311fb40fdc2bb70c0282d66af3?s=47 Luca Guidi
November 05, 2015

Lotus For Rails Developers

76aa5b311fb40fdc2bb70c0282d66af3?s=128

Luca Guidi

November 05, 2015
Tweet

Transcript

  1. Lotus For Rails Developers @jodosha / #lotusrb

  2. Indie OSS dev & Freelancer

  3. Why Lotus?

  4. Lotus Philosophy

  5. Lightweight

  6. Features • Thread-safety • Full featured HTTP router • RESTful

    resources • Actions and views as objects • Actions callbacks • Code sharing • Exception handling • Sessions • Secure Cookies • HTTP Caching • Automatic MIME Types • 20+ Template engines • Partials and layouts • Presenters • Routing helpers • Form helpers • HTML helpers • Automatic markup escape • CSRF and XSS prevention • Force SSL • Entities • Repositories • Data Mapper • SQL and Memory adapters • Dirty Tracking • Reusable validations • Mailers • Multiple environments • Static assets • JSON body parser • Params whitelisting and validation • Code generators • Rack servers support • Application console • Database console • Powerful CLI • Migrations • RSpec, Minitest and Capybara support • Several architectures • And more..
  7. 0 17,5 35 52,5 70 Ruby Rack Sinatra Lotus Rails

    Dependencies Memory
  8. On average, we use only a fraction of the features

    that a gem provides.
  9. Lotus depends on a few gems. You can be sure

    that all the loaded code is useful for your application.
  10. Lotus Foo Bar Baz Runtime dependency Transitive dependency

  11. For each gem that we require, we’re adding overhead to

    Ruby and Bundler.
  12. There is no faster code than no code at all.

  13. Less convenient

  14. Example: Constant Autoloading • Differences across environments • ActiveSupport’s dependencies.rb

    is ~800LOCs • lotus-controller gem is ~800LOCs • It took years to become stable • It modifies how Ruby VM loads code and features • It requires to “monkey-patch” Ruby Core
  15. Solution: Eager loading • Same behaviour across environments • It’s

    just 26LOCs • It isn’t a perfect solution • “Easy fix” via require
  16. No monkey-patching

  17. Don’t monkey-patch classes that you don’t own.

  18. Testability

  19. All the application components can be unit tested.

  20. No need to maintain lotus-rspec or lotus- minitest gems.

  21. A complete framework

  22. Lotus goes beyond “Flat-MVC” by providing a set of collaborators

    for “Full-MVC”.
  23. Lotus toolkit

  24. Full stack web apps

  25. None
  26. None
  27. Lotus has a “Modular First” approach that helps you to

    scale your code.
  28. The Monolith is good for the first 5 years, but

    then a framework should make your life easy.
  29. None
  30. Example #1

  31. None
  32. This is the name of the application under apps/

  33. None
  34. Web::Controllers::Home::Index For the app named Web we have Web::Action

  35. None
  36. None
  37. None
  38. For the app named Web we have Web::View Web::Controllers::Home::Index Web::Views::Home::Index

  39. All the “exposures” and view’s public methods are available to

    the template.
  40. None
  41. Exposure from the action

  42. None
  43. Example #2

  44. One big ERb block

  45. In order to avoid coupling with any ORM, it just

    accepts symbols.
  46. We have the routes factory to not overload the view

    context with too many methods.
  47. No need to concat these two div blocks.

  48. Params validation is optional

  49. This is the same name that we have set to

    form_for.
  50. Separation between entities and repositories.

  51. No coupling with the routing system and the ORM

  52. None
  53. None
  54. None
  55. None
  56. Useful resources

  57. http://lotusrb.org Guides and API docs

  58. http://lotusrb.org/mailing-list Subscribe to the mailing list at:

  59. http://lucaguidi.com

  60. http://lotusrb.org/hackday

  61. Q&A

  62. https://speakerdeck.com/jodosha/ lotus-for-rails-developers Slides available at:

  63. Thank you