Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you have MVC without an ORM? [closed]

Can you have an MVC without an ORM?

like image 311
johnny Avatar asked Sep 21 '10 18:09

johnny


5 Answers

Yes. MVC and ORM are answers to different, marginally related common problems - interaction with GUI and database access. Also, MVC is way older.

like image 128
Seva Alekseyev Avatar answered Nov 15 '22 20:11

Seva Alekseyev


Sure. In my day job we use Spring-MVC and handle all persistence manually through templates. We feel it gives us more control.

Most (all?) MVC frameworks should allow you to either plug in your own DB access coded against an interface (if this concept exists in whatever implementation language you are using) or just hand code it right in there.

like image 31
tau-neutrino Avatar answered Nov 15 '22 20:11

tau-neutrino


MVC itself means clear separation of the presentation, controller and model layers. So what way you select to implement each individual layer is completely upto you. You can implement the model layer without ORM's as well. You can just open a normal sql connection and use normal ADO.Net classes (remember dataview and dataadapter classes??) to get the data. If you think you have good database skills and need more control on sql queries go with the old methods. ORM's are for making the life of web developers better since they are not expected to have excellent database skills. The added bonus ofcourse is the ability to deal with database in an object oriented way and some layer of persistence.

like image 40
A_Var Avatar answered Nov 15 '22 19:11

A_Var


Of course you can. Those are two completely different things that can be used together as well.

like image 1
Darin Dimitrov Avatar answered Nov 15 '22 21:11

Darin Dimitrov


The data access is all underlying the Model in MVC - whether you use an ORM or any other technology for the data layer.

like image 1
Reed Copsey Avatar answered Nov 15 '22 19:11

Reed Copsey