Dot Net Tricks

Articles about .NET, ASP.NET, C#, Object Oriented Programming and Agile Methodologies
Welcome to Dot Net Tricks Sign in | Join | Help
in Search

Software Theosophy

Die Code-Behind DIE!!!

As mentioned in previous episodes, my team is standardizing on the ASP.NET MVC Framework for web development.  One thorn in our sides has been that by default, Visual Studio would create a code-behind for your views automatically, and if you wanted a view that used a strongly typed model, such as ViewPage<Person> or ViewPage<ProductCollection> then you had to create a code-behind file.  There were CLR hacks to do this in the code in front, but they were just awful.

In webforms, code-behind made sense, in MVC not so much.  I think they tend to encourage developers to write code in the old webforms way, and not use the controllers and helper methods as much.  One of the reasons to move to MVC is to return to simplicity--no page events, no controls, no viewstate.  Code-Behind is a blemish on that simplicity.

Well the nail has officially been driven into the coffin for our old friend code-behind.  In the next version of MVC, it can go away completely:

http://weblogs.asp.net/scottgu/archive/2008/12/19/asp-net-mvc-design-gallery-and-upcoming-view-improvements-with-the-asp-net-mvc-release-candidate.aspx

You can still add code-behind if you are perverted, twisted, abomination of a developer, but its no longer there by default.

DIE Code-Behind!  DIE!!!

(oh and normalize your fucking databases.)
Published Friday, December 19, 2008 9:37 AM by Fregas
Filed Under: , ,
Anonymous comments are disabled

About Fregas

Craig is currently the Lead Developer in Fort Worth, Texas for Enilon Group, a web development firm. He has been programming since 3rd grade (using the Commodoore PET) and professionally for the past 7 years. He has written several articles for ASPToday.com and co-authored the book "Beginning Web Programming using VB.NET and Visual Studio .NET" Currently, his favorite programming language is C#, but he has programmed in Visual Basic, T-SQL, Ruby, ColdFusion, ASP 3.0/VBScript, ASP.NET, Javascript, Java and even Pascal. Besides programming, Craig is best known for his cooking and his somewhat offbeat sense of humor.

This Blog

Post Calendar

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Syndication

Powered by Community Server, by Telligent Systems