Latecomer to Open Source Programming
April 20, 2007 4:20 PM   Subscribe

What are some good resources for a ColdFusion programmer who's thinking about going to PHP?

I'm thinking of finally taking the plunge into learning how to do web development using PHP. I've been programming in ColdFusion for over 10 years now, so I'm ashamed to say I'm a bit set in my ways. I need some resources that are geared towards someone really familiar with web development already and just needs to know how to to do x in PHP.

I've gotten L, A, and M down, I just need help with the P. So, just to repeat: beginners guides to web development--not so useful. I want to plunge into the deepend, not waste my time in the kiddie pool.

Also, since I'm taking the plunge anyway, what other Open Source tech should I be putting under my web development belt? I like functional languages, so that might be fun to learn. I tend to prefer languages where I can plunge my hands right into what the database and data are doing.

Books are okay but my budget is currently a bit limited and on top of that I'm in Egypt so getting them shipped here is a bit of a pain (in the rear and the wallet). Websites are peachy-keen and save trees!
posted by Deathalicious to Computers & Internet (12 answers total) 4 users marked this as a favorite
Best answer: The PHP Manual is well written, clear, and pretty complete. You will be constantly looking things up in it.
posted by beerbajay at 5:00 PM on April 20, 2007

Best answer: If you like functional languages, I'd suggest ruby. While it's a normal object oriented language by day, it is a wanna-be functional language by night.

In addition, you'd get one of the cooler frameworks (Ruby on Rails), which I am currently working in. Rails is great, if you can get used to the way they want you to do things.

From what I see, if you want to get paid, learn PHP, if you want to write new projects from scratch, go with Ruby on Rails or one of the Python frameworks. PHP is sorta a hack of a language, and you'd really be missing out on all the cool power a properly designed language can give you.
posted by cschneid at 5:31 PM on April 20, 2007

Seconding ruby. There's no denying that PHP is easy to learn and popular, but it's also a total engineering disaster. Take a look at the bug stats, for instance.

A well implemented programming language will at least ship with a test suite. With PHP, you are the test suite. At some point, the language itself will start segfaulting on you, and if you aren't handy with gdb and C, you'll either never know why, or find your bug report in the "no feedback" category (like everybody else).
posted by lucky mollusk at 6:16 PM on April 20, 2007

Best answer: I agree with cschneid and lucky mollusk about the general hideousness of PHP. It (sort of) works (most of the time), and there's tons of libraries. But I found high-quality articles aimed at people who want to develop a large, maintainable, object-oriented web app to be few and far between; there's piles of bug-laden, insecure, ill-advised crap aimed at newbies.

Ruby on Rails is great in lots of ways. Before diving in, make sure you agree with its fundamental philosophies, though. You have to be OK with its poor-performance-for-fast-development tradeoff; there's no way around this.

Personally I prefer Django, mainly because Python is fantastic imho, but there really isn't a set of strong, universal arguments for Django over Rails or vice versa. Pick what you prefer.
posted by Aloysius Bear at 6:33 PM on April 20, 2007

Best answer: Look at a PHP framework like CakePHP or CodeIgniter. They're similar to Ruby on Rails, would help you learn well-structured PHP (CodeIgniter has good documentation), would mitigate some of PHP's issues, and can be used for large, maintainable, object-oriented web apps.

SitePoint PHP Tutorials. W3Schools PHP Tutorial. The PHP Manual has a simple tutorial.

PHP Cheat Sheet, Writing Secure PHP (and part two).
posted by kirkaracha at 6:38 PM on April 20, 2007

Best answer: Uh, the origional P in lamp was Perl. PHP started a stripped down version of perl, or as meryln put it - "training wheels without the bicycle". Pick up the llama book, you won't regret it. The Perl community is wonderful - check out Perlmonks and CPAN.

RoR is a joke.
posted by phrontist at 7:32 PM on April 20, 2007

