ASP or PHP

Written By: Timothy Fish Published: 5/31/2008

When I wrote Church Website Design: A step by step approach, it was necessary for me to choose a scripting language. The language I chose was ASP, but there are several other languages that I could have used to do the same thing. One very popular server-side scripting language is PHP (Personal Home Page tools). In my opinion, ASP is better suited for people who have little to no experience programming, while PHP is more powerful and more dangerous than ASP.

ASP is based on the Visual Basic programming language. ASP has been modified from Visual Basic, but most of the changes were to make it easier to use the language for web pages. PHP is based loosely on the C programming language. C is a very powerful programming language, but it is not always intuitive, making it dangerous. PHP has many of the dangerous features of C and it also has some additional hacks that compound the problem. There is a tradeoff between the two languages. Both have issues, but PHP has more. Both are powerful, but PHP seems to be more so. Both are fairly easy to use, but ASP seems to be more so.

Some Dangers

Both ASP and PHP have case-insensitive keywords. The good thing about that is that if the programmer happens to hold the shift key a moment too long, the program will work anyway. It is harder to read the code, but it will work. PHP has an added complication. Variable names in PHP are case sensitive. This means that while echo($A); and ECHO($A) are equivalent, echo($A); and ECHO($a); will do two different things.

Another problem is the problem of being loosely typed. Both languages have that problem. One of the places where this can be a big problem is in the equality comparison of floating point numbers. In a loosely typed language, a variable could begin as an integer value, become a floating point value through a math operation and then be compared to see if it is equal to another number. The result may come back false when we are expecting true.

Some Nice Things

PHP has an advantage over ASP in that it is object oriented. Object oriented programming, when used well, is a very useful feature. Given that PHP is primarily used to determine which HTML code will be passed to the user, there are probably very few web pages that use it, but it is there to help break down the code into manageable pieces.

Other things that PHP is able to do include, creating dynamic graphics and PDF files. This makes it possible to provide the user with more information in the way we intend for the user to see it.

The Ideal Language

I am not convinced that ASP, PHP or any of the other server-side scripting languages are truly ideal for webpage development. Unfortunately, they are all we have. Yes, they have their problems, but we have to work with what we have. In that type of situation, it is best to use good coding practices, such as forcing yourself to treat the language as case-sensitive and never using integers and floating point numbers in the same operation. When good coding practices are used many of the problems never become a problem.



www.timothyfish.com