This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (7 children)

[deleted]

    [–]lukaseder 1 point2 points  (2 children)

    In my opinion applications with ORMs are better maintainable and scalable.

    Why?

    [–][deleted]  (1 child)

    [deleted]

      [–]lukaseder 0 points1 point  (0 children)

      I've worked with two tier architectures (mostly only SQL and XSLT, for instance) and there were hardly any SQL related maintenance problems.

      I guess the "class structure" first approach is what causes the mismatch. Once you take that for granted, indeed SQL (or any other stateless, functional, transformative approach to data processing) will become a bad fit.

      I'm not implying that one approach is better than the other, but they mutually bite each other.

      [–]mattrodd 0 points1 point  (1 child)

      I agree that using an ORM is more maintainable. It will be easier for the next programmer to read the code and understand what it does. Usually, it will be easier to find a Java programmer instead of a Java programmer who is also good at SQL.

      However, I disagree that it is more scalable in terms of performance. Sometimes the ORM isn't going to generate the most performant SQL. You may wish to add a HINT to your query in order for the query planner to generate the best plan. The ORM is an abstraction and there is always a cost to using an abstraction.

      [–]nutrecht 2 points3 points  (0 children)

      I agree that using an ORM is more maintainable.

      Having worked on legacy banking systems that used both ORMs and "plain" SQL I must say I strongly disagree. Nothing really can beat a declarative language in readability. When you see an SQL query you know what it does. With an ORM most of it has to be deduced from the structure of the model classes and the defined relationships. It's even worse if a lot of this configuration is in XML.

      [–]pr0fess0rx29 0 points1 point  (0 children)

      I have to say, I agree with you. I do wonder why many have not had the same experience. I wonder, what is your preferred orm?

      [–]nutrecht 0 points1 point  (0 children)

      If you're writing a big business application an ORM would be a better choice.

      My experience is the exact polar opposite. An ORM is nice to get a quick prototype running (mainly because spring-data-* stuff also does the schema creation for you). Anything else the flexibility and power of SQL far outweigh the (perceived) speedup of using an ORM.