Revelations I've Had While Trying To Learn ASP.NET
Alright, at work I've been told I have to build a web tool that takes a 40 question survey, analyzes the answers given, then based on the answers generate custom content from a large stack of documents. Fair enough. The catch is I have to do it in ASP.NET, and not PHP because ASP.NET is supported by IT whereas PHP is not (despite the fact that IT runs serveral PHPNuke sites, which obviously relies on PHP).
So, I've been trying to learn ASP.NET for the purpose of building this tool. In the short time I've been at this, I've been frustrated by the needless layers of complexity Microsoft introduces into the process of building a dynamic web page. This is the first part in what will likely be a multipart series of articles in which I compare and contrast PHP and ASP.NET. This will be the foundation for a later report I've been asked to write for the head of the Architecture Practice here to show the relative merits of adding PHP to the supported list.
I admit I'm biased here by the fact that I am familiar with one, but not the other. However, I'm going to try and limit my points to items where there is a clear difference between the two... Each of these articles will compare and contrast the two on a specific problem I'm encountering.
1.) How Much Do You Need To Know?
Ok, lets say you want to create the most basic dynamic page. All you want to do is have a form with a text field that you fill in with whatever text you like, and when you click submit, it loads a page that displays that text and nothing more. No databases, nothing complicated. How much do you need to know to do that in either language? Well, let's take a look...
PHP
Languages Needed: PHP, HTML
Solution method: The form page is simple HTML form, all it does is POST to the target php page to display the text. The target PHP page grabs the posted field, assigns it to a variable and prints it to the screen. Lines of code in PHP... 2.
ASP.NET
Langauges Needed: ASP.NET tags, HTML, VB.NET/C#/Whatever your desired .NET language is... so in essence, 3 languages
Solution method: Well, in ASP.NET, you don't POST to other pages, you POST back to the same form, write a button click event that processes the information and assigns it to a variable. Then either redirect everything to a second page, or load the variable as a label somewhere on the original page. Lines of code? Too damn many. I still haven't figured this out properly. I know for damn sure it's a lot more than 2 lines though.