Jump to content

PHP vs ASP


sh0wtym3

Recommended Posts

I've only been using PHP so far and I love it, but I was wondering if its worth learning a whole new programming language? Are there things that ASP can accomplish that PHP can't?

 

It's not a question of whether one language can do something that another cannot.  The question, rather, is if one can do something better than the other.  All programming languages have their pros and cons.  PHP is no exception.  It's how you leverage their pros and minimize those cons that matters.

 

ASP.NET (which is what I'm assuming you're asking about, as there's not much demand for 'classic' ASP) is a decent platform.  It has a lot of nice, powerful features built-in, and its close ties to Microsoft's various IDEs make it easy to use.  Indeed, one of its benefits is that non-programmers can create fully functioning dynamic pages/sites by drag-and-dropping controls onto the design surface of the IDE and the various configuration wizards.

 

There are drawbacks, too, of course.  Given the way ASP.NET works, you have less control over everything.  CSS can be a pain in the butt if you like using element ids to apply styles.  There's the web.config and machine.config files you need to be aware of.  And the ASP.NET page lifecycle can be difficult to grasp at first.

 

As to whether or not it's 'worth' learning another language, of course it is.  The more languages under your belt and the more skills you gain, the better your employment opportunities will be.  You shouldn't lock yourself into one technology.  There's no guarantee that PHP will remain as popular as it is, and there's no guarantee that the PHP of the future will resemble what we have today.

Link to comment
Share on other sites

Thanks!

 

I think I'll find PHP easier and more useful since I like control. But you made an excellent point in your last paragraph.

 

Depends on your plans.  What do you plan on developing?  What are your goals?  PHP also has a very easy learning curve.

Link to comment
Share on other sites

PHP also has a very easy learning curve.

 

That's not necessarily a good thing in the grand scheme.

 

That's not what I was implying.  The OP mentioned that he would find PHP easier, I was just confirming that.

Link to comment
Share on other sites

The .NET platform is used by a lot of companies... why, I have no idea.  I personally find it bloated and difficult to grasp, but it may come down to Nightslyr's comments about the page lifecycle.  It just seems like there are so many hidden parts and pieces to consider.  You might as well be developing a piece of desktop software in regards to complexity and whatnot.

 

I've faced ASP several times in my life and it has won almost every match thus far.  And I have over 10 languages under my belt.

Link to comment
Share on other sites

With ASP.NET, I've found the following page to be invaluable: http://69.10.233.10/KB/aspnet/ASPNET_Page_Lifecycle.aspx

 

Page_Load() doesn't do what it looks like it should do.  I've found that putting my code in Page_Init() and Page_PreRender() is a much better way to go.  This is especially true when trying to figure out event handling - events are fired after Page_Load().

Link to comment
Share on other sites

I think you're asking this question in the wrong forum although I expected a much more fierce discussion  :P

 

If you don't have much programming experience at all then PHP will be easier to learn for most people although you will still need some time before you have learnt enough to produce good code.

 

If you are looking for a professional career then I would advice you to focus on .NET first since there is usually a greater demand and therefore generally pays better. That is if you have to choose one over the other. There more you know the more attractive you will be as long as you somewhat in-depth knowledge. As mentioned already many companies use .NET since it is nonetheless a very powerful language (especially compared to old classic ASP which is still used in some older company systems) that goes well with a lot of company software products.

 

I personally tend to use .NET mostly in my professional work and PHP for personal use. I would say that .NET is not as well suited for (exceptionally) heavy traffic as PHP is but for most websites that is not an issue.

 

The language doesn't matter that much to a good programmer though. Many "real" programmers (Java, C++, Pascal etc.) I know have a decent grasp of web scripting as well.

 

I wouldn't say you have less control in ASP.NET though, it's just that it seems that way in the beginning since it is more structured and fixed in its nature than for example PHP. Once you learn the techniques there is virtually nothing that can't be done in .NET as well.

 

Also, .NET is not really just one language, it's a framework where you can use C#, VB and JScript to mention the most common languages. I prefer C# myself but that's more of a personal preference.

Link to comment
Share on other sites

I think you're asking this question in the wrong forum although I expected a much more fierce discussion  :P

 

What forum would be the correct one?

And yeah, I was expecting a room filled with cannibalistic people shouting obscenities while hurling chairs, stools and feces at one another...

Link to comment
Share on other sites

If you are looking for a professional career then I would advice you to focus on .NET first since there is usually a greater demand and therefore generally pays better. That is if you have to choose one over the other.

Totally depends on where you are I'd say the demand for PHP and .NET is about the same in the Netherlands.

 

I would say that .NET is not as well suited for (exceptionally) heavy traffic as PHP is but for most websites that is not an issue.

On what facts do you base that just curious.

 

 

Link to comment
Share on other sites

If you are looking for a professional career then I would advice you to focus on .NET first since there is usually a greater demand and therefore generally pays better. That is if you have to choose one over the other.

Totally depends on where you are I'd say the demand for PHP and .NET is about the same in the Netherlands.

 

I would say that .NET is not as well suited for (exceptionally) heavy traffic as PHP is but for most websites that is not an issue.

On what facts do you base that just curious.

 

Yeah, it does probably vary depending on where you live but I assume that .NET developers are much fewer overall?

 

The heavy traffic thing might not be entirely true although .NET sites do in general tend to load slower even if there are exceptions. Most high traffic sites here in Sweden are PHP based. It is easier to implement lighthttpd, Sphinx and other high performance tools.

 

You can read some interesting notes here:

 

http://misfitgeek.com/blog/aspnet/php-versus-asp-net-ndash-windows-versus-linux-ndash-who-rsquo-s-the-fastest/

Link to comment
Share on other sites

The heavy traffic thing might not be entirely true although .NET sites do in general tend to load slower even if there are exceptions.

 

But, can you determine if it's ASP.NET that's causing the slowdown, or a chunky UI and/or db setup, which tend to be more of an issue with page loads?  I ask, because the link you gave confirmed my own suspicions that ASP.NET is actually faster than PHP, which isn't surprising if you think about it - it's an issue of compiled vs. interpreted languages.

Link to comment
Share on other sites

It depends on how you code it. A framework will always have a larger overhead that just plain code.

 

<?php
echo 'Hello World';

will for instance always be faster than the simplest ASP.NET hello world thing.

 

Then there is the issue of configuration and hardware.

 

It's difficult just blanket stating that either is the fastest.

Link to comment
Share on other sites

It depends on how you code it. A framework will always have a larger overhead that just plain code.

 

<?php
echo 'Hello World';

will for instance always be faster than the simplest ASP.NET hello world thing.

 

Then there is the issue of configuration and hardware.

 

It's difficult just blanket stating that either is the fastest.

 

That's a good point.  Also, now that I think about it more, the tests used in the link tested ASP.NET's background code.  ASP.NET doesn't have native loops or file handling - that's all done with the code-behind languages.  So, it's not really a PHP vs. ASP.NET battle, but a PHP vs. C#/VB battle.  The ASP portion is essentially the server controls, which I'm betting would be slower to render than straight HTML, even if the PHP in question was using a template system, or some other form of OO for output.  ASP checks the user agent of the browser currently accessing content, then decides how to best render the controls based on that info.  That must incur a pretty hefty cost.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.