Web Programming Languages
Jim
There are many important things to consider when picking a programming language for your next web application. I’m assuming you’re not confined by the standards set by your company or web shop.
I’m not as highly-educated on Ruby/Rails as I could be. I’ve sampled the language, and the more VB-esque style of programming, which is intended to be easier to read/write is actually a turn off for me. The rest of this post doesn’t incorporate Ruby on Rails.
ASP.NET (C#)
I’ll make no secret that I’m an avid C#.NET developer. I was bred to be a C++ programmer in my freshman and sophomore years in college, but Java was the big thing up and coming in the second half of my schooling. C# entered the scene as a hybrid which bridged the gap between C++ and Java. Having learned both languages, I didn’t quite understand why I needed C#, but I love to learn new things, so I picked up the free compiler and wrote some code. I was immediately hooked. As quickly as I picked up C# the programming language, I realized its potential for the web. I started studying ASP.NET, and I soon took my first job utilizing my new found skills.
What I like about ASP.NET (C#):
- The ability to extrapolate the code logic from the display logic.
- C# is completely object-oriented code.
- I can compile my code and sell it off to my clients without disclosing logic which might be proprietary.
- I can write code in a language which is strict and type-safe, which makes debugging easier, more secure, and less prone to error.
- I can take the majority of my compiled libraries and use them other places (since there is no display logic).
What I don’t like about ASP.NET (C#)
- It’s costly. ASP.NET requires IIS (on a Windows Server) - which requires a license. Try finding a quality Windows hosting environment.
- It’s not portable. Sure I can run the majority of my C#/ASP.NET code on Linux using Mono, but the stability, and reliability isn’t there yet, not to mention Mono isn’t quite as mature as the .NET framework.
- Re-deploying a compiled DLL requires the application to be restarted in some cases.
- The .NET framework is enormous, and you often find out later that something you implemented long-hand is in the framework somewhere already.
- Microsoft seems to be fine with releasing a new version of the framework (which requires a new development environment) every two years, which is hardly enough time for any quality organization to migrate before the current platform is out of date.
PHP
My first career job was as a PHP developer. I’m fond of PHP. It writes easy, and gets the job done fairly quickly.
What I like about PHP:
- Writing code is fast and easy. (If you’re familiar with the Perl and C/C++ coding style and syntax)
- It’s free!
- The code is portable. I can run the same PHP code (in most cases) on IIS (Windows Server) that I’m running on Linux.
- A huge development community.
- The language has plenty of built-in functionality which makes developing code easier
What I don’t like about PHP:
- PHP is neither strongly-typed nor type-safe. This means I can create a variable like $x = 2; and then reinitialize the same variable as $x = “hello”; later on in the code. At any given point I don’t know what type of variable $x is. This makes debugging difficult.
- Inherently PHP does not permit you to easily separate code from output. This makes for sloppy HTML and sloppy PHP code.
- PHP exposes my code logic. I could “obfuscate” the code, but not without something third-party.
- PHP is interpreted, not compiled with reduces performance and scalability.
- The PHP syntax is quarky. There is almost no right or wrong way to write code, so if I’m trying to figure out someone else’s code, it’s almost impossible without help.
Java/JSP/Servlets
I’m fluent in Java, but I’m never going to use it for the web again. I’ll spare you the likes and don’t likes about Java, because there’s not much I enjoy about Java on the Web. PHP and C# were built with the web in mind, but Java wasn’t. In order to make it work (and it does work well) on the web, we need to add some framework and an application server. We also need to add some obscure configuration utilities, and complicate things by incorporating the filesystem in some cases.
Although I enjoy coding in Java, it’s not so much nicer than C# that if given the choice I wouldn’t pick C#. The problem I have with Java for the web is that nothing about it is straightforward. It’s difficult to implement anything the way you’d expect to, and like a tale of folk lore, the only way to learn how to do it properly is to have it handed down from one generation to the next. I avoid Java on the web if I can.
Between the ASP.NET and PHP platforms there is no real winner. It all depends on the project at hand. If you’re on a budget, or working on a low-traffic, low content site…I’d almost always simplify things with PHP. Combine PHP, MySQL, and a good template engine, there’s almost no site you couldn’t implement. ASP.NET is right when the structure of the project is more important than the speed with which you need to complete it. It’s more scalable, and more secure than PHP. Use any database you want, and create an extremely capable web application.
Posted in Web Programming |
February 19th, 2007 at 3:34 pm
While I agree that it’s best to always pick the right tool for each job, .NET’s lockin and cost make it a bad choice for every situation. For portability, support, and cost I always choose PHP or Python for web development.
February 19th, 2007 at 3:40 pm
I completely agree with you. Most of the contract work I do is in PHP - I’ve never been much of a Python fan. It’s fast, easy, and there’s tons of support, but the engineer in me is always concerned whether or not PHP is letting me do something in code which I shouldn’t be doing.