Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The thing I always disliked about ActiveRecord ORMs is that you need to learn "their way" of writing SQL too much, because everything beyond the "Getting Started" tutorial is too complicated to use the built-in query building features.

The thing I like about ActiveRecord ORMs is the way you can iterate over a data set. The thing I dislike about how this works in practise a lot of the time is that it takes up quite a bit of memory because the relationships are built and held as objects.

Another thing I like about ActiveRecord ORMs is that I can have classes that have functionality, but get their attributes from the database. The thing I dislike about ActiveRecord ORMs is having to create a class for each of my database entities even if I don't need them (and/or having classes automatically created for them, still just as bad if you ask me).

I created PluSQL, a non-ActiveRecord ORM because I prefer to write SQL most of the time, but want to minimise the amount of boilerplate, and also because I like iterating using objects but don't like holding the entire object tree in memory and only want to create classes to represent a database entity when I need one:

https://github.com/iaindooley/PluSQL



    The thing I always disliked about ActiveRecord ORMs is 
    that you need to learn "their way" of writing SQL too much
Yeah. I see people straining to write complex queries in their ORM and I think it's just insane. At some point you're going to have to understand and debug the generated SQL anyway.

I think Rails' ActiveRecord implementation is pretty ideal because one of the explicit goals was to get out of the developer's way and allow them to write raw SQL when needed. I don't know how well other ActiveRecord implementations fare with this.

    I created PluSQL, a non-ActiveRecord ORM because I prefer to write SQL
Cool! I'm not a PHP dev but it looks neat.

Even though I just defended ActiveRecord, I kind of miss the days of thinner data mappers / ORMs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: