Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have seen an article (cannot find the URL) that says that PHP teaches you how the web works more than others such as asp.net. So in PHP you get the details of web security, how the requests are handled, etc.

It is said that asp.net for example hides the details.

Is that true? And could you say why?

share|improve this question
23  
Php doesn't teach anything. It's a tool. Wrenches don't teach people how cars work. – Joel Etherton May 10 '11 at 14:06
2  
I mean while using it, while learning it. I know it is a tool. A pencil can teach you how to draw better than a pen, right? but at the end you should learn by yourself. – Goma May 10 '11 at 14:09
9  
@user23259: No, practice and a teacher can teach you to draw. A pen is neither better nor worse than a pencil. If you want to learn about the fundamentals of the web, learn about the fundamentals of the web separate from any language, architecture or framework. No one is better than any other. Each was designed to solve a specific problem or serve a specific need. – Joel Etherton May 10 '11 at 14:12
2  
@user23259 as an artist and a programmer I can tell you a pen "teaches you to make less mistakes", PHP does the opposite. PHP teaches you to hack together something with coat hangers, duct tape and twine compared to just about every other language, Perl being even worse than PHP in that regard. Learning by yourself is a bad idea also, you repeat others mistakes and don't even know they are mistakes because you don't know what you don't know. – Jarrod Roberson May 10 '11 at 14:23
2  
@Joel Etherton: You comparison is kinda wrong. Let's assume you want to build a car. With PHP, you've got a toolbox and you need to assemble it by yourself. Afterwards, you know the details quite well. With a high-level framework it's like letting a robot build it for you and take care of details. It's fine if you know how your car works anyway, but you won't learn as much from it if you're new to all that stuff. You won't learn as much from a pencil that writes many things by itself. – Falcon May 10 '11 at 14:54
show 5 more comments

8 Answers

If PHP tought you more about the web than other languages or frameworks, then why are there so many bad-designed PHP applications out there?

No, PHP doesn't teach you how the web works. PHP is one small piece of "the web". It's a tool - nothing more, nothing less.

It is said that asp.net for example hides the details.

Every language and every framework hides some details - and that's a good thing! I don't want to mess around with all the details every time. That's not a bad thing - on the contrary.

share|improve this answer

I would argue that PHP offers a less honest view of what's happening because it doesn't separate the view from the logic. A PHP file is an application which generates output; many people, however, seem to conceptualize PHP as a set of extensions to HTML, which it isn't. The transparent integration of PHP into Apache via mod_php doesn't help fix that, either.

Writing applications in a language like Python or Java requires more understanding of the mechanics of what is happening. PHP allows you to pretend that you're "just writing a web page."

I will also note that most good PHP applications are written in frameworks (like Zend) which impose restrictions on the "familiar" behavior of PHP, allowing you to work within a decoupled MVC paradigm just as you would within other languages' web frameworks.

share|improve this answer

No, it's not. Because it doesn't. PHP doesn't teach you any more about how the web works than any other choice for web applications.

share|improve this answer

PHP has the advantage that it was developed as a web application programming language, this means that its main purpose was that, so every component in PHP is web-oriented.

Other implementations of web frameworks like Java Server Pages (JSP) or ASP.NET are built on top of a multi-purpose language, in this case Java and C# respectively.

So, each web request processing is much complex than PHP, and you can tell just by looking at the call stack on a decent IDE.

share|improve this answer

It is said that asp.net for example hides the details.

Is that true? And could you say why?

Yes, it is true to a certain extent. In PHP you seldomly use proprietary markup like you do in ASP.NET or JSF for example. You most likely write (nearly) pure HTML and not some fancy XML in your view layer.

Then, in PHP, you are very close to the request that was issued, while frameworks like ASP.NET or JSF provide merely an abstraction of it. In PHP you can directly set headers and always access GET and POST variables easily, quite in contrast to both the other frameworks I mentioned, which are quite far away and thus it teaches you a tiny bit more about the http protocol.

Moreoever, PHP does not autogenerate view-tier code by default. Most high-level web frameworks do. If you only use high level abstraction frameworks, you might have problems when you are forced to deal with the details of web programming. I think PHP is a much better choice to learn about web programming than ASP.NET is.

share|improve this answer
3  
-1: This is a very narrow (and inaccurate) assessment of the technologies in question. These technologies provide the same level of access to things you mention. They just also happen to provide a lot of other tools along side it. – Joel Etherton May 10 '11 at 14:23
3  
No, they don't. Just compare the amount of code and framework knowledge necessary to access request headers or request parameters in JSF and in PHP and you know the difference. I'd totally recommend PHP to learn the basics about web programming and not a high level framework. – Falcon May 10 '11 at 14:29
1  
-1 PHP is close to request issued? Try getting request headers from PHP when you're not on Apache SPI. Not going to comment on all the other junk in hope that downvotes will do its job. – Jacek Prucia May 10 '11 at 14:33
1  
@Falcon: I can't speak for JSF specifically. As for .Net, no more knowledge is necessary to access the GET/POST/Session variables than Php requires. If anything, there are elements of the framework in .Net that require a greater knowledge of web fundamentals to implement properly than Php is capable of handling. Your comments do not convince me that you have the experience/knowledge in both languages necessary to make an accurate comparison. – Joel Etherton May 10 '11 at 14:34
3  
+1 for the real explanation of "asp.net hides the details" myth. There is just one element you've not mentioned: the fact that classic non-MVC ASP.NET has statefull controls in a stateless web environment, which makes it very difficult for a beginner to understand how web works, and creates a wrong feel that there is no substantial difference between a desktop application and a web app. – MainMa May 10 '11 at 16:04
show 2 more comments

It does, in the sense that it's quite a low level tool. It's just like using assembly language "teaches you" (makes you deal with) the low level hardware details.

The question is if this is what you want/need to know. For most people the answer is NO.

Actually, the Web is a big can of worms. Dealing with HTML, CSS, and JS incompatibilities is not something many people love. That's why there are frameworks like GWT, which mostly shield you from the details.

share|improve this answer

I'd say quite the opposite. Typically PHP is used in mod_php + Apache combination. Thus most PHP developers lack knowledge of socket programming, low-level HTTP and server architecture, because not only they don't need that, but also because it's not exposed in PHP at all.

share|improve this answer

If it was designed like "do everything with one package", then there would be "lets do this" & "also that" & "a little bit of that should be fine" logic. I never programmed in JSP, have little experience with ASP.Net (though I know how the system works) and again little experience with PHP, my bet would be on PHP, as it is what it says it is. No more, no less.

Because it does the job it handles, it is the perfect tool. And yes, web is like that: compute something, transport that easily, show to the request owner. And because of that, everyone has to admit that PHP does the job perfectly. Come on, admit it, you couldn't integrate so called "view layer" to the "logic layer" this beautiful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.