views:

1087

answers:

13

This question has been around my head for the past months but I have been reticent to post it on here due to the subjective nature of the question, but here goes.

I'm a software engineering student and have been looking for quite some time to get serious about web development. I've done basic stuff in the past, mostly XHTML/CSS/Javascript, but have yet to touch a server side language. I have played with a little bit of PHP in a recent project I'm doing with some friends but nothing major. So I was wondering: should I learn PHP or ASP.NET?

I have searched around for answer but haven't found a perfect answer yet. The documentation on the PHP website is great, there are a ton of PHP hosts out there and it seems to be very easy to learn. But at the same time, most people I know (in fact almost all of them) who know one of both language knows PHP, so wouldn't learning ASP.NET differentiate me from the pack? Also, being a MSDNAA member, I have access to the entire Microsoft stack, so I guess it would be as easy to get started as with a LAMP stack?

I have a good background in C/C++ and have solid skills in XHTML/CSS/Javascript. So given my situation, should I start with ASP.NET or PHP? (I do plan on learning both at some point.)

+1  A: 

I don't know if there is a "perfect answer", but if are looking to learn a language that will give you more options when job hunting, I would suggest PHP.

Ed Swangren
I see, but my father who is an IT consultant keeps on telling me that PHP developers earn less then their C#/Java counterparts. But he seems biased against PHP so other input are greatly appreciated. Thanks!
Gab Royer
PHP is still the dominant web development tool out there. I can't say that I know a lot about the going rate for ASP developers, but you will have more options with PHP. Now, if you want to learn a fun, interesting language, I would vote for Python all the way.
Ed Swangren
I did some basic python for solving project Euler problems and really liked it! But can you do web-developpement with it?
Gab Royer
+2  A: 

I've done both, and lean slightly towards ASP.NET. In my opinion it encourages programmers to produce better code, by separating code from UI (with code-behind). You can write the code in C# (which is quite similar to C++ but protects you from pointer problems) and the experience of using C# can make it really easy if you want to write C# applications for Windows.

That said, PHP is very popular and if you would be interested in part-time work, there seem to be more part-time telecommute opportunities available to develop websites using PHP then there are for ASP.NET and J2EE. You could always learn ASP.NET first and then learn PHP later, since PHP is pretty easy to learn.

Best of luck.

Jon
Also, PHP includes classes and object-oriented design now, but the fact that you don't have typed variables and that the code is interpreted can lead to finding bugs at some point in the future (runtime) instead of finding more at compile time.
Jon
@Jon - So is this a 'con' to PHP then?
Gab Royer
Yes, for the most part. I think it's a good idea to take the time to learn ASP.NET if you have it. But also going through the PHP tutorial at least would be great so that you'd have that diversity.
Jon
+3  A: 

It depends on what your goal is.

There is no cheaper hosting option than PHP and it's truly ridiculous what $5/month buys you these days. ASP.NET hosting has of course gotten cheaper still but it's not as cheap as PHP. If you want to build and host a website and keep your costs down, PHP is a very compelling option. PHP is the most popular language for Web development bar none.

ASP.NET is part of the entire .Net framework, can be (and usually is) programmed in C# and can do a few things that are awkward/hard in PHP (eg background processing, multithreading). C# is a strongly-typed language (compared to PHP, which is loosely typed) but is tied to Windows (Mono notwithstanding). ASP.NET is more common on "enterprise" (business-centric) type applications.

Each has their advantages. There are lots of jobs for both. You don't actually say what it is you want to achieve and that's really what it comes down to. None of these two is inherently better than the other, they're just suited to (slightly) different things.

cletus
+1  A: 

It really depends upon your perspective.

Job-wise, I find that ASP.NET offers more money than PHP. The jobs that I find for ASP offer a significant higher salary than PHP.

However, if you're adept with PHP, you're more flexible with the other languages out there since PHP is much much similar with most programming languages.

Given with your situation, try both and see which one looks good. I've tried both but I like PHP better but if I have the chance to go back to college, I'll maybe master ASP.NET

Mark Serrano
+1  A: 

I think PHP jobs are more readily available, but they might generally pay less than ASP.NET jobs. So, if the goal is learning something that is going to get you paid, Microsoft is a good bet. But it's sometimes also "unlearning" everything else you know to do that, so keep that in mind.

On the other hand, if you just want to whet your appetite on how to build better web applications, I think if you are going to learn a server-side language you should learn python or maybe ruby, as while their syntax is sometimes significantly different than the others, they provide some very powerful functionality within the language that helps you to think more about engineering and less about syntax.

In the end, ideally you'll be developing AJAX based applications as much as possible, and any enterprise grade applications you develop will probably be within some form of framework, such as Django, RoR, or maybe Symfony and a lot of your coding will be conformed to whatever the framework is. In that case, the syntax of a language is less important than understanding programming in general.

If you really want to get into the guys of engineering, learn C/C++ and Lisp, cause most everything is based on programming paradigms that evolved from those languages.

+1  A: 

I think the best option would be to learn both. You are not limited to a single technology and the lessons learned from one, can, and will, benefit the other.

As for salary, it depends on the company you join. Obviously, companies like Yahoo, which do a lot of development in PHP, will pay comparatively to companies that develop solely with ASP.NET.

