SlideShare a Scribd company logo
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs
Rails and alternative ORMs

More Related Content

What's hot (20)

PPT
Zend framework 03 - singleton factory data mapper caching logging
Tricode (part of Dept)
 
ODP
Data repositories
Corneil du Plessis
 
PDF
Intro to MongoDB and datamodeling
rogerbodamer
 
DOCX
MVest Spring Job Execution
Shraddha Bora
 
PPTX
Google Dorks
Andrea D'Ubaldo
 
PPT
Digesting jQuery
Mindfire Solutions
 
PDF
wtf is in Java/JDK/wtf7?
Scott Leberknight
 
PDF
Euruko 2009 - DataObjects
Dirkjan Bussink
 
PDF
MySQL User Conference 2009: Python and MySQL
Ted Leung
 
PPTX
What's Parse
Tsutomu Ogasawara
 
PDF
Compass Framework
Lukas Vlcek
 
PDF
Scaling / optimizing search on netlog
removed_8e0e1d901e47de676f36b9b89e06dc97
 
PPT
Schema design short
MongoDB
 
PPT
Mysql DBI
Joe Christensen
 
PPTX
My_sql_with_php
Ishaq Shinwari
 
PPTX
Mongo db
Girish Talekar
 
PDF
Android datastorage
Krazy Koder
 
DOC
Quiz With Answers Drupal
Srinivasan Boominathan
 
PDF
Couchbase & FTS
Rich Lee
 
DOCX
Connectivity coding for java and mysql
Fahad Ali Khan
 
Zend framework 03 - singleton factory data mapper caching logging
Tricode (part of Dept)
 
Data repositories
Corneil du Plessis
 
Intro to MongoDB and datamodeling
rogerbodamer
 
MVest Spring Job Execution
Shraddha Bora
 
Google Dorks
Andrea D'Ubaldo
 
Digesting jQuery
Mindfire Solutions
 
wtf is in Java/JDK/wtf7?
Scott Leberknight
 
Euruko 2009 - DataObjects
Dirkjan Bussink
 
MySQL User Conference 2009: Python and MySQL
Ted Leung
 
What's Parse
Tsutomu Ogasawara
 
Compass Framework
Lukas Vlcek
 
Scaling / optimizing search on netlog
removed_8e0e1d901e47de676f36b9b89e06dc97
 
Schema design short
MongoDB
 
Mysql DBI
Joe Christensen
 
My_sql_with_php
Ishaq Shinwari
 
Mongo db
Girish Talekar
 
Android datastorage
Krazy Koder
 
Quiz With Answers Drupal
Srinivasan Boominathan
 
Couchbase & FTS
Rich Lee
 
Connectivity coding for java and mysql
Fahad Ali Khan
 

Viewers also liked (6)

PDF
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Jonathan Dahl
 
PDF
Aristotle and the Art of Software Development (Agile 2009)
Jonathan Dahl
 
PDF
Aristotle and the Art of Software Development
Jonathan Dahl
 
PDF
Advanced API Design: how an awesome API can help you make friends, get rich, ...
Jonathan Dahl
 
PDF
Programming and Minimalism: Lessons from Orwell and the Clash
Jonathan Dahl
 
PPT
Pandas Updated2
stopxanh
 
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Jonathan Dahl
 
Aristotle and the Art of Software Development (Agile 2009)
Jonathan Dahl
 
Aristotle and the Art of Software Development
Jonathan Dahl
 
Advanced API Design: how an awesome API can help you make friends, get rich, ...
Jonathan Dahl
 
Programming and Minimalism: Lessons from Orwell and the Clash
Jonathan Dahl
 
Pandas Updated2
stopxanh
 
Ad

Similar to Rails and alternative ORMs (20)

KEY
[Coscup 2012] JavascriptMVC
Alive Kuo
 
PDF
Hands On Spring Data
Eric Bottard
 
PDF
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
SPTechCon
 
PDF
Using Document Databases with TYPO3 Flow
Karsten Dambekalns
 
PPTX
Sequelize
Tarek Raihan
 
PDF
Python RESTful webservices with Python: Flask and Django solutions
Solution4Future
 
PDF
Painless Persistence in a Disconnected World
Christian Melchior
 
PDF
Data herding
unbracketed
 
PDF
Data herding
unbracketed
 
PDF
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
PPTX
Art of Javascript
Tarek Yehia
 
PPT
SXSW 2012 JavaScript MythBusters
Elena-Oana Tabaranu
 
PDF
12 core technologies you should learn, love, and hate to be a 'real' technocrat
Jonathan Linowes
 
PPTX
How Rackspace Cloud Monitoring uses Cassandra
gdusbabek
 
PDF
AJS UNIT-1 2021-converted.pdf
SreeVani74
 
PDF
Rapid Prototyping with Solr
Erik Hatcher
 
PPTX
REST APIs in Laravel 101
Samantha Geitz
 
PDF
Spring data requery
Sunghyouk Bae
 
PPSX
JDBC Part - 2
Hitesh-Java
 
PDF
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Matt Raible
 
[Coscup 2012] JavascriptMVC
Alive Kuo
 
Hands On Spring Data
Eric Bottard
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
SPTechCon
 
