owen

On the Habari development mailing list, Daniel Smith writes:

I am interested in learning PHP (object)/MYSQL programming in general, and Habari-specific in particular. As a php newbie, could anyone please point me to any resources, latest quality books, tutorials or whatever, that could help me to learn how this all works?

An excellent question, and something that we experienced PHP folks would all do well to answer to help bring more people in and teach better coding practices.

For beginning PHP and MySQL, I really like the Visual Quickstart series of books. They have clear chapter goals and are rife with examples. Combine the books on PHP, MySQL, and PHP and MySQL with a willingness to frequently search the online documentation for both tools, and you can accomplish pretty much anything you set yourself to. Obviously, these are not for seasoned code veterans, but I think they’re just right for people just starting who don’t want to be babied but instead want to learn real code.

One thing that I’ve always found useful is picking a specific project goal, the simplicity of which would be determined by how green I am on the topic, and trying to code it myself. Sometimes working through other people’s code can be daunting.

That said, looking through other people’s code to see how they do things is essential to being literate with the common conventions for coding. A good example of something that the PHP coding world does that you don’t usually learn in a book would relate to database access.

When looking through the books on PHP, you’ll see a lot of reference to commands for accessing MySQL. No project I know worth anything uses PHP’s mysql commands directly. Instead, they use an abstraction layer that handles many of the mundane details of database use without having to write the same three lines of database connection code repeatedly.

The lesson from the above is to see what projects like Habari do for database access. Habari is very object-oriented code. Practically everything in Habari takes place in classes and objects. If this is not your mental paradigm, then it may take some relearning to become comfortable in that milieu.

On the plus side, you will be significantly rewarded for your patience in learning Habari’s style of coding with code that is cleaner and more flexible than that of many other projects. And if you’re starting out with object-oriented thoughts, then you’ll be a step ahead of others who learned procedural coding and have bullishly stuck to it.

Perhaps the best resource Habari has to offer for teaching new coders is the IRC channel, where Habari developers occasionally roost. There, you can ask PHP questions and get real answers from people who often know what they’re doing. The plus side of using #habari and not #php is that while many of us are seasoned developers, we have a commitment (at least I do) to making new people feel comfortable in our community. As we say, “community first.”

I’m glad you’ve decided to take the plunge in learning PHP, and hope that Habari can offer you tools toward your success.