Thinking SmallBig things, small packages, yadda yaddaBen Scofield / @bscofieldRubyNation / 2 April 2011
Specialization
Resource Usage
Big vs. Small
Hey, That’s me!
THIS VPS rockS!
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
MONOLITH          ADMIN       SEARCH   PAYMENTS            API       PUBLIC     DATA          REPORTS      HELP    CACHING...
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
Like, WHOA
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Hmmmm.
M1ADMIN  APIREPORTS
M1ADMIN  APIREPORTS    Ow, Quit It!
Ow, Quit It! M1                 M2ADMIN              SEARCH  API              PUBLICREPORTS             HELP    Ow, Quit It!
Ow, Quit It! M1                 M2                    M3ADMIN              SEARCH             PAYMENTS  API              P...
Shared Hosting,   AIYEEEE!
ADMIN
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Lame! Anyother reasonS?
Bye now!
Smaller Is Better
(bear with me)
Classes
Small classes are easier to:designbuildtestdebugreplacereuseunderstand
SOLID
SOLIDSingle Responsibility Principle
SOLID   Interface Segregation Principle
Demeter Principle
MVC
Applications
Small apps are easier to:designbuildtestdebugscalereplacereusepurchase
Design
BDUF
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
LDUF
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Mockable
Build
Build == Start
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Ship It!
Baby Steps
Easy to Start,Easy to Finish,Motivating
red red green refactor
red green refactor
ASIDE:
$ rake test.........F............$ rake test......................
Test
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATA     APIREPORTS      HELP    CACHING
red green refactor
Debug
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATA     APIREPORTS      HELP    CACHING
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATA     APIREPORTS      HELP    CACHING
Scale
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
MONOLITH              M1ADMIN       SEARCH   PAYMENTS   DATA  API       PUBLICREPORTS      HELP    CACHING
MONOLITH                      M1ADMIN       SEARCH   PAYMENTS          DATA  API       PUBLIC                             ...
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
ADMIN     SEARCH    PAYMENTS                   DATA                    DATA                     DATA                      ...
BL                                               AT                                                 AN                    ...
or, you know, sharding and stuff
Replace
Hey, my search sucks.
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Should I write this in   ?
Reuse
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Purchase
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Thanks for bearing with me:
But I’m already doing that!
How distinct are your functions?
Tests never lie
Code changes never lie
How do we do it?
You’re already doing it!
Caching
Payments
Search
Databases
The Past
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
ADMIN     SEARCH   PAYMENTS  API     PUBLIC     DATAREPORTS    HELP    CACHING
Integration Tests
Isolate
Hey, my search sucks.
MONOLITHADMIN       SEARCH   PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
SEARCH
# in the applicationArticle.where([title LIKE ?, q])Article.where([tag_list LIKE ? OR title LIKE ?, q, q])# ...
# in the applicationArticle.search(q)Article.search(query, :include => [:tags])# article.rbclass Article < ActiveRecord::B...
Integration Tests: pass
Replace
# Gemfilegem texticle# article.rbclass Article < ActiveRecord::Base  index title do    title  end index full do   title   ...
Integration Tests: pass
SEARCH          MONOLITHADMIN                PAYMENTS  API       PUBLIC     DATAREPORTS      HELP    CACHING
Repeat!
THE FUTURE
Integration Tests
Plan for Modularity
Look for Opportunities
UG             PL         T    AN  ATBL
API-Driven Design
API-Driven Design
HTTP and REST
Discoverability
API
ADMIN      updates                 schemaPUT / POST / DELETE           what is editable?                      DATA
SEARCH metadata / data what should we index? DATA
queryPUBLIC             SEARCH         results                    metadata / data                    what should we index?...
queryPUBLIC             SEARCH         results                    metadata / data                    what should we index?...
Mountable Apps
Think Small
Smaller Is Worse?
M1ADMIN  APIREPORTS
M1ADMIN  APIREPORTS             Ow! ...        Hey, that wasn’t             so bad
M1ADMIN  APIREPORTS             Ow! ...        Hey, that wasn’t             so bad
Latency
Reliability
Ben Scofield / @bscofieldhttp://spkr8.com/t/7028http://benscofield.com
THANKS!     Ben Scofield / @bscofield     http://spkr8.com/t/7028     http://benscofield.com
Thinking Small
Thinking Small
Thinking Small
Thinking Small
Thinking Small
Thinking Small
Thinking Small
Thinking Small
Upcoming SlideShare
Loading in...5
×

Thinking Small

2,601

Published on

