Slide 1

Slide 1 text

Architecture Over Framework Rethink Your App Structure

Slide 2

Slide 2 text

Tweet@_swanand GitHub@swanandp StackOverflow@18678 Build { Simplero } [email protected] Ruby, Clojure, Lisp, Rails, Android, Emacs, TextMate, RubyMine, Minitest, MySQL, Zsh, Curl, Gmail, Hadoop, Mavericks, Solarized, Retina-MBP, Nexus 5 Oscar Wilde, Robert Jordan, J K Rowling, Quentin Tarantino, Chris Nolan, Leonardo DiCaprio, Charlize Theron, Metallica, Dream Theatre, Pink Floyd

Slide 3

Slide 3 text

! if magic_code puts "I am in IF block" else puts "In ELSE block I am" end ! => I am in IF block => In ELSE block I am how?

Slide 4

Slide 4 text

! if fork puts "I am in IF block" else puts "In ELSE block I am" end ! => I am in IF block => In ELSE block I am how?

Slide 5

Slide 5 text

Looking Ahead Why do this ? Case Study: Discourse

Slide 6

Slide 6 text

Looking Ahead Why do this ? Case Study: Discourse

Slide 7

Slide 7 text

Why do this ? Clear Intent Better Understanding

Slide 8

Slide 8 text

Why do this ? Clear Intent Better Understanding

Slide 9

Slide 9 text

Architecture Elements of a system and their relationship with each other

Slide 10

Slide 10 text

Architecture Designed such that intent is apparent and palpable

Slide 11

Slide 11 text

Framework An abstraction you build upon, to provide app specific software

Slide 12

Slide 12 text

This picture screams RAILS!

Slide 13

Slide 13 text

–Robert Martin “This is good for DHH; but not So good for you.” http://www.confreaks.com/videos/759-rubymidwest2011-keynote-architecture-the-lost-years

Slide 14

Slide 14 text

Why do this ? Clear Intent Better Understanding

Slide 15

Slide 15 text

Debugging bad code: Frustration

Slide 16

Slide 16 text

Debugging good code: Enlightenment

Slide 17

Slide 17 text

Debugging good code: Learning

Slide 18

Slide 18 text

Looking Ahead Why do this? Case Study: Discourse

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

That’s not a lot, but if you are new to the project, then …

Slide 22

Slide 22 text

http://media0.giphy.com/media/KE9cblgPK6EPS/200_s.gif

Slide 23

Slide 23 text

Before

Slide 24

Slide 24 text

After

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

File lookups are fixed by managing load path

Slide 28

Slide 28 text

Const lookups are fixed by managing auto-load path

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

config/application.rb

Slide 31

Slide 31 text

$ rails console

Slide 32

Slide 32 text

$ rails console

Slide 33

Slide 33 text

http://38.media.tumblr.com/tumblr_maeu8e5wuj1rxmai6o1_500.gif

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

First real limitation: namespace based look ups

Slide 36

Slide 36 text

application_controller

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

Second limitation: unfriendly helper customisation

Slide 39

Slide 39 text

Second limitation: unfriendly customisation

Slide 40

Slide 40 text

action_controller/helpers

Slide 41

Slide 41 text

rails/railtie

Slide 42

Slide 42 text

config/helper_railtie

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Looking Back File structure (Load Path) Const lookups (Auto Loads) View Paths (Namespacing) Helper Paths (Railties)

Slide 45

Slide 45 text

Rearrange tests Rearrange assets Custom Rake tasks Possibilities

Slide 46

Slide 46 text

Muddle with Metal Build your Rackware Examine pre-forking Possibilities

Slide 47

Slide 47 text

Thank you!

Slide 48

Slide 48 text

Questions?