Intelligent use of server side languages

There are two types of web language, client side languages run on the visitor's browser, server side languages run on the webserver itself. The great thing about server side languages is that it doesn't matter what software your visitors are using to visit your site, all of the difficult work is done on your webserver. You do not have to worry about what browser your visitor is using and what plugins they have. If you use a hosting company, it will usually mean you have to pay a bit more for your hosting package to be able to use server side languages.

It is possible to write server side programs using C/C++ or other compiled programs, but this can be very difficult and I'd only recommend this if you are VERY competent at these languages. And even then, I'd have my doubts. It is very difficult to find a hosting company that will allow you to use C/C++ or other native programming languages because it is so easy for you to do a lot of damage with these tools. If, for some reason, you really want to, or really need to, use these languages, you will probably need to run your own webserver. I think the only real advantage to these languages is the superior performance that is possible with them. I say "possible" because if you are not a particularly good programmer it is also quite easy to introduce memory leaks and other poor algorithms that will make your code run slowly.

Perl was the first practical server side language, and, in my opinion is still the only one worth considering. It is one of the most powerful languages available and is capable of much more than just running websites. Entire software packages have been written using Perl so it is a very capable language. There are also some handy features to make Perl very stable for websites and take out all the hard work. Perl has the ability to stop itself crashing (under the majority of circumstances) if you've done something wrong and display the appropriate error in the web browser or anywhere else. I'm not aware of any other language that can do this. This means that your visitors should never be left wondering what's going on when they get a 500 server error, you can give them a nice friendly message telling them that you will fix the problem as soon as possible. Perl is an extremely fast language considering its phenomenal power, it is clearly designed by some very intelligent people. I will be providing at least one special Perl article with useful tips and code examples in the near future.

PHP is basically a copy of Perl but with all the good bits taken out and a load of security holes added. Excuse my cynicism, but it was a nice idea that was done very badly. It has basically taken all the lessons that have been learned over the past 50 odd years about how to write a programming language and ignored them. The lack of locally scoped variables is unacceptable in a professional programming language. Having said that, it has made some things very easy to do and could be considered a useful beginners language for creating basic websites. It is also considerably more stable than some other languages (except Perl obviously). Despite my list of criticisms of the language, I have still used it. The advantage that PHP has over Perl is that PHP runs inside the Apache Webserver process itself, whereas Perl needs to spawn a completely new process on the server. Spawning the new process takes extra time so a short PHP script can run faster than a short Perl script. Often though, the faster performance of Perl can even outweigh the performance hit of spawning the new process for longer scripts. Some hosting companies put a limit on the number of processes that you can run at any one time, so if you have a large number of visitors, some of them will receive 500 server errors if you have too many processes running. I use PHP on my standard pages for putting my header and footer on the pages. This is not doing anything particularly dynamic so spawning a new process would put an undue drain on resources. Perl is much more powerful for actually coding and dynamic pages.

ASP is a server side language that only works on Windows servers. As you wouldn't dream of using a Windows server of your own volition, you shouldn't ever consider using ASP. However, if you have no choice over the type of webserver you are running, still don't even consider ASP. I have never actually used it myself but from experience visiting other website, I've found that I get more errors from websites written using ASP than any other language. I think that says all you need to know. It is unreliable and unstable. You can't have been using the internet for very long if you haven't come across an ASP error.

The next most unstable and unreliable languages are JSPs and Java. I receive a hell of a lot of errors from websites written using these languages as well and because they don't capture the crash and send a useful error message to the screen like Perl, you have no idea what has happened. The problem with using Java and JSPs is not so much that Java is a naturally unstable language, it's fairly easy to compensate for this with good quality code. The biggest problem is that the people who write Java tend to be poor quality programmers. Java is a very easy language to write, and so a lot of people can do it. Unfortunately, there are a lot of people that use Java and most of them are not particularly proficient at programming. It has reached the point that I now hold a prejudice against Java programmers, especially if they are only capable of programming in Java and no other languages. Java is a decidedly average tool so if you are content with average, that's not a problem.