Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Confusion betweenPHP platform or Dot Net platform

I am confused between choosing PHP platform or Dot net platform.I am seeking suggestion from you which platform should I choose and which one is more robust and easy to learn?Also which one is more demanding in job?Many said that PHP code becomes very inefficient due to open source platform and sometimes messy also.

1 Answer

I'm not tremendously experienced with either, but here are my impressions of the pros and cons of each, based on my limited experience with them.

Of course, one of the main advantages of PHP is that it doesn't tie you to a Windows platform, whereas ASP does. But I'll focus on the programming aspects of each.

PHP is very easy to get up and running on a web page and it is easy to sprinkle it into pages amidst the HTML. I think that's one of its biggest advantages, but that can also cause a lot of problems. If you've done any of the PHP lessons on Treehouse, then I'm sure you've seen how easy it is to put small amounts of PHP code in pages. It's also very easy to control the HTML that is created for the page by putting some PHP in the code. With ASP, you can't intersperse code within the HTML as easily as you can with PHP, and it takes more boilerplate stuff to get a page up and running.

However, that ease of adding PHP to a page wherever you want also leads to one of its biggest problems. Since it's possible to have PHP code all over the page and in additional library files, as sites get larger and more complex, the PHP code behind it can become increasingly scattered and hard to follow. Maybe I'm wrong in this statement, but I also feel like there's less of an accepted structure of how things are done in PHP than there is in ASP, which further adds to the tendency for the code to be very scattered.

It's also been my experience that since PHP is open source, it tends not to feel as uniform as ASP at times.

I think that ASP has a bit more of a learning curve than PHP. It also tends to take a little more work to accomplish a task in ASP than it does in PHP since ASP is more structured and the vast majority of the code goes into code-behind files rather than directly into the HTML page. The upside to that is that since it is more structured, you don't wind up with as much scattered code as you do in PHP.

With ASP development, you'll have to choose between Win Forms and MVC. Win Forms is the "classic" way of doing things in ASP. MVC has a significantly different architecture. MVC definitely has more of a learning curse than Win Forms, but the end result will be much more structured, which is particularly beneficial when doing unit testing. I don't know much about unit testing with PHP, but ASP MVC structures your code in such a way that unit testing becomes very easy. I've learned from experience not to underestimate the importance of unit testing.

Overall, I think PHP is faster and easier with less of a learning curve. ASP trends to produce more structured code, the benefit of which increases as the site gets larger and more complex. And of course PHP doesn't tie you Windows if that is a concern.

Thank you so much for your very constructive,helpful and elaborate suggestion Ben.Frankly speaking,I am new to this field but I am highly interested to become expert in this field.Is there any way to follow you on twitter?Thanks.

I'm flattered that you want to follow me, but there are plenty of people online who are way more knowledgeable than I am about this topic (plus, I'm only on Twitter to follow food trucks so I don't tweet much). Stack Overflow is one of the best resources for programming questions. Don't worry; everyone was a newbie once. The fact that you're interested in learning already puts you beyond most other people.

My suggestions is to learn the basics of PHP and of ASP, and then see for yourself what your opinion is. There are a ton of languages and development environments out there, so I think you'll be better off understanding a range of languages rather than becoming an expert in one and not knowing any others. Even if you get a job based on knowing one language, chances are you'll be required to learn others during the course of your work.

It'll probably only take a few hours of running through the Treehouse PHP lessons to become comfortable using PHP and to get a good idea of its features.

Thanks again