Piotr Solnica
solnic.eu · Personal blog · on HN since 2011
Piotr Solnica, a Ruby developer, writes about ORMs, Rails, mutation testing, and software design, and is behind Ruby data tools.
What HN saysHN commenters link his post on leaving Rails and note his writing on ORMs and data mapper patterns; little direct opinion is given.
21HN people shared it
5linked it in comments
17stories submitted
278story points
10 years agolast shared
2011people per year2026
Most-shared posts
- 1Ditch Your ORM4 people · 8 points · first shared 2015 · 1 comments on HN
- 2Mutation Testing with Mutant2 people · 19 points · first shared 2013 · 2 comments on HN
- 3Making ActiveRecord Models Thin2 people · 5 points · first shared 2011 · discussion on HN
- 4Ruby DataMapper Status2 people · 3 points · first shared 2012 · discussion on HN
- 5Invalid Object Is an Anti-Pattern1 people · 59 points · first shared 2015 · 42 comments on HN
- 6Abstractions and the role of a framework1 people · 51 points · first shared 2016 · 9 comments on HN
- 7The State of Ruby ORM1 people · 50 points · first shared 2011 · 18 comments on HN
- 8Cutting Corners or Why Rails May Kill Ruby1 people · 31 points · first shared 2015 · 4 comments on HN
- 9Get Rid of That Code Smell – Primitive Obsession1 people · 24 points · first shared 2012 · 26 comments on HN
- 10TDD is fun1 people · 16 points · first shared 2014 · 1 comments on HN
- 118 Things I Learned During 8 Years of Ruby and Rails1 people · 5 points · first shared 2015 · discussion on HN
- 12DataMapper 2 Status and Roadmap1 people · 2 points · first shared 2012 · discussion on HN
- 13Common Pitfalls Of Code Metrics1 people · 2 points · first shared 2014 · discussion on HN
- 14A closer look at how Ruby Object Mapper (formerly DataMapper 2) works1 people · 2 points · first shared 2013 · discussion on HN
- 15Get Rid of That Code Smell – Control Couple1 people · 1 points · first shared 2012 · discussion on HN
What HN people wrote when they linked it
lukeholder · 2016-05-23
For those unaware, this project was previously called Lotus. I think this is being upvoted because it was mentioned in the recently popular solnic[0] blog post.
[0] http://solnic.eu/2016/05/22/my-time-with-rails-is-up.html
vidarh · 2012-11-28
Not too Java-y, but too "DataMapper-y" for most Rails devs, I think (the pattern, not the ORM - the Ruby DataMapper ORM implements the ActiveRecord pattern, though DataMapper 2 actually finally will implement DataMapper)
EDIT: This is an interesting overview of where DataMapper 2 is going as a parallel to your example: http://solnic.eu/2012/01/10/ruby-datamapper-status.html
codedokode · 2016-08-21
I agree, Doctrine has performance problems. I did some microbenchmarks too. But you could try to optimize (or write your own custom) mapping code, or maybe you could load less entities or write a better ORM. Sometimes you have to use SQL queries too (when the result of a query cannot be mapped to entities).
The "SQL and arrays" approach is much worse and doesn't scale. Without ORM and classes you will get undocumented JSON trees (or arrays) passed around.
> http://solnic.eu/2015/09/18/ditch-your-orm.html
It seems to me that author wants to replace complex approach (OOP and ORM) with even more complex one. So instead of having one object representing an entity we can have ten objects representing the entity at different moments in time. So we have to find out which one is the latest. And we will need even more memory to keep them.
He writes:
> There is no User but it’s very likely there is SignupUser.
And soon there will be LoginUser, GuestUser, ProfileEditUser, UserForReport and others. And a bunch of methods to convert between them.
I don't understand what is the problem with mutable entities. They are supposed to be mutable. I never had problems because of functions modifying arguments given to them.
I don't believe functional programming can be use instead of OOP. Can you represent a DOM tree, collection of GUI widgets, a graph of related database entitites, a form with validation rules with functional programming? You will just end up emulating classes and…
joesmo · 2016-08-20
Doctrine 2 also often spends 10x the time on post-processing the data from the database as it does actually making the database calls itself (it's not fixable without dropping to straight SQL out of the ORM). Its query language is atrocious and unnecessary. Their ideas of joins and internals are absolutely horrific. The boilerplate is 1/3 of my app. But even if it was the perfect piece of code (it's exactly the opposite: total and utter shit), I'm not going to slow down all my DB queries 10x for anything, not to mention the incredibly slow development speed of now having two query languages and a million wrong ways of making simple queries and no ways of making proper advanced queries. Everything with Doctrine takes many times longer than with straight SQL even after years of working with it. I have yet to find an ORM that doesn't have egregious failings like Doctrine 2. It is inherent in the stupid concept of ORMs that implementations fail. See:
http://solnic.eu/2015/09/18/ditch-your-orm.html
http://seldo.com/weblog/2011/06/15/orm_is_an_antipattern
and most importantly, see benchmarks for ORMs like Doctrine and observe their destructive effects on programmer productivity.
douglasfshearer · 2014-12-20
Rails used as intended can be a real pain to upgrade, I agree.
Recently I have been developing applications in the "thin-model, thin-controller, with a service layer and external API wrappers" style, as espoused by Gary Bernhardt [1] and others [2] [3] [4] [5]. I upgraded to the latest Rails this morning on one app, and apart from swapping the Money gem to use the git repository, until they have a new version out with compatible dependency, it went smoothly. All the specs and acceptance tests passing with no alteration required.
[1] https://github.com/garybernhardt/sucks-rocks
[2] http://jamesgolick.com/2010/3/14/crazy-heretical-and-awesome-the-way-i…
[3] http://objectsonrails.com/
[4] http://solnic.eu/2011/08/01/making-activerecord-models-thin.html
[5] https://www.youtube.com/watch?v=CGN4RFkhH2M