Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Entity Framework Overkill for Web Applications?

Let's say we are developing an E-Commerce Web application for a small to medium sized business. Let's further assume that the business is likely to scale over time. In other words, the product line will typically grow.

Up to now I have developed n-tier solutions using ADO.NET and stored procedures with the help of the SqlHelper class. For bigger applications I have used Enterprise Library (2.0).

I would like to move towards an ORM-based approach and am starting to learn LINQ as well as making the switch from ASP.NET Web Forms to ASP.NET MVC. I do not want to go with LINQ-to-SQL. The question is not whether an ORM is required but if the Entity Framework ORM is overkill for such a project. I don't mind a learning curve if it is warranted for the task in hand.

As regards "overkill", I would like to know if:

  • EF is faster than someone with the correct skills coding queries manually
  • EF leads to unnecessary code bloat
  • EF unnecessarily shields devs from code-level details of their queries
  • LINQ-to-Entities is suited for projects of this size

In fact, if anyone thinks that an ORM is overkill for such project I'd like to hear reasons why.

like image 635
IrishChieftain Avatar asked Sep 18 '10 21:09

IrishChieftain


3 Answers

EF is not overkill for web apps.

I disagree with a lot of what is stated in your referenced article. I do agree devs should have decent skills with SQL BUT ORMS do a great job in getting a devs job done more quickly.

  • Speed of ORMS - They are getting better all the time & they allow you to call SP's or modify the queries to get max speed when necessary. There are also great profilers out there for monitoring ORM performance like EFProf.

  • Slows down the coding process - Really!!! Once learned it speeds it up.

  • Devs needing to know SQL - I agree. However, ORMS especially with LINQ syntax often allow devs to write more complex SQL than they would have on their own.

  • Devs write efficient queries already - REALLLYYYY!!!! Just ask the DBA his/her thoughts! I happen to think I do but so does everyone else. See the problem. :-)

  • Code Bloat - Have to disagree, especially with ones that have LINQ.... It often makes the code more readable and reduces the line count often.

  • Forget about LINQ - This ship has sailed. LINQ Rocks!!!! Go with it or be left behind. It's not just used in ORMS. It can be used against, arrays, objects, XML, files, twitter and the list goes on and on.... Get to know LINQ.

The article talks about some of the inspiration of the latest developments out of MS as coming from Ruby on Rails. ROR has an ORM based on Active Record in it.....

ORMS are good. They don't have to be used everywhere and everytime but they are good and should be considered.

like image 96
Kevin LaBranche Avatar answered Oct 18 '22 10:10

Kevin LaBranche


Although this is a general answer be wary of any opinion which has these comments in:

"X tool stinks, I write in Y tool and I can do it faster than in X tool."

Or course a Latin speaker speaks better in Latin.

like image 25
John Farrell Avatar answered Oct 18 '22 10:10

John Farrell


EF has a learning curve, but anything new does. EF is not overkill, but as per any system being written use the right technology for the right project.

like image 38
WestDiscGolf Avatar answered Oct 18 '22 09:10

WestDiscGolf