Game of Hosts: PHP vs. .NET
If you’re a software developer, there simply isn’t enough time in the world to learn every single technology, language and platform you might need for work, or to land a better job; at some point, you’re going to have to decide in what direction you want to expand your knowledge base.
The choices you make in that regard will have a huge impact on your life. If you devote too much time to learning a technology that’s on the verge of obsolescence, it could make future employment a problematic affair. Fortunately, there are lots of technologies that will continue to grow and prove useful to the world for the next several years—but how do you choose between those?
With all that in mind, let’s look at PHP and .NET, two programming platforms that enjoy broad bases of support. PHP is a general-purpose scripting language that many people rely upon for Web development (hundreds of millions of websites leverage it today) while .NET is a framework built by Microsoft for Windows-related Web work. While it’s certainly possible to learn the intricacies of both platforms, is there one worth tackling more than the other?
First, What’s the Difference?
As mentioned above, PHP is an open-source programming language primarily used for developing Web-based applications. There are a few tools out there that allow you to use it to write desktop applications, but the majority of apps written in PHP run on a Web server (most people using PHP seem to do so with an Apache server, although a few also rely on Microsoft IIS).
PHP is a language, but .NET is a whole platform comprising a few different technologies. There are two main languages you can use with .NET to create either desktop or Web applications: VB.NET and C# (others exist, of course, but those are the main two). As with PHP, .NET requires a Web server (specifically Microsoft IIS) to create Web applications (it also requires ASP.NET, a technology that’s part of .NET’s broader platform).
While .NET is built into Microsoft Windows, you can run .NET desktop applications on Linux using a free and open source product called Mono. PHP sometimes comes pre-installed on Linux, and if not, it’s quick and easy to install. But to develop with either platform, you need some free tools: for .NET, you’ll want one of the free Visual Studio Express products from Microsoft; For PHP, there are several options—one popular choice is Eclipse.
There are benefits to learning either PHP or .NET. Should you learn both? If you’re new to programming, the answer, I think, is No: At an early stage in your career, you need to focus your energy on getting very good at one thing, which will translate into higher-paying jobs down the road. If you try to go to broad, you will stretch yourself thin and not master anything. (I made that mistake early in my career, and it started hurting my job prospects—employers tend to distrust resumes that list hundreds of technologies in which the applicant is supposedly an expert.) Pick one thing and be great at it!
Which Should I Pick?
So which do you pick? Of course, you could take a look at the entry-level jobs for PHP and .NET in your area, and use that data to influence your decision. But that research will only tell you about today: What about five years from now?
Here are some questions to help you work through a possible decision:
- First, do you want to create desktop applications on Windows? Then .NET is a great way to go.
- What about Web applications on Windows? Again, .NET is an excellent choice. However, you can do PHP on Windows (although it’s probably more commonly used on Linux).
- Do you love Linux and want to focus on it? Then go for PHP if you’re doing Web development. While .NET can run on Linux with the help of Mono, it’s more suited to desktop and not Web.
- So what about desktop apps on Linux, then? In that case, you probably want to move away from both PHP and .NET and study other languages and technologies, such as C++ and Gtk+, or perhaps wxWidgets combined with a language such as C++ or Python. While Mono works on Linux, it’s a bit too narrow in terms of entry-level job opportunities.
- If you’re going to go for Windows, do you choose C# or VB.NET? This is a potentially contentious question, with strong opinions on either side. One thing to bear in mind is that they’re actually very similar languages underneath, just with different syntax; you can accomplish the same thing with either. But as a software developer with 25 years of experience, I would probably suggest you go the C# route. My reason is where things become contentious: VB.NET has a bit of stigma attached to it as an “amateur” language (even though it’s not). As a result, advanced programmers are more likely to choose C# when starting a new project.