WordCamp Louisville was held last weekend in Louisville, Kentucky, and I was given to opportunity to present a talk on bbPress. The topic was pretty open and I was able to choose what I really wanted to talk about. As a developer who has done a lot of work with bbPress, both in using it and developing for it, I chose to present on why bbPress is an exquisite model of plugin development done right. There are a lot of ways to build WordPress plugins, and many, many more small elements that really determine what classifies a plugin as a great plugin.
bbPress is an excellent example of dozens and dozens of good development techniques all combined into one plugin. By simply exploring the source code, there is so much that can be learned; everything from formatting to documentation, from type casting to extendable functions.
At WordCamp Louisville, I presented on several examples of good development techniques used throughout the plugin, and would like to recap them here.
Utilizes WordPress Core Features
There are many, many features that WordPress core provides that can be used in plugins for all kinds of tasks. WordPress has functions for querying information from the database, functions for inputting data into the database, methods for loading template files, ways for displaying user data, options for loading scripts, and much more.
bbPress does really well in utilizing all of these features that WordPress provides and not simply creating its own set of functions, classes, etc, for doing the same things that are already possible with code available in WordPress core.
Why is this an indicator of good development techniques? There are several reasons:
- Doesn’t try to reinvent the wheel
- WordPress core is used by millions and is extremely well tested, meaning it’s very reliable
- Core code has been extensively tested and is constantly audited for security flaws
- Makes the plugin more light weight
- Takes away from development time
- . . . many more
bbPress is written in a way that makes it very easy to extend. By including filter and action hooks heavily throughout the entire code base, bbPress allows for other developers and other plugins to tie into and modify the behavior of bbPress. If you search the WordPress plugin repository for “bbPress”, there are currently 136 results; these are primarily add-on plugins for bbPress that have been written by other developers to further extend the default behavior of the plugin.
These add-on plugins are possible because of the ubiquitous use of hooks throughout bbPress core.
No Unnecessary Options
There has been a long, on-going (and unfortunate) trend in WordPress theme and plugin development world to include tons of options. The idea for mean is to include as many options as are needed in order to provide the user the ultimate amount of flexibility. It’s been shown over and over again, however, that this is rarely ever a good thing and usually does not do anything more than generally confuse the user. When presented with hundreds of options, how is a user ever expected to know where to start?
bbPress follows the core WordPress philosophy that options are generally bad. There are very few options that users really need to have control over, so why include ones that aren’t needed? In total bbPress has maybe 20 options, and each one of them is very straight forward.
Extra options are nothing more than bloat and a fake selling point.
There are several things that bbPress does really well to make theming the plugin exceptionally easy. First, bbPress only includes minimal styling. When there is only a small bit of default CSS included, over writing the default styles is very simple. Second, bbPress includes a complete templating system that follows the standard WordPress template hierarchy. There is a page in the documentation that explains how to do it, but essentially all a theme developer needs to do is copy the template files from the bbPress plugin directory to a folder in the theme; from there the theme designer can tweak each and every view of the plugin exactly as he or she wishes.
Excellent Inline Documentation
If you have ever explored the bbPress source code, you will find that the documentation left throughout the plugin is exquisite. Every single class and function is fully documented with phpDoc, which makes it really, really easy to figure out exactly what each class and function does.
As I demoed in my presentation, you should be able to read the documentation at the top of a function and immediately know exactly what the function does and how it works, and this is how it is when reading the bbPress source code.
Encourages Community Collaboration
bbPress is fully open source and anyone who wants to can modify its source, but bbPress goes as far as to actually encourage this. There is a complete bug and issue tracker, just like WordPress core has, and also a community support forum. These may seem like little things, but they really do go miles in encouraging collaboration.
By simple providing an easy means for developers to submit patches and bug reports, bbPress is already miles and miles ahead of the majority of plugins that could be considered “community based”. Very few developers will actually take the time to email another dev a patch for a bug, but when it can be submitted via a system that then makes it easy for both developers (and others) to follow the life of the bug/ticket, devs are much more likely to do so.
The nature of bbPress being highly extensible also encourages community involvement. Many users find there are elements of the plugin they want to tweak or features they want to add that don’t exist. When these tweaks are easy to do via an add-on plugin, developers have the option of simply releasing their tweak as a plugin and making it available to everyone. Some of these tweaks then get merged into the core plugin on occasion, just like some plugins get merged into WordPress core when they provide a great piece of functionality that everyone needs.
There are dozens and dozens of elements that make bbPress an exemplary model of plugin development; the ones I’ve discussed are only a few.
You can view the slides for the presentation below:
It was a great talk. Thanks again for speaking!
Great article Pippin. bbPress is coming to Mojo forums soon! 😉
Can you please tell me your bbPress trac id? Thanks!
It’s the same as my WordPress.org username: mordauk
I like that it’s not bloated with unnecessary features. Tight integration if you need a simple forum for a WordPress blog.
I agree and love all the points above.
I guess all bbPress needs is a little improvement on documentation (so that developers can leverage on the awesomeness of bbPress and create awesome forums) and naming convention e.g. “page-front-forums.php” vs. “archive-forum” and then it will be perfect.
Thanks for all your work 🙂
Great news for a great plugin.
Waiting for some good news about bbpress in Paris wordcamp 2013
It was a great talk. Thanks again for posting!