A defense of building small, focused, and interconnected apps instead of monolithic apps.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,601
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Thinking Small"

  1. 1. Thinking SmallBig things, small packages, yadda yaddaBen Scofield / @bscofieldRubyNation / 2 April 2011
  2. 2. Specialization
  3. 3. Resource Usage
  4. 4. Big vs. Small
  5. 5. Hey, That’s me!
  6. 6. THIS VPS rockS!
  7. 7. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  8. 8. MONOLITH ADMIN SEARCH PAYMENTS API PUBLIC DATA REPORTS HELP CACHINGTWITTER
  9. 9. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  10. 10. Like, WHOA
  11. 11. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  12. 12. Hmmmm.
  13. 13. M1ADMIN APIREPORTS
  14. 14. M1ADMIN APIREPORTS Ow, Quit It!
  15. 15. Ow, Quit It! M1 M2ADMIN SEARCH API PUBLICREPORTS HELP Ow, Quit It!
  16. 16. Ow, Quit It! M1 M2 M3ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING Ow, Quit It! Ow, Quit It!
  17. 17. Shared Hosting, AIYEEEE!
  18. 18. ADMIN
  19. 19. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  20. 20. Lame! Anyother reasonS?
  21. 21. Bye now!
  22. 22. Smaller Is Better
  23. 23. (bear with me)
  24. 24. Classes
  25. 25. Small classes are easier to:designbuildtestdebugreplacereuseunderstand
  26. 26. SOLID
  27. 27. SOLIDSingle Responsibility Principle
  28. 28. SOLID Interface Segregation Principle
  29. 29. Demeter Principle
  30. 30. MVC
  31. 31. Applications
  32. 32. Small apps are easier to:designbuildtestdebugscalereplacereusepurchase
  33. 33. Design
  34. 34. BDUF
  35. 35. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  36. 36. LDUF
  37. 37. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  38. 38. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  39. 39. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  40. 40. Mockable
  41. 41. Build
  42. 42. Build == Start
  43. 43. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  44. 44. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  45. 45. Ship It!
  46. 46. Baby Steps
  47. 47. Easy to Start,Easy to Finish,Motivating
  48. 48. red red green refactor
  49. 49. red green refactor
  50. 50. ASIDE:
  51. 51. $ rake test.........F............$ rake test......................
  52. 52. Test
  53. 53. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATA APIREPORTS HELP CACHING
  54. 54. red green refactor
  55. 55. Debug
  56. 56. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATA APIREPORTS HELP CACHING
  57. 57. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATA APIREPORTS HELP CACHING
  58. 58. Scale
  59. 59. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  60. 60. MONOLITH M1ADMIN SEARCH PAYMENTS DATA API PUBLICREPORTS HELP CACHING
  61. 61. MONOLITH M1ADMIN SEARCH PAYMENTS DATA API PUBLIC Ow, Quit It!REPORTS HELP CACHING
  62. 62. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  63. 63. ADMIN SEARCH PAYMENTS DATA DATA DATA DATA API PUBLIC DATA DATAREPORTS HELP CACHING
  64. 64. BL AT AN T PL UG$ heroku addons:upgrade shared-database:20gb
  65. 65. or, you know, sharding and stuff
  66. 66. Replace
  67. 67. Hey, my search sucks.
  68. 68. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  69. 69. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  70. 70. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  71. 71. Should I write this in ?
  72. 72. Reuse
  73. 73. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  74. 74. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  75. 75. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  76. 76. Purchase
  77. 77. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  78. 78. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  79. 79. Thanks for bearing with me:
  80. 80. But I’m already doing that!
  81. 81. How distinct are your functions?
  82. 82. Tests never lie
  83. 83. Code changes never lie
  84. 84. How do we do it?
  85. 85. You’re already doing it!
  86. 86. Caching
  87. 87. Payments
  88. 88. Search
  89. 89. Databases
  90. 90. The Past
  91. 91. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  92. 92. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  93. 93. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  94. 94. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  95. 95. ADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  96. 96. Integration Tests
  97. 97. Isolate
  98. 98. Hey, my search sucks.
  99. 99. MONOLITHADMIN SEARCH PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  100. 100. SEARCH
  101. 101. # in the applicationArticle.where([title LIKE ?, q])Article.where([tag_list LIKE ? OR title LIKE ?, q, q])# ...
  102. 102. # in the applicationArticle.search(q)Article.search(query, :include => [:tags])# article.rbclass Article < ActiveRecord::Base def self.search(query, options = {}) if options.empty? where([title LIKE ?, query]) else # ... end endend
  103. 103. Integration Tests: pass
  104. 104. Replace
  105. 105. # Gemfilegem texticle# article.rbclass Article < ActiveRecord::Base index title do title end index full do title tag_list end def self.search(query, options = {}) if options.empty? search_title(query) else # ... end endend
  106. 106. Integration Tests: pass
  107. 107. SEARCH MONOLITHADMIN PAYMENTS API PUBLIC DATAREPORTS HELP CACHING
  108. 108. Repeat!
  109. 109. THE FUTURE
  110. 110. Integration Tests
  111. 111. Plan for Modularity
  112. 112. Look for Opportunities
  113. 113. UG PL T AN ATBL
  114. 114. API-Driven Design
  115. 115. API-Driven Design
  116. 116. HTTP and REST
  117. 117. Discoverability
  118. 118. API
  119. 119. ADMIN updates schemaPUT / POST / DELETE what is editable? DATA
  120. 120. SEARCH metadata / data what should we index? DATA
  121. 121. queryPUBLIC SEARCH results metadata / data what should we index? DATA
  122. 122. queryPUBLIC SEARCH results metadata / data what should we index? DATA
  123. 123. Mountable Apps
  124. 124. Think Small
  125. 125. Smaller Is Worse?
  126. 126. M1ADMIN APIREPORTS
  127. 127. M1ADMIN APIREPORTS Ow! ... Hey, that wasn’t so bad
  128. 128. M1ADMIN APIREPORTS Ow! ... Hey, that wasn’t so bad
  129. 129. Latency
  130. 130. Reliability
  131. 131. Ben Scofield / @bscofieldhttp://spkr8.com/t/7028http://benscofield.com
  132. 132. THANKS! Ben Scofield / @bscofield http://spkr8.com/t/7028 http://benscofield.com

×