Architecture Over FrameworkRethink Your App Structure
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
!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?
!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?
Looking Ahead
Why do this ?
Case Study: Discourse
Looking Ahead
Why do this ? Case Study: Discourse
Why do this ?
Clear Intent
Better Understanding
Why do this ?
Clear Intent Better Understanding
Architecture
Elements of a system
and their relationship
with each other
Architecture
Designed such that
intent is apparent and
palpable
FrameworkAn abstraction you
build upon, to provide
app specific software
This picture screams RAILS!
–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
Why do this ?
Clear Intent
Better Understanding
Debugging
bad code:
Frustration
Debugging
good code:
Enlightenment
Debugging
good code:
Learning
Looking Ahead
Why do this?
Case Study: Discourse
That’s not a lot, but
if you are new to
the project, then …
http://media0.giphy.com/media/KE9cblgPK6EPS/200_s.gif
File lookups are
fixed by managing
load path
Const lookups are
fixed by managing
auto-load path
config/application.rb
http://38.media.tumblr.com/tumblr_maeu8e5wuj1rxmai6o1_500.gif
First real limitation:
namespace based
look ups
application_controller
Second limitation:
unfriendly helper
customisation
Second limitation:
unfriendly <foo>
customisation
action_controller/helpers
config/helper_railtie
Looking BackFile structure (Load Path)
Const lookups (Auto Loads)
View Paths (Namespacing)
Helper Paths (Railties)
Rearrange tests
Rearrange assets
Custom Rake tasks
Possibilities
Muddle with Metal
Build your Rackware
Examine pre-forking
Possibilities