More views from an OR/M person

time to read 3 min | 444 words

Rob Conery responded in a comment to my previous post, which includes some interesting points of discussion.

I think, in your example above, that it's only fair to also include the "under the hood" stuff you need to map these associations. In other words - I count the XML mapping as line of code too :) since this is code and it does have to be maintained.

Okay, no problem, I am using [ActiveRecord] attributes, so that puts me about 1-2 lines of attributes per property + 1 to 2 lines of code per entity. You can see the mapping in the first example that I have posted.

Your code sample RE the forum bits is a great exhibition of the power of the NHibernate query tool, but at the same time it reminds me of LINQ - why not just write SQL? I understand that in many cases you'd want to abstract that stuff away in case you change DBs

I am not using OR/M because I want to keep the DB abstracted. I am using an OR/M because it frees me from a lot of persistence related concerns and allows me to concentrate on the domain and the business problems.

In terms of perf vs maintainability - I really think this needs more consideration. To be honest, who's the app for anyway? The dev team or the client?

Only in the most extreme cases, and even then, after you have measured. Because the client is king, you want to ensure that you can keep giving value from the code that you have written. I am not seeing a problem between maintainable applications and performant applications, on the contrary. Maintainable applications give you a lot more flexibility in performance tuning.

Less lines of code - more direct: (SELECT * FROM MyView).

Also, less performant, no?

BTW, why did you bring MySQL to the discussion?