In this edition…
- About This Newsletter
- On the Web => PHP Percolate!
- On the Web => Yii 2, What’s New
- On the Web => True PHP North Conference
- On the Web => Yii vs. Rails
- On the Blog => The Yii Book, an Update
- On the Blog => Working with Layouts in Yii
- What is Larry Thinking => Choosing a Framework
- Larry Ullman’s Book News => “PHP Advanced and Object-Oriented Programming”
About This Newsletter
I’m cooking with gas now! (It’s an expression.) Not only did I manage to get this newsletter out within three weeks of the previous one, but I’ve always sketched out the next three. Gone are the days of upwards of six weeks between releases. A lot to be said for having good tools and workflows, regardless of what you do. In this particular case, credit goes towards using Scrivener, the application in which I write the newsletters and manage all my newsletter-related resources, and to MultiMarkdown, which is the format in which I write. Using the two, I can write in plain text but output HTML, PDFs, etc. It’s a wonderful combination. Anyway…
This newsletter is largely about frameworks in general and the Yii framework in particular, although a couple of random things have been thrown in, too. As always, questions, comments, and all feedback are much appreciated. And thanks for your interest in what I have to say and do!
On the Web => PHP Percolate!
I was recently contacted by Gene over at Boston PHP, a huge PHP group (nearly 3,000 members!). Gene was letting me know that Boston PHP will be using my “PHP for the Web: Visual QuickStart Guide” for Season 4 of their PHP Percolate! program.
PHP Percolate! is a virtual (i.e., online) program in which the group works through a book, one chapter at a time. Experiences and results are shared, making it a great interactive experience. Links to completed exercises are posted, and there’s a message board for participants.
You don’t have to live in or near Boston to participate! In fact, I’m now a member of the Boston PHP group.
If you’re out there on your own and always wanted a classroom-like experience for learning PHP, this is a wonderful opportunity. Even if you don’t have the need to work through that particular PHP book, I would strongly recommend you check out Boston PHP: they do a lot of great stuff and share many excellent resources related to Web development.
On the Web => Yii 2, What’s New
Alexander Makarov, recently gave a presentation at the Yiiconf 2012 (note that site is in Russian) titled “Yii2, What’s New“. In the presentation, Makarov, one of the core Yii framework developers and the author of the Yii 1.1 Application Development Cookbook, discussed both Yii’s current status and the expected changes in the upcoming Yii version 2. An alpha version of Yii 2 will hopefully be out in September. (And, in fact, I’ll be coordinating the writing of my Yii book with the release of Yii 2).
The presentation quickly explains where Yii current stands, how Yii got to be here, and where Yii is going in the future. There’s even a reference to yours truly!
On the Web => True PHP North Conference
I mentioned this in my previous newsletter, but will repeat it here as it’s relevant to this edition’s them…
The inaugural True North PHP conference has been announced to take place in Toronto, Canada, on November 2 and 3, 2012. I have proposed doing a presentation on the Yii framework, introducing the framework and explaining what’s new in Yii 2. To buy tickets to the conference, see the True North PHP Web site. To propose your own talk for True North PHP, head to the associated UserVoice page.
At the UserVoice site, you can also vote for what presentations you think are worth having. Even if you have no plans on attending, but would like me to give a Yii presentation, you can vote for my submission.
On the Web => Yii vs. Rails
Earlier this summer, Gordon had sent me a link to an article that compares the Yii framework with Ruby on Rails. Ruby on Rails used to be really hot, but now it’s cooled off and has settled at the level of just being really useful. You can read the article for yourself, but Gordon was asking for my reaction to it, which I’ll share with you here (with some modifications)…
My first reaction is that many people erroneously compare PHP to RoR, which is wrong because RoR is a framework, not a language. So I’m glad that an apt comparison is being made. Also, Yii was inspired by Rails, so that particular PHP framework is a more natural choice for comparison. I will also agree that Ruby is a wonderful language, although I would never say it’s better than PHP (as the author does), or that PHP is better than Ruby. They are different languages with different purposes and strengths.
In fact, I would say it’s just plain silly to say there’s a “best” language or framework or operating system, etc. A juvenile suggestion, in any case.
The writer does seem to stress that less code is some sort of great benefit or sign of better code. I don’t disagree with that in principle, but wouldn’t use that as a basis of comparison. The author’s comparison of the speed of Yii-based sites vs. RoR sites lacks any hard data, too. I also question the assertion that lots of developers are moving to RoR. In the 7 years since I first learned Ruby and RoR, I’ve seen the popularity of both wain, not grow.
That being said, the strength of that piece is really in the conclusion, in that the writer is choosing Rails “Not because it will suddenly make me a better programmer, but because it will make me a happier one.” That’s a very honest and important conclusion.
I personally also love the Ruby language, but I wouldn’t say that using it makes me happier. For Web development, PHP is a more natural fit for me.
On the Blog => The Yii Book, an Update
Earlier this week, I posted The Yii Book, an Update, which discusses my plans on self-publishing a book on the Yii framework. I’ve got a lot of miscellaneous things to do this month, but by the end of the month, and fully into the fall, I’ll be working on the Yii book.
On the Blog => Working with Layouts in Yii
Back in May, I posted Working with Layouts in Yii, which explains how the layout system works in the Yii framework. If you’re using the framework, the post should hopefully help you envision the view rendering process.
What is Larry Thinking? => Choosing a Framework
Way, way back in the day, I received a couple of questions about why I prefer the Yii framework. I answered those questions in a newsletter, but the topic of how one goes about choosing a framework is worth revisiting.
To start, there’s the issue of whether you should even use a framework or not. Maybe you like frameworks, maybe you don’t. Maybe you’re unsure. I found a framework I really like (i.e., Yii) about three years ago or so now, but that still doesn’t mean I always use it on every project. I’d say I use Yii on maybe half of the projects I work on, maybe only 40%. Another 20% of the projects I do use WordPress, which is not technically a framework (I don’t think), but is framework-like. In any case, once you’ve selected and mastered a framework, you can then decide—on a case-by-case basis—whether or not to use it for a given project.
Note: In the following, I primarily discuss, compare, and contrast the Yii framework with the Zend framework, as those are the two PHP frameworks with which I’m the most familiar. I cannot speak as to how well other PHP frameworks meet the following criteria. In other words, the point here is to help you select your framework, not to provide a good overview of the options.
When it comes to choosing a framework, my first criteria is that it must be written for PHP 5, which is to say it cannot run on PHP 4. The way PHP treats objects changed dramatically in PHP 5 and, in my opinion, any framework that will run on PHP 4 just isn’t optimal. Offhand, I forget which frameworks this criteria rules out, but it’s the first thing I’d check.
Normally my second criteria would probably be the amount of documentation available. But “amount” and “quality” are not the same thing. The Zend Framework has a ton of documentation, but I found its documentation to be cumbersome, often leaving me with unanswered questions. Conversely, especially when I started using it, the Yii documentation was sparse, but I found Yii intuitive enough that the lack of documentation wasn’t (generally) a show-stopper. I would caution to say that the quality of anything’s documentation is hard to gauge up front; it’s when you’re trying to figure something hard out at 3 AM that you really see how good the documentation and support is!
On a similar note, you’ll eventually need to tie the framework code into some third-party code, be it a forum or a search engine or whatever: there will be some legacy, third-party system that you have to integrate. Finding a framework that nicely adapts to such situations will make that process all the easier. And one thing I like about Yii is that it can use third-party extensions easily. Ironically, the result is that I’ve often used the Zend Framework’s Search, PDF, and Email modules in otherwise Yii-based sites.
If you use a less common database application (e.g., PostgreSQL or a NoSQL one), support for that is paramount. In fact, if there’s anything you commonly do in a Web site, make sure it can be easily done (i.e., it’s a documented ability) of the framework you’re considering.
Finally, you should look at a framework’s community: how large is it, how accessible is it, and how active is it. Popular frameworks with lots of people involved will continue to be maintained. Frameworks that are less popular, and largely run by a single individual, will eventually fade out. If there are active support forums, it’ll be easier to get help. These things are hard to gauge but make a huge difference in the long run.
The least concrete piece of advice I can provide, but one that makes all the difference, is to find a framework that feels right to you. It’s fortunate that there are several good PHP frameworks out there. You’ll need to play with them a bit, but find one that just seems to work for you. For some reason, the Zend Framework never felt natural to me but Yii did immediately. For you, the opposite may be the case.
Larry Ullman’s Book News => “PHP Advanced and Object-Oriented Programming”
Very, very happy to say that the third edition of my PHP Advanced book, now titled “PHP Advanced and Object-Oriented Programming” is just about to go to the printer. The final table of contents have been posted on the blog, for those interested in how it turned out. The final page count is going to be around 500 pages, I believe.
The entire book has been rewritten. I…
- Updated all the examples to use HTML5
- Removed content that was outdated or has since been better discussed in other books
- Clarified a couple of confusing explanations
- Created many new examples
- Expanded some of the subjects
- Updated everything for the latest version of PHP (5.4)
- Greatly expanded coverage of OOP (about half the book is now OOP)
- Added four entirely new chapter
The new chapters are:
- More Advanced OOP
- Design Patterns
- Example—CMS with OOP
- Debugging, Testing, and Performance
I’m pleased with how it turned out and hope you will be, too. The book does assume intermediate level knowledge of PHP and MySQL (like that you’d have after reading my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” book).