Your SlideShare is downloading. ×
0
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
A Blink Into The Rails Magic
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

A Blink Into The Rails Magic

1,091

Published on

My presentation at Athens Digital Week '09

My presentation at Athens Digital Week '09

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
1,091
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. A blink into the “rails magic”<br />The meta-programming in Rails / Rails as a code generator<br />
  • 2. Some rights reserved<br />Nikos Dimitrakopoulos, 2009<br />http://blog.nikosd.com<br />
  • 3. The “classic” rails ingredients<br />MVC<br />DRY<br />COC<br />…<br />
  • 4. Not for today…<br />MVC<br />DRY<br />COC<br />…<br />
  • 5. Rails as a code generator<br />
  • 6. PART I : 100% Static<br />
  • 7. The directory structure<br />
  • 8. Models + Tests<br />
  • 9. Controllers / views + tests<br />
  • 10. Resources (the whole set)<br />
  • 11. Even with *implemented* views & controllers (a.k.a. “scaffolds”)<br />
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Static(*) API<br />
  • 18.
  • 19.
  • 20. Nothing special so far…<br />
  • 21. PART II : 100% On-the-fly<br />
  • 22. This is where the actual fun begins!<br />
  • 23. Some basic stuff: ORM<br />
  • 24.
  • 25.
  • 26.
  • 27. How does Rails map the attributes???<br />
  • 28.
  • 29.
  • 30. The truth is in the source…<br />
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. A blink into the “magic”<br />
  • 37.
  • 38. if we haven’t already generated the “dynamic” methods<br />
  • 39. if we haven’t already generated the “dynamic” methods<br /><ul><li> generate them</li></li></ul><li>if we haven’t already generated the “dynamic” methods<br /><ul><li> generate them
  • 40. try to call the method with the given name again!</li></li></ul><li>
  • 41.
  • 42. for each column on the db table :<br />
  • 43. for each column on the db table :<br /><ul><li> define a “read” method</li></li></ul><li>for each column on the db table :<br /><ul><li> define a “read” method </li></ul>(for example the Guest#name)<br />
  • 44. for each column on the db table :<br /><ul><li> define a “read” method</li></ul>(for example the Guest#name)<br /><ul><li> define a “write” method</li></li></ul><li>for each column on the db table :<br /><ul><li> define a “read” method</li></ul>(for example the Guest#name)<br /><ul><li> define a “write” method</li></ul>(for example the Guest#name = …)<br />
  • 45. for each column on the db table :<br /><ul><li> define a “read” method</li></ul>(for example the Guest#name)<br /><ul><li> define a “write” method</li></ul>(for example the Guest#name = …)<br /><ul><li> define a “question” method</li></li></ul><li>for each column on the db table :<br /><ul><li> define a “read” method</li></ul>(for example the Guest#name)<br /><ul><li> define a “write” method</li></ul>(for example the Guest#name = …)<br /><ul><li> define a “question” method</li></ul>(for example the Guest#name?)<br />
  • 46.
  • 47. PART III : Magic happens Everywhere<br />
  • 48. On the routes / Controllers<br />
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55. + 3 more by default<br />
  • 56. + 3 more by default<br />More info on “resources” : <br />http://api.rubyonrails.org/classes/ActionController/Resources.html<br />
  • 57. On the ORM / Models<br />
  • 58. Dynamic finders<br />
  • 59. Dynamic finders<br />
  • 60. As said this is just a “blink”<br />
  • 61. Look for more in :<br /><ul><li>ActiveRecordassociations
  • 62. ActiveRecordnamed_scopes
  • 63. ActionControllerroutes
  • 64. ActionControllerrendering
  • 65. ActionControllerformat
  • 66. etc…</li></li></ul><li>What do we get from this?<br />
  • 67. What do we get from this?<br /><ul><li>Glue code</li></li></ul><li>What do we get from this?<br /><ul><li>Glue code
  • 68. Domain-aware code</li></li></ul><li>What do we get from this?<br /><ul><li>Glue code
  • 69. Domain-aware code
  • 70. Out of the box</li></li></ul><li>What do we get from this?<br /><ul><li>Glue code
  • 71. Domain-aware code
  • 72. Out of the box
  • 73. Every time</li></li></ul><li>What do we get from this?<br /><ul><li>Glue code
  • 74. Domain-aware code
  • 75. Out of the box
  • 76. Every time
  • 77. On every app</li></li></ul><li>Compare it with Java or .Net “enterprise” solutions…<br />
  • 78. Compare it with Java or .Net “enterprise” solutions…<br />© Rubyrags.com<br />
  • 79. Implement your own!!!<br />
  • 80. Implement your own!!!<br />(Jim will give you a hint tomorrow at the Ruby Meetup)<br />
  • 81. Thanks for your time<br />
  • 82. Thanks for your time<br />And welcome <br />to themagic world of <br />Rubyand Ruby on Rails<br />

×