Voting at DZone is super easy, but you aren't logged in. Login and vote now.
By skoop
via codeutopia.net
Published: May 02 2008 / 09:13
Sometimes I’ve seen people say PHP is a bad first language, because it teaches bad programming habits. But is this actually true at all? Often those who say that don’t really like PHP themselves either, many times because of equally untrue reasons.
I think PHP is a perfectly good first programming language - I would even go as far as say it’s possibly the ideal first language if you are interested in web development.
Comments
planetmcd replied ago:
I would say generally it is not. Ruby or Python would be better choices as they are more all purpose languages and don't require setting up a web application environment to learn. You can just install them on your computer and follow through some online resources (I think How to think Like a Computer Scientist using Python is a good resource for rookies). Additionally, while you can do web applications with any of them (and PHP has the lowest barrier to entry in this realm), you cannot generally use PHP for anything outside of web application development. Learning on a more robust language will not hinder you from using PHP down the road.
antych replied ago:
I'd say it's very good because of low entry point and popularity. It doesn't mean there are no better choices, but I'd never say it's bad.
Tantalus replied ago:
It's a bad language period, but it's especially bad as a first language because the quality of code examples on the internet is generally atrocious and promote bad habits. It's also a domain specific language that is useless elsewhere. Your first language is better to be a general purpose language. Java, Scheme or Python I would recommend.
lifewithryan replied ago:
PHP is hardly a DSL, though I do agree with your assessment of the quality of code examples on the net. That being said, you can actually write client GUIs using php-gtk (not that you should, but you can...hrmmm you can with ruby as well, again, not that you should, but you can), oh...and Python...which really wasn't designed for the web...or Scheme...so by your example, perhaps those aren't the best languages to learn from either then since they were designed for specific purposes as well?
It all depends on what area you want to focus in, and who you're "support group" is...if they're good programmers, they won't let you make the bad mistakes..surround yourself with good programmers and glean all you can from them.
So, how much PHP have you written? How long have you worked with it? To have such strong opinions, it'd have to be alot, so please...explain
Tantalus replied ago:
I don't mean DSL in the sense that Rubyists have gotten obsessed with, but in the more colloquial sense of 'it's worthless outside of one problem domain, viz. web programming.' I mean, I could write a thick client in PHP, I could also write cgi in C++, and I hope I would be fired for either one. It's never the right choice. I'm not sure what specific purpose you think Python had in mind when it was designed or what it means to say Python or Scheme wasn't 'designed for the web' -- neither was Ruby, and yet Django and Rails are two of the best frameworks. But even if they weren't, who cares? Since when did web programming become the sine qua non of programming?
I used to work in web hosting for a long time. I've had to patch the PHP source code back when everyone was still running it as an apache module with the permissions of the server instance, and hack up all manner of app to work with auto-installers. Even widely used apps are often a mess of mixed logic, and the language itself of course has several well known deficiencies that are only starting to be addressed. Finally getting namespaces! As an easily deployable and sophisticated template language, it's lovely. But a programmer who is starting out should be learning the basic principles of programming, not how to be a web monkey, and PHP does not lend itself to that -- it has no closures, no proper anonymous functions, crap recursion, etc. etc.
Voters For This Link (8)
Voters Against This Link (1)