If you have worked with other programming language and want to move to web development and esp. ASP.NET, I would like to inform you some of the pitfalls of ASP.NET before you dwelve into it. ASP.NET is an extremely badly written language. It is like by a college student who has got a B+ grade done a project to pass his course. The project works, it gives result but working with it it extremely painful, really. What is more painful is that ASP.NET is not written by a B+ grade college student but by gurus of Microsoft. Let me get started …
- When it comes to starting with ASP.NET, there is a steep and looooong learning curve. Now that is actually a good thing, you learn something and you can then use to your advantage later. Except that you can’t. Except you step into mud and as you move on the mud does not decreases but increase and at times you step into areas where you are sunken and you struggle to get out of it for days just to get simple things done and I mean really simple.
- The fact that ASP.NET is object oriented, you have to learn Object Oriented Language first and get familiar with all its concepts, esp the primary ones. Should it get you some serious advantage in your programming. No absolutely nill. OOP is something an advance programmer uses, not the beginner. The fact you that you have to learn OOP first, makes the step hard in the first place. And it kind of makes the step inappropriate as well. Should a beginner level programmer get in Object Oriented programming from start. The simple answer is no. At what point you can actually benefit from OOP, well that is probably after 1 year and really putting this date as early as possible.
- The object oriented programming for web development is almost a flop. You can do what ever you have done in OOP but in plain language. So the OOP model makes it only complicated. The advantage is, the OOP is more likely to be easily maintained but a well written no-oop can also be well mainted. The fact is OOP model does not really fit the HTML world, while it might be a necessity for big desktop based applications.
- Once you learn the basics of ASP.NET, there is again a steep learning curve. The learning of new “technology” is not over. I stressed the word technology here, not just a new syntax. In ASP.NET there are dozens of controls and to use every one effectively you really have to learn that control, I mean learn it and play with it, not just use it. That is more learning than in any other language.
- ASP provides you a ton of built in functionality, which can be a good thing for the most part but a bad thing too. Lets assume these are good things. Example of such controls are Gridview, ListView, DataGrid, SQLDataSource among many others. Now to use them is really simple. First place an SQLDatSource in the page, tie it to to data from the database, place gridview in the page and bound the gridview to sqldatasource. Boom, the whole application is ready! You can easily edit the the field if you want to and introduce paging, all built in! That is the coolest part. Now what is not so cool about it? First as we discussed before there is a learning curve involved. To make an row editable for example, needs special sql query. When you write this query, it may not work out of the box! Yes this is the catch. In fact it be quite complex to implement if you are a newbie. As an example, if you make a row editable in gridview, you have to have primary key in the fetched record. This sounds trivial but you may well have a case in which you want to update the record which does not have primary key. The worse part is, while there are these rules in the background, the actual developer is never show the correct error. He is lost to find help online. Now such a simple thing as to make a row editable can become a pain that might takes days to solve just because of unclear error message.
- A well written programming language should have this property of good maintainability and assume with such a treasure of controls provide in ASP.NET, it should be very well maintainable. In fact the answer may be no. Let take the example of gridview. Lets say I connected my gridview to a stored procedure (SQL) and per design changed, I added one more field to be passed on to my stored procedure, I should be able to update that right? The answer is no. I have to wash all my previous bounded values (which could be 10 or more) and start binding them again. You can change one parameter again and you see how much work it is. Most importantly you are inject errors when you redo something that increase your developer time and decrease efficiency. The bottom line, ASP.NET is the least flexible language, in fact extremely rigid. It accept things as whole, you change one small thing, and you need to do the complete block again. This is not the case with a well written language. This is similar to $80 TI calculator, you make a type, you can’t go back and fix it. In a $15 Casio though lets you fix your typo, hence less work and quicker results.
- There is no such thing as ASP.NET. There is either ASP.NET with C# or ASP.NET with VB.NET. That really is true. You can not do anything with ASP.NET alone. You can create a form and submit it, but if you want to show a message like “Thank you for submitting the form”, you need either C# or VB.NET. Working with ASP.NET is really working with two seperate languages that has nothing to do with each other. First you learn 1) ASP.NET 2) And then Learn C# or VB.NET. This is not something a beginner will be tempted to do, esp on his own.
- Binding is one of the more powerful features of ASP.NET where you can bind data from a database to a control such as textfield. This is a powerful feature but again it is not well executed. There are tons of improvements that a programmer would want and they are just not there.
- Although ASP.NET uses objected oriented programming and one of the core feature of OOP is code re-usability, data protection and encapsulation. These concepts are almost never used in ASP.NET application, unless the program is fairly complex that it can not be handled efficiently by current design.
- ASP.NET has tons of bugs or design flaws, that simply should not be there. This just show how bad ASP.NET is written. Consider this example. You have two pages page1.aspx and page2.aspx. Lets say these two pages have same control except one. Therefor lest use a single codebehind file and address controls in both the pages from their (code reuse). If you do this you will find yourself in big trouble. I have seen i written by experience programmers but when I file this as bug with Mirosoft, they indeed acknowleged this should not be practiced (but it is duable and quite common). My point this is not a Microsoft Design feature but it works! and it works in quite a bad way. I will not go into detail but to make this work, you have to put all the controls on page 2, into page1 to work any control which should just appear on page2. Now speaking of OOP where data protection and code resulable is the core feature. This of this flaw which shatters all those principles. Worses it is not the first virsion of .NET but rather the 4th! If they have errors like these, it is certain the ASP.NET is not dedicated to fix any serious issue to make the product better.
- Another such bug I would point out is this. Imagine you want to bind stored SQL procedures to sqlDataSource, one for select and one for update. The dialog has this functionality to attach the two stored procedure, but if you do it, what happes? Well in short it does not work. Why? Because you can bind parameters to only one stored procedure in the dialog. The interesting thing is you do not get any error, you can do what ever you want. Your other procedure parameter are just going to be washed and you woul only thing, did Microsoft forgot this feature. Because it is quite obvious and easily to implement but it is not implemented and they wont.
- Now with all these rich controls, feature and Microsoft technology, you might thing ASP.NET is really fast. Well I would doubt that highly. If we find out, how fast an ASP server vs another server spits out a page, that is something I dont know. But ASP page is definitely heavy because variable names are long, there are ton of extra stuff that sometime is added and there is a lot of C# code in the background. My opinion is with all the baggage and ASP code is likely to slower that faster comparing to other open source.
- Many of the controls in C# work like Magic. You heard it right like magic, without sound logic behind. It is like place the control bind some data and boom everthing works. This seems like it is magic because it looks pretty fast once you learn it. The magic design of ASP.NET is extremely bad! Let me say it again, it is extremely bad. In a lot of cases if you go beyond this magic feature and try to tweak your control it becomes more like hell. Things are hard to figure out, the are not intuitive. The syntax looks like it has been written by a B+ student just to make things work. In short customizing these controls can be quite pain in ASP.NET, which might take days and even weaks just just to fix a small issue.
- This is an illusion that you can develop an application faster in ASP.NET because there are built in controls. I am sure if there is a competition between an ASP.NET developer and PHP developer for a moderately complex page which is generally the case, the PHP developer will win by a good margin.
- In short ASP.NET is extremely slow, clumsy, counter intuitive and not well written at all. It does have a strong plateform but that plateform is extremely poorly executed. You can look at the page developed in ASP.NET vs open source such as PHP and you will see a remarkable difference. The PHP page will be fined tuned, unique design, less buggy and neater look. The ASP page will be slow, with tons of bugs and fill. To check for example, check microsoft own site where you can file bugs. Microsoft Bugs, the site is extremely slow. Trying changing the page on the bugs list and you see it takes almost second just to do that. Monster is also written in ASP.NET. The last time I used it, it was quit buggy. The look is not that great either.
The aim of this article is not to dissuade someone from starting with ASP.NET but rather to give them a better idea, is ASP.NET really a good fit for them? You might take the complexity of ASP.NET by the fact that whole books have been written about just one ASP control, that is the GridView.
You might well like a lot of ASP features but the problem is, it is really poorly written. To customize a small thing, you might go into a day of work. Things are generally n But generally it is hard to work with it. To customize one small thing, you go into unexplored areas to find the solution. It is just too much work to venture to these areas for little problems. Of course one purpose of this document is to show my frustration with ASP.NET. I never had any such problem with PHP. It was a straight learning curve. I could do an easy job in 10 min. A difficult job in 1 hour and pretty complex job in about 4 hours. This is not the case with ASP.NET where a pretty complex takes 3 days at least, compelex takes 1 day at least and easy is what it takes 5-10 min.