Using Document Databases with TYPO3 Flow
Karsten Dambekalns
 
Sequelize
Tarek Raihan
 
Python RESTful webservices with Python: Flask and Django solutions
Solution4Future
 
Painless Persistence in a Disconnected World
Christian Melchior
 
Data herding
unbracketed
 
Data herding
unbracketed
 
JRuby + Rails = Awesome Java Web Framework at Jfokus 2011
Nick Sieger
 
Art of Javascript
Tarek Yehia
 
SXSW 2012 JavaScript MythBusters
Elena-Oana Tabaranu
 
12 core technologies you should learn, love, and hate to be a 'real' technocrat
Jonathan Linowes
 
How Rackspace Cloud Monitoring uses Cassandra
gdusbabek
 
AJS UNIT-1 2021-converted.pdf
SreeVani74
 
Rapid Prototyping with Solr
Erik Hatcher
 
REST APIs in Laravel 101
Samantha Geitz
 
Spring data requery
Sunghyouk Bae
 
JDBC Part - 2
Hitesh-Java
 
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
Matt Raible
 
Ad

Recently uploaded (20)

PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
July Patch Tuesday
Ivanti
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Python basic programing language for automation
DanialHabibi2
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 

Editor's Notes

  • #3: So ... Why use an ORM?
  • #4: Because your database and your OO code are unlike things. Different paradigms. So in a sense, any time you use a relational DB + OO, you’re going to do some sort of object relational mapping. May be formal or informal.
  • #6: So data types are not identical
  • #7: Your DB has a formal definition independent of the use of the data.
  • #8: This is a big one. In OO, you follow references - an object can “point” to another object, and so on. In SQL, you logically join sets of data together.
  • #9: Any bit of data can be joined to any other bit. In OO, ideal is to hide as much as you can and only expose a public interface.
  • #10: declarative vs. active - declare that certain kinds of data are acceptable, vs. actively checking at certain points in time.
  • #11: SQL doesn’t directly have a concept of inheritance. Fundamental to OO.
  • #13: Finally, different purposes. Define structure for data (and hold that data) vs. Doing something
  • #14: So basically, ORM are translators between unlike things. Like any translation,
  • #15: this isn’t going to be perfectly smooth, and there will always be tradeoffs. In this talk, Dan and I are going to talk about these tradeoffs by looking at three approaches to ORM with Ruby.
  • #16: You’re probably familiar with this already, so I won’t show much code here or talk about how to use AR. Instead, let’s talk for a few minutes at a more theoretical level.
  • #17: In this pattern, an object wraps each DB row. This single object handles both domain logic and database access. What's unique about this?
  • #18: Other approaches might not treat each row as an object, or might combine multiple rows into a single object.
  • #19: Others might separate these, filtering the data through a logic layer, instead of exposing both side-by-side.
  • #22: class User < ActiveRecord::Base end That does a _lot_. And from looking at this, you have no idea exactly what it did. You have to check the db schema in order to figure that out. The good news is that convention dominates. Once you know the conventions, you generally aren't surprised.
  • #23: This is true, by default. N+1, loads all columns, etc. It would be really nice if it could do these things. But at the same time, it provides facilities for these sorts of optimizations.
  • #24: This is part of the reason that alternative ORMs got started. The thing is, it isn't true any more. At least not entirely.
  • #25: This guy, Josh Peek, made Rails 2.2 thread safe.
  • #26: And this guy, who you may recognize, added the current connection pooling.
  • #27: The fact is, as a AR developer, you can pretty much forget how to write a join. This isn't really a limitation of AR - some could say that it&#x2019;s a feature. But at the same time, you really do need to know SQL if you&#x2019;re going to use a relational database. That said, my SQL skills have atrophied as a Rails developer. On our newest project, Luke and I have had to do quite a bit of custom SQL, and we've tried to make our DB layer a bit smarter and more robust. Which leads to the next criticism...
  • #28: Rails makes polymorphic associations easy and multi-table inheritance hard. But polymorphic associations: bad idea. Cuts out a join table, but hurts referential integrity. But because it&#x2019;s easy, you see a lot of it. Is this a valid criticism? It usually isn&#x2019;t that hard to fight against AR&#x2019;s conventions, and most of the time, you don&#x2019;t want to.
  • #29: This is bad. Basically, foreign keys require a plugin. Redhill. This plugin works, but isn't all that actively maintained, and some things (constraints) aren't even supported by that. You can always run a bare connection.execute() statement, but this won't get dumped into your schema.rb file, which is bad. According to DHH et al, you don't need DB constraints, and you want a dumb DB.
  • #34: 4. Access your database directly.
  • #36: Company 1 may not exist. Or
  • #38: I.e. you make a mistake
  • #39: I.e. you make a mistake. This probably isn&#x2019;t a problem for you, but it might be for some of the other people you work with.
  • #40: Sequel is a thread-safe DB library with a lightweight ORM
  • #41: Follows the ActiveRecord pattern
  • #42: So you don&#x2019;t have to write much real SQL
  • #43: So you don&#x2019;t have to write much real SQL
  • #44: The Sequel ORM is very similar to AR, at least on the surface. Does many of the things that Rails does, at least the basics.
  • #47: Also has similar support for sharding