Friday, June 13, 2008

Why ASP.NET sucks (and there is Hope)

I think ASP.NET really fuckup big time. I tried at least 3 development projects with it, and I found the whole package doesn’t really speed up my development time, plus it’s no fun and excitement.

Page Controller Architecture Sucks
First of all, the Page Controller (or Model-View-Presenter) method used by ASP.NET 1.0 and 2.0 is so out-dated. Once you try your hand on Model-View-Controller (MVC), especially Ruby on Rail (I tried it more than a year ago, and still find it fascinating and refreshing), there is really no turning back. Personally, MVC increased both productivity and fun level by at least 50%.

Desktop Application Framework (and Controls) on Web Sucks
The thought of Microsoft trying to emulate desktop development framework (like VB6 with forms, controls and events) on the web really screw up the whole development experience. I hate the idea of the entire ASP.NET life cycle thing (which causes a lot of cannot do and inconvenience), and the event things doesn’t really work very well for dynamically created controls (you have to re-create the controls even though you don’t need them in order for the event to be fired, then you destroyed the controls and created new ones based on the event, which is a total waste of effort and processing cycle). And those damn controls are so bulky (generate a lot redundant HTML code) and take a lot of effort to customize, and none of the commercial controls out there is really outstanding (I tried Infragistic, it’s not really great). And the use of skin file for UI customization (such as color, padding, etc) is really not as good as CSS. Even though they try to remedy it with CSS Adapters, but it’s too late of a patch work.

Where is ORM?
Where is the Object Relational Mapping? I have to write damn lots of database helper class, write my own Model/Entity class and mess with even more SQL statements. I want the Model/Entity to be automatically generated, and all the common SQL command ready to be used as methods. And also some easy syntax to specify the relationship between models. They nearest they got is Strongly Typed Data Access (using XSD), which is too rigid and very difficult to customized.

Strongly-typed Variable is not too smart
I really like VB (and VB.NET), because they take care of the internal/implicit casting (some might argue it's bad, but it save time and it's right 90% of the time) for you (short, integer and long can be interchanged easily). C# is really a pain, where it demands you to do a proper casting (you can’t assign integer to long or vice versa). Too bad VB syntax is too lengthy, and C# is too damn strict (and not really smart). Scripting language is far superior in terms of speed of coding. I don't mind case sensitivity (make the code cleaner) and variable declaration.

Wastage of Processing Cycle
ASP.NET AJAX is really easy to use, but the solution is quite pathetic and really inefficient. Basically the AJAX called the entire page again but only refreshes a specific portion. In fact, the entire ASP.NET package is a good waste of processing cycles, especially for events.

Loose Control of HTML and Javascript

I know the whole thing about web development is a big giant, with HTML, Javascript, CSS (thus ASP.NET try to do abstraction on it so that VB developer could survive). To be frank, what kind of web developer are you if you cannot take control of the HTML and Javascript (and make use of jQuery). We all have to learn HTML and Javascript, and manipulate them wisely. We don't need protection and subsidies!!!

There is hope!
The good news is, MVC is becoming popular on ASP.NET, with MonoRail and ASP.NET MVC in the picture (and comparison). MonoRail had been established since 2003, and ASP.NET MVC just started by Microsoft. Microsoft really has to nail this right, and I am afraid they have done too many wrong with ASP.NET. For ORM, maybe we can look into NHibernate vs. MS Entity Framework/LinQ (and comparison).

I like the .NET Framework, Visual Studio and C# (perhaps speed of development friendly. I do agree that VB.NET is really a developer's good friend, besides the lengthy syntax).I am not really a ASP.NET fan nowadays, but sometimes I am “forced” to work on it due to customer’s demand. I might explore these options next if the opportunities arises.


Anonymous said...

You are funny!

You say ASP.NET sucks because it lacks MVC, but then you point out that ASP.NET has MVC.

You say there is no ORM, but then you point out Entity Framework, nHibernate and LINQ.

You say the AJAX framework calls the entire page again but refreshes only part of it. This isn't true either.

You seem to like to write things that don't have much meaning.

d_luaz said...

Hmm, not sure you are trying to be humourous or to pick a fight.

All the MVC and Entity framework are recent development, which is of no existance for the past many years. NHibernate is there, but I am not sure of the stability and adoption rate.

If you understand the underlying mechanism utilised by Microsoft AJAX, you would understand it's a very inefficient method.

No meaning? If you don't feel that ASP.NET is weak (or didn't keep track off it's progress), then it is of no meaning then :)

Anonymous said...

I agree with your sentiments almost entirely. I've been working with this framework for only one week, and it is a huge piece of shit. I can't see how costco and are built on this thing. The point you mention about how it completely rapes generated HTML not allowing you to use JQuery and the like is dead on. Makes it a non option for me.

I also really like your writing style. You're opener is killer!

I think ASP.NET really fuckup big time.

d_luaz said...

Using jQuery in ASP.NET is still possible, just that might not be "friendly" enough.

But I do agree the page-based-framework itselves is not very good, hopefully ASP.NET MVC could salvage that. But too many ASP.NET controls had been built around the page-based-framework.

A revolution do require some sacrifices.

Anonymous said...

I usually believe I'm a window guy. I've been using both ASP and PHP and haven't seen any advantage of using PHP before its version 4.

But since PHP introduced the OO architecture, the whole outlook of developing web application seems dramatically changed, if not challenged. The challenge part turned out to be the least concern after a few projects, though.

I still love .NET framework and want to delve into C# and ASP.NET. But my biggest concern is how long it takes to get the productivity and how well I will become capable.

Well, it has been 5, 6 or so years since its inception, I haven't seen any easier way of programming ASP.NET. I know it is advanced technology and also potential, esp. C# not VB.NET, I don't care about the writer's viewpoint of case-sensitivity.

Personally I think the biggest fuckup in ASP.NET is its authentication mode. It's horrifying when I looked at it first time. It's so complicating - if you remember there is a book only dedicated to this part and this is a proof of fuckup.

Anyway, it's always better late than never. I should go back, but it's not going to happen in the near future because I just fell in love with PHP + CakePHP + ExtJS frame.

d_luaz said...

I got hooked on PHP because it's easy and fun, with good productivity. CakePHP just make it so much better and organised.

Personally it is too complicated doing advance ASP.NET programming with all the WCSF, 3.5 Framework and alike, and no fun at all. Simple page-oriented ASP.NET without MVC just isn't scalable enough. Somehow, ASP.NET just seems all work and no fun.

I like C# WinForm development, but ASP.NET architecture is a really big fuckup.

Mr. TA said...

Good news is, there is a solution to ASP.NET's problems: it's called the Turbo framework.