ORMs are a thing of the past

ORMs are a thing of the past. Hold your anger! I always thought ORMs were the next best thing after sliced bread. I was so convinced about ORMs that I wrote some of them on my own in Ruby and Java – not very good, mind you – during the 90s. Later I switched to commercial ones and settled with Hibernate and JPA for many projects. But after years of usage and seeing developers on my teams work with Hibernate, I’m no longer sure it is a good thing.

Beware: This is a non-conformist post. I’m also one of the very few people who think JPA/Hibernate annotations are bad for your domain classes. Keep this in mind while reading further.

Problems with ORMs

They are a delusion. They help you getting up to speed fast and prevent you from writing noisy boiler code. Over time they will pose problems, those problems becoming bigger than the speed you’ve gained. The biggest two:

  1. ORMs are most problematic due to performance concerns. Many developers I’ve met never look into Hibernate SQL logs to see what queries are generated, and how many of them. Should they ever look in the SQL which is executed, their eyes will pop up. Mine did. Nearly.
    As Aldo wrote in “A Farewell to ORMs”

    Whether or not the magical plumbing is worthwhile depends largely on how often the abstraction breaks down. The ORM approach does so frequently. Yes, I can use an ORM and think at the object level in the common case, but whenever I need to do anything remotely complicated – optimising a query, say – I’m back in the land of tables and foreign keys. In the end, the structure of data is something fundamental that can’t be simplified or abstracted away. The ORM doesn’t resolve the impedance mismatch, it just postpones it.

  2. Leaky abstractions. You think the ORM works but it doesn’t. It throws exceptions to you. Lazy initialization exceptions in Hibernate popping up in the most unfortunate circumstances because you made wrong assumptions about sessions, scope and flow. These are hard to find and often harder to fix.

But these are not the main reasons for the phasing out of ORMs over the next years. Additionally ORMs may hinder future development and not be a safe investment because they lose their grip on enterprise development with the advent of NoSQL data stores. Polyglot persistence will make it harder to store data via ORMs, as thouse would need to cross reference stores. This is all highly speculative, and could be countered by: “Well, SQL isn’t safe either”. But nevertheless it needs consideration.

Solutions without ORMs

The most common argument against the performance impact of ORMs is to use caching. Caching in Hibernate does reduce the number of queries indeed. But caching done in XML, JSON or HTML is often more efficient than object caching. And should you need object caching, other solutions beside ORMs exist which explicit caching of objects like ehCache or Terracott in Java.

What about less boiler plate code due to ORMs? Good DAOs with standard CRUD implementations help there. Just use Spring JDBC for databases. Or use Scala with closures instead of templates. A generic base dao will provide create, read, update and delete operations. With much less magic than the ORM does. And although others think that DAOs are dead, the fraction of persistence increases the need for DAO abstraction. The downside of managing relations yourself isn’t as large as ten years ago, with many web databases denormalized. Or with part of the data already in NoSQL document databases.

Think about ORMs the next time you start a project.

165 thoughts on “ORMs are a thing of the past”

  1. Pingback: best
  2. Pingback: fucoxanthin
  3. Pingback: geniux pills
  4. Pingback: intelligex
  5. Pingback: intellux
  6. Pingback: probrain
  7. Pingback: radian c
  8. Pingback: supreme antler
  9. Pingback: genius reviews
  10. Pingback: testomax
  11. Pingback: TRACKR BRAVO
  12. Pingback: alpha f1
  13. Pingback: alpha fuel
  14. Pingback: alpha peak
  15. Pingback: alpha xtrm
  16. Pingback: caralluma extract
  17. Pingback: anabolic rx24
  18. Pingback: cognifocus
  19. Pingback: garcinia melt
  20. Pingback: max synapse
  21. Pingback: nerventrax
  22. Pingback: nutra forskolin
  23. Pingback: premium cleanse
  24. Pingback: testorip
  25. Pingback: testoroar
  26. Pingback: zynev
  27. Pingback: pro forskolin
  28. Pingback: forskolin slim
  29. Pingback: garcinia xt
  30. Pingback: forskolin fuel
  31. Pingback: vitapulse
  32. Pingback: vitapulse reviews
  33. Pingback: vitapulse review
  34. Pingback: pure colon detox
  35. Pingback: pure colon detox
  36. Pingback: somnapure
  37. Pingback: perfect biotics
  38. Pingback: reviews vitapulse
  39. Pingback: vitapulse vitamins
  40. Pingback: vitapulse scam
  41. Pingback: vitapulse
  42. Pingback: vitapulse
  43. Pingback: probiotic america
  44. Pingback: taurus
  45. Pingback: Panic Away pdf
  46. Pingback: Brain Revitalizer
  47. Pingback: Alexapure Pro
  48. Pingback: Ecomaxx Reviews
  49. Pingback: T90 Xplode
  50. Pingback: Fungus Key Pro
  51. Pingback: Tea Tox Reviews
  52. Pingback: MegaDrox Review
  53. Pingback: Test X180
  54. Pingback: Test X180 Reviews
  55. Pingback: Breast Actives
  56. Pingback: probiotic america
  57. Pingback: Homepage
  58. Pingback: Get More Info
  59. Pingback: browse this site
  60. Pingback: this page
  61. Pingback: Get More Info
  62. Pingback: see here
  63. Pingback: Homepage
  64. Pingback: Bonuses
  65. Pingback: my company
  66. Pingback: Cash Blurbs
  67. Pingback: news
  68. Pingback: try here
  69. Pingback: visit
  70. Pingback: Pure Reiki Healing
  71. Pingback: my site
  72. Pingback: anchor
  73. Pingback: Save The Marriage
  74. Pingback: click
  75. Pingback: buy NBA 2K17 MT PC
  76. Pingback: click
  77. Pingback: here
  78. Pingback: Visit Website
  79. Pingback: official site
  80. Pingback: dig this
  81. Pingback: anchor
  82. Pingback: check my site
  83. Pingback: my response
  84. Pingback: Mega Drought Usa
  85. Pingback: Magnetic Messaging

Comments are closed.