Reputation: 14278
Tomorrow I will kick off a new project, a line of business application for a client and I have decided to build with asp.net mvc. I am an experienced webforms developer, also silverlight lately but this will be my first real mvc app. I have watched some videos and get the core concepts enough that I have tossed together some proof of concept MVC work so I am not looking for the trivial 'there is no postback' kind of answer here.
What I want to know is, what if any things do you know now you wish you knew when starting out in MVC? What should I avoid? What should I make sure to do?
Upvotes: 4
Views: 604
Reputation: 614
A few tips from the top of my head.
After using MVC every day for about 2 years. I still learn new things and better ways to do things, so keep looking for better solutions. I think MVC is a lot more fun than Webforms and I really do hope never to work with Webforms again.
Good luck!
Upvotes: 2
Reputation: 2790
One of the "negatives" mentioned quite frequently about MVC is the tag-soup that can become quite unwieldy and ugly. I good way to combat this is to move your view based logic into a ViewModel with any logic moved into there. Eg. You could have..
<div><%= Model.PluralizeUserCount %></div>
Instead of..
<% if(Model.Users.Count == 0) {%>
<div>There are no users in the system.</div>
<%} else { %>
<div>There are <%=Model.Users.Count.ToString() %> users in the sytem.</div>
<%} %>
Much neater!
Upvotes: 1