1 of 33

Architecting for the lazy

2 of 33

Preston Sego

NullVoxPopuli

3 of 33

4 of 33

5 of 33

6 of 33

7 of 33

8 of 33

9 of 33

Architecting for the lazy

10 of 33

The story of every app ever

11 of 33

The story of every app ever

"The Plan"

> Customer Demands

> Investor Demands

> Marketing / Sales shenanigans

12 of 33

Inevitable Scope Creep and Technical Debt

  • Do things the 'standard' way, to try to not create technical debt
  • Don't want to go outside of the rails convention
    • Rails way is a simple way
    • Anyone knowing rails can just pick up any project.**
    • Goal: Fast development
    • No thinking about the architecture
  • Somehow your app still grows to be a beast

13 of 33

Inline Javascript

Inline Styles

Duplicate Code

Overly coupled code

Spaghetti Code

Copy Paste

14 of 33

is my app too big and hard to maintain?

15 of 33

Yes

16 of 33

Discoverability is low

17 of 33

Why does this happen?

18 of 33

Rails (partially)

19 of 33

20 of 33

Fear of changing the defaults

21 of 33

Options

22 of 33

"Services"

23 of 33

Service is semantically incorrect

24 of 33

"Services"

25 of 33

Trailblazer

26 of 33

Rewrite :-(

27 of 33

Intermediary Solution

28 of 33

Drawers

29 of 33

app/�├── channels/�├── models/�│ ├── data/�│ │ ├── post.rb�│ │ └── comment.rb�│ └── graph_data.rb�├── jobs/�├── mailers/�│ └── notification_mailer.rb�└── resources/� ├── posts/� │ ├── forms/� │ │ └── new_post_form.rb� │ ├── controller.rb # or posts_controller.rb� │ ├── operations.rb # or post_operations.rb� │ ├── policy.rb # or post_policy.rb� │ └── serializer.rb # or post_serializer.rb� └── comments/� ├── controller.rb� ├── serializer.rb� └── views/� ├── index.html.erb� └── create.html.erb

30 of 33

31 of 33

32 of 33

Similar Ideas

  • Ember: https://github.com/dgeb/rfcs/blob/module-unification/text/0000-module-unification.md
  • Redux: http://jaysoo.ca/2016/02/28/organizing-redux-application/
  • Robert C Martin: https://www.youtube.com/watch?v=WpkDN78P884 RubyConf 2011 "Boundaries"

33 of 33

Questions?