help.net


Musing on .Net

News

Windows Phone Apps I recommend

FotoBank


FotoIreland



hit counters






Open source CMS


My blog

Irish blogs

Locations of visitors to this page Get Chitika eMiniMalls

.Net useful

Blogs I read

PocketPC

SQL

Usability

Code inline or Code behind ?

Well this post is just my opinion, and I am sure this will not change Microsoft view on the subject.

I have some concerns on the choice made in ASP.Net 2.0 to set the code inline by default. I am ok with the new partial class feature, and I found this is a great idea.

But mixing the code and the HTML ring a bell in my mind about the old ASP time. Remember spaghetti code ?

So why this has to be the default ? You can expect that beginners (or lazy coders :-)) will jump on this new approach. I read this make the things easy to maintain with only one file, but are we sure it is so important ?

Just an example. Currently if a designer want to modify the ASPX page (with my authorisation of course), I don't have to worry too much about my code which is perfectly safe in its DLL.

Tomorrow if I use the 'by default' in Visual Studio, I  will be to scare that by accident someone change anything in my code. Indeed I can use master pages and templates, but if I don't want ?

It's also true that with code behind, I can change some of my code, compile a new DLL and deploy. No need to touch my webpages.

I can see this move as an attempt to seduce web developers scared by real code. Well if it's the case, this is really wrong. Nothing much cleaner than a good separation between code and presentation.

As I wrote at the start, no way I can change Microsoft's mind. But between the two camp, I know already where I stand up.

 

Posted: Jul 28 2004, 04:59 PM by help.net | with 11 comment(s)
Filed under:

Comments

No Comments