ORM vs traditional database query, which are their fields? -


ORM seems to be a fast growing model, with Richard Keesig's ultra-fast ASP.NET From: ():

"I love them because they allow me to develop small, proof of concept sites very quickly. The related complexity is that I would otherwise focus on things, business logic and presentation Need to give, but the same I also do not care for them because, unfortunately, their performance and scalability are usually very bad, even though they are 'integrated with a comprehensive caching system (the reason is clear when you think that when properly configured , Then SQL Server itself is actually a big data cache. "

My questions are:

  • Richard What is your comment about the idea? Do you agree with it If not, please tell.

  • For the ORM and the traditional database query - in other words, where you should use ORM and where you can query the traditional database You should use :), what kind of / size ... applications should be one of you

I can not agree with the general complaint about ORM that they perform poorly. I have seen many plain-SQL applications so far. However, writing customized SQL is theoretically possible, in fact, they can ruin all the performance benefits by not writing customized business logic.

When using plain SQL, business logic depends on the DB model and database operation and optimization business logic because there is no OM model, you can not go to the entire object structure. I have seen many applications that go to the primary key and retrieve data from the database on each layer repeatedly. I have seen applications that use databases in loops. And so on. The problem is this: Because business logic is already hard, there is no room for any more optimization. Often when you try to reuse your code at least, you acknowledge that it is not optimized for each case. Performance design gets spoiled

Usually, an ORM does not require business logic to care too much about the use of data. Some customizations have been implemented in the ORM. It has the capability of cache and batches. This automated (and runtime-dynamic) optimization is not perfect, but they reduce its commercial logic. For example, if a piece of data is conditionally used, then it loads the request with lazy loading (ok once). You do not have to do anything to do this.

On the other hand, the ORM has a broad learning curve. I will not use an ORM for similar applications, unless the ORM is already in use by the same team.

Another disadvantage of ORM (not actually the ORM, but the fact that you '

conclusion:

  • A relational database and object Work with the model, so that the team should be strong in both the world, the ORMs are powerful for business-logic-based applications, which are complicated with data structures that are beneficial to the OO model.
  • ORM usually learn (somehow) fast For small applications, this can be very expensive.
  • Application based on simple data structures, there is not too much logic to manage it, it is the easiest and easy and plain SQL
  • High level database knowledge will not have much experience in Team and OO technologies, using the most plain SQL will be more efficient (of course, they come by writing Depending on the length of time, the team can be recommended to switch the focus)
  • OO teams of higher levels of knowledge and only the basic database experience are the most efficient ORM. Depending on the type of application they write, the switch can be recommended for the team to switch)

Comments