How To Teach PHP

Fri, 13 Oct 2006 13:12 UTC

While at PHP Appalachia, I had the pleasure of meeting David Rasch, the founder of Triangle PHP, which meets in the Raleigh-Durham-Chapel Hill region of North Carolina. One night, by the campfire, David and I launched into a discussion about how newbies learn PHP from current books on the market. He suggested that the format for teaching PHP needs to change and that these books need to start not by teaching PHP from the Web but by introducing newbies to PHP concepts by creating command-line applications. The idea being to introduce them early on to OOP and best practices, rather than trying to get them started fast with a simple “Hello, World” Web site.

While I agreed with the concept in general, I questioned the marketability of this approach. When a person picks up a book on PHP, I asked, what is it they want to do? The simple answer is: they want to create a dynamic Web site, and they want to do it now. Publishers will be very reluctant to publish a book that does not follow the traditional “teach them to create an application then teach them the best practices” model because the reader knows or has heard somewhere that PHP will enable and empower them to create an application—albeit a simple one—in a matter of minutes. This is what makes PHP so attractive to newcomers.

Nevertheless, David had some good points, and, while I was playing devil’s advocate in my comments, I agree that the way we introduce newbies to PHP needs to change at the fundamental level. Newbies must learn the fundamentals first, while still feeling like they are moving somewhere quickly and not being overburdened by a steep learning curve. Thus, David has followed up his original post with “Learning PHP sans bad habits,” which includes a proposed TOC for such a book. The proposed book introduces the reader to PHP syntax from the command line, but, by the second chapter, takes them into Web development with a simple framework that will protect them from bad practices (such as failing to filter input and escape output). At this point, the reader does not yet need to understand these principles or how the framework works (these are covered later in the book), but they are still learning how to protect themselves using best practices.

I think David’s got some good ideas here that the community should definitely take into consideration when teaching and writing books about PHP. Now, I’m just waiting to see what publisher will approach David first to turn his proposed TOC into a reality. ;-)


4 Responses to “How To Teach PHP”

Ben Ramsey’s Blog: How To Teach PHP

Comment by PHPDeveloper.org
Fri, 13 Oct 2006 at 16:18 UTC | Permalink

For what it’s worth, I’d be up for reading a book that teaches best practices first, applicability second. I consider myself more of a front-end guy, and for me I thrive on understanding the best way to do things first, and then applying them. It’s the whole notion behind Web Standards, so I don’t see why teaching a programming language need be any different. Keep pushing for the best, and highest quality publications and the marketability will follow because of the pragmatism it will bring in the long run.

Comment by Nathan Smith
Fri, 13 Oct 2006 at 19:42 UTC | Permalink

Well, I think PHP world including Community, publishers, developers needs radical changes in their mindset.
I have met many developers who learned Python by developing using TurboGear and many others has learned Ruby by using Rails.

PHP is mature enough now or at least i will be with PHP6 unicode, We have the biggest diverse community (Programmer, web developers, users and scripts installer and customizers ), I guess PHP needs the radical change in community mindset.

Comment by Jad
Sat, 14 Oct 2006 at 10:28 UTC | Permalink

[...] I agree and disagree with some of the points Sklar (sorry, two David’s makes this confusing) goes on to make. If I may paraphrase, Sklar is raising a point which competes with that raised by Ben in our initial discussion. My initial suggestion in the discussion with Ben indicated that books should start by teaching PHP on the command-line and slowly build up to constructing a very lightweight MVC framework and example application. One of Ben’s chief, and valid, concerns equated selling books about PHP with convincing readers or page-flippers that the book would teach them to build web pages in the first few chapters. Or that individuals might be turned off if they weren’t creating XSS attacks willy-nilly by chapter 3. I think the counter to this that Sklar raised is that by hiding the framework you turn off the people who don’t feel they’re really getting their feet wet with PHP. They feel that by using your framework they aren’t learning the ‘real guts’ of the language. [...]


Leave a Comment

XHTML: You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
APPROVAL: Comments may require approval. Please be patient.