473,406 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Has anyone every used MVC ASP.NET?

Frinavale
9,735 Expert Mod 8TB
Has anyone every used MVC ASP.NET?

I'm thinking of giving it a go and was wondering if anyone has any experience/comments on it?
Apr 28 '09 #1
8 2155
r035198x
13,262 8TB
I would suggest making this top priority. MVC is almost the only way to create applications these days.
Basically you create classes for your database objects(the model). These classes should not have any bearing on how the database data is going to be presented to the user. They should be usable by anyone whether they are accessing the database data from a web application, desktop application, mobile application, anything. The model is your observable that others (observers) observe and react according to the changes to your model. A common pattern to look up for the model is the DAO pattern (Also make a note to read up on Factory and Abstract Factory patterns while you are at this).


Then you create your controller which contains the application logic. This is where you code the system requirements/specifications. This one knows about the model and contains code that manipulates the model but it produces generic data with no bearing as to how that data is going to be presented to the user. The patterns to use here depend on your specs.
The View(s) is/are contain the presentation and are the web pages or forms or mobile phone interfaces that display the data contained in the model. The view should not try to do any control logic (that's the controller's job) and certainly should not contain any SQL.
Apr 30 '09 #2
Frinavale
9,735 Expert Mod 8TB
I've started researching MVC last night and plan on continuing with it.

I was looking for something that didn't depend on how it was being driven through the UI and thought that web services were the way to go. (My application is being developed for web pages, mobile apps, and desktop application)

I was really happy to discover MVC.

I think it's going to fit my application very well and I probably wont go back to developing typical web form applications unless I'm forced to.

I wish I knew about it sooner (like 2 years sooner) because it's so clean. Everything's separated into proper application layers: you have the UI, you have the business logic, you have the data layer. Not only is it clean but it's easy to maintain and much easier to test (because everything should work without depending on the other layers).

I'm excited about it and think everyone developing applications should check it out!
Apr 30 '09 #3
JosAH
11,448 Expert 8TB
What I don't like about the classic MVC pattern is described in here. When you look at the picture at the top right of that article you see that a View has direct access to the Model. The model doesn't know anything about the View though (as it should be).

I always make the view just communicate with the Controller and the Controller knows about the model. This may seem to be a detour but it completely decouples the View from the Model so the 'triangle' boils down to M <---> C <---> V

The Controller acts as a 'proxy' for the Model and models can be replaced at will, while the View can stay the same. (so point 4) of that article goes away). In my experience you get a bit cleaner code then.

kind regards,

Jos
May 2 '09 #4
tlhintoq
3,525 Expert 2GB
I'm excited about it and think everyone developing applications should check it out!
Does it do anything for those pesky little applications that aren't based on databases?
May 3 '09 #5
JosAH
11,448 Expert 8TB
@tlhintoq
Sure, most, if not all applications have some form of a model; the model doesn't need to be a database management system.

kind regards,

Jos
May 3 '09 #6
gits
5,390 Expert Mod 4TB
@JosAH
that's what i usally do too ... exactly for the same reason that the resulting decoupled code is much cleaner and much easier to maintain and reuse ... but i wouldn't say that every application has to follow this pattern ... we have a lot of smaller apps that are just 'maintainance-apps' for database tables ... sometimes single tables, sometimes some tables are joined ... and for such simple things i just don't like the kind of 'overhead' that could be created for an app that just would have 200 or even 400 loc ... just by seperating everything according to a pattern and wrap it into view-, controller- and model-classes ... the overhead often goes for loc and development time. on the other hand sometimes i've to admit to have better done so ... for example i would have a reusable model for applications then that deal with the same data and i wouldn't have to create one later on when i would need one and then i have to do so ... but then i miss the time to refactor the old plain webapp ... so i have a model but the mentioned miniapp doesn't use it :) ... so as you could see ... i loose a bit with the 'overhead'-argument ... but in my case its a matter of importance that the development time has ... we've got a quite nice framework that allows us to quickly write such miniapps without a MVC-pattern ... and it's very easy to use it ... but as i said ... sometimes the decision to use it has a drawback when there is a chance that the 'model' could be reused ... and then i would have better done to follow the pattern :) ...

kind regards
May 7 '09 #7
Markus
6,050 Expert 4TB
After switching to MVC on top of some of the PHP frameworks, I wondered 'how the hell was I working like this (without MVC)?' Not sure what it is like in ASP.NET, but the benefits of MVC are great regardless of language, I assume.
May 15 '09 #8
Atli
5,058 Expert 4TB
@JosAH
This always made the most sense to me to.
Detaching the View from the Model makes the code easier to manage.

I've been using MVC for a long time in PHP, but I've never imagined using it in ASP.Net.
I mean, Visual Studio does everything it can to push you into a procedural style of coding. It would probably be a major pain to try to code MVC applications in it...

... he said, 15 days later :P
It's getting to quite around here!
Jun 2 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: lawrence | last post by:
I'm trying to read up on the rfc's that govern form inputs. Much of what I'm reading is stuff I didn't know before and some of it is alarming. This one left with me questions: ...
6
by: Skip Montanaro | last post by:
I wrote PEP 304, "Controlling Generation of Bytecode Files": http://www.python.org/peps/pep-0304.html quite awhile ago. The first version appeared in January 2003 in response to questions...
2
by: megandelune | last post by:
I have been learning ASP from a book I bought a week ago and so far it is very informative, but I seem to be confused on one simple term. Variant. Now I learned how to declare a varible with the...
6
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but...
5
by: Michael C | last post by:
....on a remote machine? Thanks, Michael C.
9
by: LP | last post by:
Hi, I get a lot of questions from prospective clients about UML and what modeling tools I have experience with, which I do not. But when I ask them if they are currently using UML? The answer is...
5
by: tony | last post by:
I'm using PHP 5 on Win-98 command line (ie no web server involved) I'm processing a large csv file and when I loop through it I can process around 275 records per second. However at around...
169
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide...
15
by: Neil | last post by:
So, I tried to copy a toolbar. I have a custom menu bar for a form. Tried to copy it so that I could modify the copy and use it with another form. With no direct way to copy it, I made a copy of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.