It's very easy to quickly code yourself a big plate of spaghetti with PHP, so I recommend looking at recommendations for code style before jumping in (which is almost too easy for your own good). For a primer on good design patterns (best practices) with regards to PHP, check out this site, and this one for some actual code samples.
posted by Civil_Disobedient at 8:00 PM on April 20, 2007

Best answer: I made the jump from CF to PHP... the best thing to do is just choose a site you want to build, and build it in PHP instead of CF.

You know... get a project, set a goal, then figure out how to do it.

One thing I found tremendously useful was one of those "Learn in 24 Hours" books, which was really just 24, one hour lessons. (I bet if one were to hunt around, one could find it online...) That'll be enough to get you up to speed on connecting to databases and the basic syntax-type stuff you need to learn... and once you've got that, you're 90 % of the way there, if you've programmed in other languages.

Anyway, screw all the haters. PHP is rad. There's tons of code out there for you to examine and steal from. Not all of it is good, but you'll get a general feel for things as you go.

Obviously, there are folks who disagree, but personally, I think that frameworks, at least in the context of PHP, just add complexity when the language itself has already provided the abstraction you need to get the job done. Maybe that's just me, though... I dunno.

After you've done this for a little while, you'll start to develop a nice little library of standard functions you can re-use over and over again.

Anyway, the best thing to do is join your local php programming group. 'Course, I dunno about Egypt, but joining a mailing list, at the very least, gives you a place to bounce ideas off other people and to learn new stuff.
posted by ph00dz at 10:44 PM on April 20, 2007

Do look at frameworks (CodeIgniter is simple and pretty good, although I abandoned it due to some bugs and Unicode deficiencies), and please read up on security issues. Almost every novice PHP programmer leaves vulnerabilities all over the place.

PHP is a mess, but it's a ubiquitous, lightweight mess, and if you use it the right way you can avoid most of the nastier aspects and hold out until server-side JavaScript replaces it (OK, I can dream).
posted by malevolent at 1:58 AM on April 21, 2007

I'd also recommend avoiding frameworks. Not because they aren't necessarily helpful, but that they tend to follow the 80-20 rule with implementation. 80% of the stuff they'll do out of the box, but the last 20% will have you cursing and swearing and wishing you'd just written it yourself.

The other problem with PHP frameworks—and for me this is the killer—is that PHP is stateless. There's no application server holding all the singleton objects, so each and every page view requires loading up an assload of classes. The whole advantage to PHP over something like Java is that it is fundamentally lightweight. Start adding the complexity of a framework on top of each page request, and you kill the original advantages of the language.
posted by Civil_Disobedient at 6:07 AM on April 21, 2007

Best answer: If you're looking for a leg up on the language, you only really need two things: the PHP Manual's language reference (how do I do a for loop again?) and a Firefox smart keyword to look up whatever you need in the PHP function reference. Neat tip: if you type in[insert function/search term here] the PHP site will parse your request and attempt to show you the reference page for the function, data structure or whatever you've just typed in. Very neat.

You're lucky in that PHP has some outstanding documentation; I have personally never bothered with anything else because the manual is so complete. Anything that the manual didn't cover explicitly, I went looking for other people's source code.

(As someone who's just made the move to Django and Python, yes, frameworks are quite lovely, but not absolutely necessary. Besides which, there's no harm in learning to crawl before you run. Though since you've been working with CF for a while already, maybe you can appreciate the abstractions many frameworks bring to the table, like never having to deal with SQL code for basic insert/select tasks. In any case, knowing PHP is never a bad thing.)
posted by chrominance at 8:02 AM on April 21, 2007

Response by poster: Okay, thanks everyone for your answers.

Basically, to sum up the responses so far: Ruby on Rails is great/sucks, PHP is great/okay/sucks and is riddled with security holes, and if I do go ahead with PHP then I most certainly should/shouldn't use frameworks. :-)

I'll definitely read through the links you've given me and see what I can learn. Best answer stickers to be handed out shortly.
posted by Deathalicious at 2:37 PM on April 21, 2007

« Older so very tired   |   Country heat for city boy? Newer »
This thread is closed to new comments.