Just How Bad ASP.NET is written?

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 …

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. No single control is ever enough. As an example, I would take gridview to make my point. GridView has templates, edit templates, footers, header. It comes with a pre-structure which are basically just rows and columns. You are left with this layout if you do not tweak it. If you for example want to have a footer which spans the entire length of the gridview, there is no way to do it. You have to tweak/hack it through JavaScript.  If you have a search query that returns lets says 100 result and your one page shows 20 entries, there is no property that gives you how many search result was made. If you want to implement that you again have to use programming language such as C# or VB.NET. Things that are simple enough and make sense are not implemented in the gridview.
  7. 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.
  8. 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.
  9. There are too many controls but to no advantage. Have you ever looked at a page and say, “this must be built with ASP because it is really rich”. In fact the case will most likely be the opposite. Imagine you are building a house and you have 100 different tools. Another builder is building the same house but he has only 10 tools. The obvious result is, the person who has 100 tools will have far more precision in his work and his house will look a lot prettier than the second guy. This is in fact not true when it comes to web development. The lesser your tools are, the more refined your work will be. The more you will tweak and the better it will look. In ASP, you dont have that flexibility. You can change the GridView in some ways but it will always be the same gridView. If you want to fine tweak it, you will use the fine grain tools like CSS/JavaScript which are used by other plateforms. So we noted that these big controls are actually bad for your website, but wont they speed up your development time? The answer is absolutely no. The reason because they require a good learning curve to get used too first of all and second their implementation in its original form is never sufficient. Most of the development time is in fact not spend in development of the GUI and setting up controls, it is spend on debugging the application and ASP.NET is least friendly when you want to debug a control or an application. One reason for this is you can no put a break point in ASP.NET page. You can only do that in C# or VB code. Second the control most of the time wont spit any usefull error if there is any problem underneath, making trouble shooting timeconsuming and more difficult.
  10. One of the powerful feature of ASP.NET is its event driven architecture. Every control has event just like a desktop application. This is much like JavaScript except that in this case the script is written in C# or VB.NET. While this is powerful thing in itself, the integration of ASP.NET and C# is poor if not extremely poor. Simple events like click and double click are easilyi taken care of but as things go a little bit more involved, the integration suffers a great deal. As an example, if you want to reference a ASP.NET control from C# code, you use its ID field. This works on in simple application but if you add panels or GridView for example, controls inside those controls can not be easily accessed. You have to use FindControl method of the parent control in this case to access that control. For this you have to know where the control actually is. A simple logic would be, keep the ID unique and just access that control by ID but Microsoft did not go with that logic. Often it is needed to access a control on the page, where the programmer does not know where it is or it was ceated on the fly, you have to use a user defined recursive FindControl method through which you can access that control. The point is just a simple task is very hard even though both ASP.NET and C# are products of Microsoft, but the integration is close to worse. If you are using materpage in your design, you dig yourself into more trouble, because access controls on masterpage is addressed in yet another way.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. Now a days technologies like JavaScript, jQuery, CSS among others have become increasingly popular. C# kind of takes the job of JavaScript in ASP.NET  but not everything can be done with C#. You  will require to use JavaScript for various tasks which otherwise you cannot do. The same is true for CSS. Although ASP.NET comes with its own skin features wich is like CSS, for a better customization you will be inclined  to use CSS instead to format the page. If you are going to use javascript and CSS anyone, learning C# to just do a few things, does not make a lot of sense. Why not use fewer technologies than more. The design with PHP, Javascript and CSS is cleaner and easy to maintain than a job in ASP.NET, C#, Javascript, CSS and skins. Also note that ASP.NET uses it own control and they have their own properties.
  17. 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.
  18. 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.
  19. 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.

I would recommend to use open source technology along with JavaScript, jQuery and CSS for development rather than ASP.net with its 100+ features where the end product is not superior than an open source in any way.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s