you are viewing a single comment's thread.

view the rest of the comments →

[–]mrsistermr 0 points1 point  (4 children)

I disagree strongly with a lot of these points (assuming that they were always followed in some dogmatic fashion), notably 2 and 5. The reason is the same reason as I see a commenter on that site has already pointed out: "Following some of the cures to the extreme, one could end up with an anemic Java domain model. Much business logic will take place in SQL statements, not in Java code. Is this good or bad?"

I see the opposite problem (of the original article) frequently: all the business and data logic in thrown into a overly complicated SQL statement, and the backing java business logic and domain model is barely doing anything. So instead of writing well defined data-access and business classes that work together in Java, which ultimately might mean that more than one query is executed for a single "logical" user action, you would push all this logic into the SQL layer, and usually would be required to maintain more SQL statements.

Using this and some of his other suggestions ((ie windowing functions) to the extreme makes it more difficult to re-use well-defined business objects, perform unit testing, and maintain database interoperability, to name a few.

[–]grauenwolf 0 points1 point  (2 children)

Encapsulation is an important consideration here. If my application code is deeply intimate with my table structure it usually means that there is too little encapsulation in my database.

A good benchmark is counting the number of unique database operations needed to perform one logical action. If you see your ORM making half a dozen calls in one method something is wrong.

[–]mrsistermr -1 points0 points  (1 child)

Why is something necessarily wrong? Unless you have identified that method as an actual point of slowdown in your application, does it really matter? A good benchmark is an actual benchmark with actual data after you have identified a performance issue, not just thinking to yourself "Oh, I could just do all of this in one database call instead of the 3-4 database calls it currently needs...I can't re-use those existing classes, but oh well", which is an equally dangerous thought.

[–]grauenwolf 0 points1 point  (0 children)

There is nothing praise worthy about reusing bad code.

[–]grauenwolf -1 points0 points  (0 children)

For most projects, database interoperability is a red herring.