Practical ORMs

4,297 views

Published on

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

No Downloads
Views
Total views
4,297
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
33
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Practical ORMs

  1. 1. Practical ORMs<br />Juozas“Joe”Kaziukėnas, 2010<br />
  2. 2. Who am I?<br />JuozasKaziukėnas, Lithuanian<br />You can call me Joe<br />2 years in Edinburgh, UK<br />Studying in University of Edinburgh<br />Software developer at 4c, inc. and UAB “Barzda”<br />Open source developer for Zend Framework and Doctrine<br />More info in www.juokaz.com and twitter @juokaz<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  3. 3. ORMs!!!?<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  4. 4. 5 years ago…<br />“old-style” PHP<br />SQL everywhere<br />Hard to understand<br />No migrations possible<br />Not OOP<br />At least not for database interactions<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  5. 5. 5 years ago…<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  6. 6. OOP<br />Everyone (should have) learnt it at school/university<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  7. 7. Object relational mapping<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  8. 8. Object relational mapping<br />Mapping<br />PHP objects == database rows<br />OOP all the way!<br />Database<br />Functionality<br />Features<br />Implications<br />Design<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  9. 9. Models<br />Properties<br />Behaviour<br />Business logic<br />Application layer M (from MVC)<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  10. 10. Relations<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  11. 11. Relations OOP style<br />One-to-one, many-to-one, many-to-many<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  12. 12. Querying<br />Different than SQL<br />DQL in Doctrine<br />Working with models, not tables<br />SELECT * FROM Model_Blog B WHERE B.id = 1<br />Very complicated internals<br />Database driver specific functionality<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  13. 13. Database servers<br />Works with all of them<br />I’m contributing Microsoft SQL server support to Doctrine<br />Abstracted access – migrations are possible<br />Different databases for different environments<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  14. 14. Speed<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  15. 15. Speed<br />Hydration (from SQL results to objects)<br />SQL optimization<br />Memory usage<br />Lots of classes and very complicated underlying code<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  16. 16. Other issues<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  17. 17. Other issues<br />Application architecture<br />Partitioning models<br />Lots of small classes<br />Doesn’t work for all projects<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  18. 18. Why do I need all this?<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  19. 19. Why do I need all this?<br />Faster coding<br />“Logical” application<br />Clear business logic<br />Standards<br />Not limited to databases<br />... Much more<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  20. 20. I want to try it!<br />PHP implementations:<br />Doctrine (and Doctrine 2.0)<br />Propel<br />A few more<br />Lots of people at #doctrine<br />Used in production today<br />Juozas Kaziukėnas / juozas@juokaz.com / www.juokaz.com<br />
  21. 21. Questions<br />Want to know more?<br />www.juokaz.com – my website<br />dev.juokaz.com – my blog<br />@juokaz twitter <br />Thanks!<br />

×