Top Banner
Architecture Over Framework Rethink Your App Structure
48

Architecture Over Framework: Rethink Your App Structure

Jul 16, 2015

Download

Software

Swanand Pagnis
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Architecture Over Framework: Rethink Your App Structure

Architecture Over FrameworkRethink Your App Structure

Page 2: Architecture Over Framework: Rethink 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

Page 3: Architecture Over Framework: Rethink Your App Structure

!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?

Page 4: Architecture Over Framework: Rethink Your App Structure

!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?

Page 5: Architecture Over Framework: Rethink Your App Structure

Looking Ahead

Why do this ?

Case Study: Discourse

Page 6: Architecture Over Framework: Rethink Your App Structure

Looking Ahead

Why do this ? Case Study: Discourse

Page 7: Architecture Over Framework: Rethink Your App Structure

Why do this ?

Clear Intent

Better Understanding

Page 8: Architecture Over Framework: Rethink Your App Structure

Why do this ?

Clear Intent Better Understanding

Page 9: Architecture Over Framework: Rethink Your App Structure

Architecture

Elements of a system

and their relationship

with each other

Page 10: Architecture Over Framework: Rethink Your App Structure

Architecture

Designed such that

intent is apparent and

palpable

Page 11: Architecture Over Framework: Rethink Your App Structure

FrameworkAn abstraction you

build upon, to provide

app specific software

Page 12: Architecture Over Framework: Rethink Your App Structure

This picture screams RAILS!

Page 13: Architecture Over Framework: Rethink Your App Structure

–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

Page 14: Architecture Over Framework: Rethink Your App Structure

Why do this ?

Clear Intent

Better Understanding

Page 15: Architecture Over Framework: Rethink Your App Structure

Debugging

bad code:

Frustration

Page 16: Architecture Over Framework: Rethink Your App Structure

Debugging

good code:

Enlightenment

Page 17: Architecture Over Framework: Rethink Your App Structure

Debugging

good code:

Learning

Page 18: Architecture Over Framework: Rethink Your App Structure

Looking Ahead

Why do this?

Case Study: Discourse

Page 19: Architecture Over Framework: Rethink Your App Structure
Page 20: Architecture Over Framework: Rethink Your App Structure
Page 21: Architecture Over Framework: Rethink Your App Structure

That’s not a lot, but

if you are new to

the project, then …

Page 22: Architecture Over Framework: Rethink Your App Structure

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

Page 23: Architecture Over Framework: Rethink Your App Structure

Before

Page 24: Architecture Over Framework: Rethink Your App Structure

After

Page 25: Architecture Over Framework: Rethink Your App Structure
Page 26: Architecture Over Framework: Rethink Your App Structure
Page 27: Architecture Over Framework: Rethink Your App Structure

File lookups are

fixed by managing

load path

Page 28: Architecture Over Framework: Rethink Your App Structure

Const lookups are

fixed by managing

auto-load path

Page 29: Architecture Over Framework: Rethink Your App Structure
Page 30: Architecture Over Framework: Rethink Your App Structure

config/application.rb

Page 31: Architecture Over Framework: Rethink Your App Structure

$ rails console

Page 32: Architecture Over Framework: Rethink Your App Structure

$ rails console

Page 33: Architecture Over Framework: Rethink Your App Structure

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

Page 34: Architecture Over Framework: Rethink Your App Structure
Page 35: Architecture Over Framework: Rethink Your App Structure

First real limitation:

namespace based

look ups

Page 36: Architecture Over Framework: Rethink Your App Structure

application_controller

Page 37: Architecture Over Framework: Rethink Your App Structure
Page 38: Architecture Over Framework: Rethink Your App Structure

Second limitation:

unfriendly helper

customisation

Page 39: Architecture Over Framework: Rethink Your App Structure

Second limitation:

unfriendly <foo>

customisation

Page 40: Architecture Over Framework: Rethink Your App Structure

action_controller/helpers

Page 41: Architecture Over Framework: Rethink Your App Structure

rails/railtie

Page 42: Architecture Over Framework: Rethink Your App Structure

config/helper_railtie

Page 43: Architecture Over Framework: Rethink Your App Structure
Page 44: Architecture Over Framework: Rethink Your App Structure

Looking BackFile structure (Load Path)

Const lookups (Auto Loads)

View Paths (Namespacing)

Helper Paths (Railties)

Page 45: Architecture Over Framework: Rethink Your App Structure

Rearrange tests

Rearrange assets

Custom Rake tasks

Possibilities

Page 46: Architecture Over Framework: Rethink Your App Structure

Muddle with Metal

Build your Rackware

Examine pre-forking

Possibilities

Page 47: Architecture Over Framework: Rethink Your App Structure

Thank you!

Page 48: Architecture Over Framework: Rethink Your App Structure

Questions?