Successfully reported this slideshow.

Rails is Easy*

533 views

Published on

Rails is Easy*

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Rails is Easy*

  1. 1. Rails is Easy
  2. 2. Rails is Easy *
  3. 3. Rails is Easy * * for experienced web developers
  4. 4. The Rails Code Camp is not for complete beginners, each participant must have at least some programming background and familiarity with model-view-controller architecture.
  5. 5. The Rails Code Camp is not for complete beginners, each participant must have at least some programming background and familiarity with model-view-controller architecture. We aren't joking.
  6. 6. And yeah, you'll probably be screwed if you also lied about installing Rails 4.0.
  7. 7. We need you to focus in the next 2 hours.
  8. 8. Rails is Easy *
  9. 9. History Lesson
  10. 10. 2006 – 2009 Rise of Rails
  11. 11. 2006 – 2009 Consumer Enterprise
  12. 12. 2006 – 2009
  13. 13. Exodus
  14. 14. Graduation
  15. 15. 2006 – 2009 Consumer Enterprise
  16. 16. 2006 Easy to Write ● Easy to Deploy ●
  17. 17. 2006 Easy to Write WRONG ● Easy to Deploy WRONG ●
  18. 18. ● Templating Language?
  19. 19. Templating Language? ● Programming Language? ●
  20. 20. Templating Language? ● Programming Language? ● Web Interface? ●
  21. 21. 2006 Easy to Write WRONG and programmers were writing wrong: No structure ● Single pages doing many things ● etc. ●
  22. 22. Common Layers in an Information System Logical Architecture http://en.wikipedia.org/wiki/Common_layers_in_an_information_system_logical_architecture Presentation Layer Application Layer Business Layer Infrastructure Layer
  23. 23. 2006 Presentation Layer? Application Layer? Business Layer? Infrastructure Layer?
  24. 24. 2006
  25. 25. All the patterns in the world...
  26. 26. 2006 Easy to Write WRONG and programmers were writing wrong: No structure ● Single pages doing many things ● etc. ●
  27. 27. 2006 ● With structure ● Modular ● etc.
  28. 28. 2006 With structure ● Modular ● etc. ● Too Complicated ●
  29. 29. XML Everywhere!
  30. 30. 2006 ● With structure ● Modular ● etc.
  31. 31. 2006 With structure ● Modular ● etc. ● Reasonably Complicated ●
  32. 32. Best Practices and Conventions
  33. 33. Best Practices and Conventions
  34. 34. Web Application Structure web server app server
  35. 35. Web Application Structure
  36. 36. Web Application Structure
  37. 37. MVC Web App Structure
  38. 38. MVC Model 2 Structure
  39. 39. MVC Web App Structure web server app server
  40. 40. MVC Web App Structure app server
  41. 41. MVC Web App Structure Controller
  42. 42. MVC Web App Structure Controller Model
  43. 43. MVC Web App Structure Controller Model
  44. 44. MVC Web App Structure Controller View Model
  45. 45. MVC Web App Structure Controller View Model
  46. 46. MVC Web App Structure Controller View Model
  47. 47. MVC Web App Structure Router View Controller Model
  48. 48. MVC Web App Structure Router View Controller Model
  49. 49. MVC Web App Structure Router View Controller Model
  50. 50. MVC Web App Structure Router View Controller Model
  51. 51. MVC Web App Structure Router Controller /public/ View Model
  52. 52. MVC Web App Structure Router Controller /public/ View Model /db/ /config/ database.yml
  53. 53. MVC Web App Structure /config/routes.rb Router Controller /public/ View Model /db/ /config/ database.yml
  54. 54. MVC Web App Structure /config/routes.rb Router Controller /app/controllers/ /public/ View Model /db/ /config/ database.yml
  55. 55. MVC Web App Structure /config/routes.rb Router Controller /app/controllers/ /public/ View Model /app/models/ /db/ /config/ database.yml
  56. 56. MVC Web App Structure /config/routes.rb Router Controller /app/controllers/ /public/ View Model /app/views/ /app/models/ /db/ /config/ database.yml
  57. 57. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  58. 58. 2013
  59. 59. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  60. 60. 2013
  61. 61. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  62. 62. Rote Memorization Time!
  63. 63. Getting Started with Rails 4 http://edgeguides.rubyonrails.org/getting_started.html
  64. 64. Hello Rails!
  65. 65. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  66. 66. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  67. 67. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  68. 68. controller#action class#method
  69. 69. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  70. 70. Getting Up and Running
  71. 71. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  72. 72. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  73. 73. Representational State Transfer (REST) Prefix Verb posts GET POST new_post GET edit_post GET post GET PATCH PUT DELETE URI Pattern /posts(.:format) /posts(.:format) /posts/new(.:format) /posts/:id/edit(.:format) /posts/:id(.:format) /posts/:id(.:format) /posts/:id(.:format) /posts/:id(.:format) Controller#Action posts#index posts#create posts#new posts#edit posts#show posts#update posts#update posts#destroy
  74. 74. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  75. 75. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  76. 76. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/migrate/ /public/ View Controller Model
  77. 77. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/migrate/ /public/ View Controller Model
  78. 78. ActiveRecord models have, by default, a integer primary key "id" and two timestamps "created_at" and "updated_at". All three are automatically managed by ActiveRecord.
  79. 79. Show
  80. 80. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  81. 81. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  82. 82. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  83. 83. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  84. 84. When a controller renders a view, all instance variables (e.g. @foo) are cloned inside the view
  85. 85. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  86. 86. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  87. 87. Validation
  88. 88. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  89. 89. Updating
  90. 90. Partials
  91. 91. MVC Web App Structure Router /app/controllers/ /app/models/ /app/views/ /config/routes.rb /config/database.yml /db/ /public/ View Controller Model
  92. 92. Deleting
  93. 93. Congratulations!
  94. 94. Congratulations! We've barely scratched the surface of Rails.
  95. 95. Congratulations! Normally this takes 2 days to understand
  96. 96. Congratulations! Normally this takes 2 days to understand, even more if self-study
  97. 97. What we haven't covered:
  98. 98. What we haven't covered: ● Associations - table joins made simple
  99. 99. What we haven't covered: ● Associations - table joins made simple(?)
  100. 100. What we haven't covered: ● Associations - table joins made simple(?) ● Gems - plugins, libraries, and Bundler
  101. 101. What we haven't covered: Associations - table joins made simple(?) ● Gems - plugins, libraries, and Bundler ● Testing - code that tells you what's broken ●
  102. 102. What we haven't covered: Associations - table joins made simple(?) ● Gems - plugins, libraries, and Bundler ● Testing - code that tells you what's broken ● Asset Pipeline - serve compressed and up-todate assets in production ●
  103. 103. What we haven't covered: Associations - table joins made simple(?) ● Gems - plugins, libraries, and Bundler ● Testing - code that tells you what's broken ● Asset Pipeline - serve compressed and up-todate assets in production ● Deployment - deploy with only one command ●
  104. 104. What we haven't covered: Associations - table joins made simple(?) ● Gems - plugins, libraries, and Bundler ● Testing - code that tells you what's broken ● Asset Pipeline - serve compressed and up-todate assets in production ● Deployment - deploy with only one command ● Ruby itself!!! ●
  105. 105. What we haven't covered: Associations - table joins made simple(?) ● Gems - plugins, libraries, and Bundler ● Testing - code that tells you what's broken ● Asset Pipeline - serve compressed and up-todate assets in production ● Deployment - deploy with only one command ● Ruby itself!!! ● and so on... ●
  106. 106. What we haven't covered: Rails Culture
  107. 107. Rails Culture
  108. 108. Rails Culture ● The personalities
  109. 109. Rails Culture The personalities ● Our attitude towards code ●
  110. 110. Rails Culture The personalities ● Our attitude towards code ● Our attitude towards work ●
  111. 111. Rails Culture The personalities ● Our attitude towards code ● Our attitude towards work ● How the hell does a "slow" framework that doesn't work well on Windows get such a high market demand for developers?!?! ●
  112. 112. Cheat Sheets: http://pragtob.github.io/rails-beginner-cheatsheet/ http://apidock.com

×