Michael Morton
Thanks for the answer! I was planning on learning both at some point, but which one do you think would be better to learn first?
Gab Royer
PHP or ASP.NET MVC first (it doesn't matter), and then, if you really want to, ASP.NET WebForms. ASP.NET WebForms is an abstraction that hides a lot of how the web works in order to make it "easier" to develop on. Missing out on knowing how everything functions would be detrimental.
Michael Morton
+2  A: 

Learning C# and the .NET framework may come in handy later, too.

If you one day decide you want to become a desktop applications developer (WinForms or WPF) or make a game for PC/XBOX in your spare time (XNA Game Studio) your C# and .NET framework experience will make it much easier.

I imagine a C# programmer could learn Java pretty easily too.

MGOwen
+8  A: 

My answer is similar to the others, in that it's really going to depend on what your goal is. However, I'd say "Why not both?"

PHP has established itself in the small-to-medium sized business market. Individual webmasters and small companies use it a lot. It's cheap and easy to set up. Programming PHP gives you a much better low-level understanding of how the web works as well, since it doesn't hide everything in weird "page life cycles" or anything like that. However, more often than not, the code you run into is terrible. I program PHP for a living, and I have yet to take on a client who has an existing site where the code wasn't absolute cow poop.

ASP.Net is making waves in the web programming world. It's nicely structured, well designed, and seems to have some nice features which could see it start to make inroads into the small-to-medium business market. However, generally Microsoft products are only used in the medium-to-enterprise market, due to the fact that there is a higher entry bar, higher initial and support costs, and require more effort to set up servers and environments. The code quality is, however, generally much higher.

If I was starting from scratch, and had access to all the .Net products and environments I needed, I would start with ASP.Net. It will enforce some better programming practices and a more thorough understanding of OO as applied to web programming. Then I'd recommend taking that knowledge and applying it to PHP using modern programming techniques (MVC, good architecture, etc). With skills in each area, you'll be able to take the best of each and determine the easiest and best ways for you as an individual to produce web code.

As a disclaimer, I don't know ASP.Net (yet), but from what I've heard, I've decided that I'm going to learn it, and I fully expect my application designs (maybe not programming ability, but definitely design) to be improved as a result.

zombat
Thanks, that's the kind of answer I was looking for
Gab Royer
+1  A: 

Why are you limiting your choices strictly to PHP and ASP.NET? There are more languages and frameworks out there for serious web development. It really does depend on what you want to achieve.

Are you just looking for whatever will get you a job quicker, or are you in it for the challenge or learning experience? Sure, PHP is nice to know since it is so ubiquitous for web development, but does it really make you a better programmer?

Do you like the idea of working at a corporate-type Microsoft shop? If that's the case, go for C# / ASP.NET. It's a nice language and framework, especially if you're coming from a C++ background.

But, if you're planning on starting a project on your own, I'd advise you learn something substantially different in style and paradigm, and open source since you don't have to pay for Microsoft licenses and hosting. I'd recommend Common Lisp, but it is not for the feint of heart. (However, Clojure might be a good starting point since you wouldn't have to go through the pain of CL libraries.) Alternatively, I'd recommend learning Python first.

I don't want to start a flamewar or anything, but all I'm going to say is to think twice if you decide to learn PHP—there are better languages to learn out there, even for the web.

One thing I'll advise though, regardless of the language you choose, learn the language first (and how to program in that language for the web) before learning any of its web frameworks.

felideon
Agreed, I should not limit my choice only to those. I never really considered Python. I tried it for project Euler and ended up liking it a lot! I might consider it! Thanks!
Gab Royer
A: 

In addition to looking at the hourly rate of programming language x. I think that there are a couple of other things that should be taken into consideration.

  • Firstly, what kind of projects do you want to work with, their may be different types of projects that are implemented in each programming language.
  • Secondly, as a profession, we should have more focus on how we deliver value to the customer, not just which tools we use. If we got paid for the value we deliver, not just an hourly rate, it could be much more lucrative.
Shiraz Bhaiji
A: 

Go to a job advertising website, search by keyword for "ASP.NET" and note the number of listings, rough average salary, types of jobs, etc.

Then do one for "PHP" and compare.

MGOwen
A: 

you can do what PHP can do in ASP.net and vice versa. Who said that PHP only for small/medium company ? Enterprise might utilize PHP for their web application engine (since you can colaborate between java , .net, php and others as well like using web services)

I would prefer to use PHP than ASP.net.

  1. PHP is developed by community.
  2. you can choose between some good frameworks that available on the internet (codeigniter, kohana, zend framework, propel, cakephp , symphony, etc). while on ASP.net it is limited.
  3. many good CMS built on PHP (drupal, joomla, wordpress etc) and they are mature enough.
  4. php classes are easy to get from everywhere.

btw, stackoverflow using asp.net for their engine .... i think we need to create php version .. ... kidding :D

nightingale2k1
A: 

MSDNAA is a great thing, but unless you'll still be a part of it when the next version of SQL Server (or Visual Studio) comes along... bam. Big costs.

On the other hand, the number of php coders out there is staggering. If you become a talented .NET programmer, you might (should?) have better job prospects, which would offset the cost of software.

My suggestion: try both out for size. Then you'll know for sure which you like better.

nilamo