Resource Plugin

RL2 Resource Plugin Development Process

I recently wrote a resource plugin for WordPress called rl2. I made this plugin to provide a database of community resources for a non-profit called Traditional Nutrition Guild (TNG). The idea is to provide listings of vendors, practitioners and businesses, individuals or organizations of interest to the users of the site. This plugin could be a database for any number of other applications with only slight modifications. I want to talk about the process of coming up with the plugin and the possibilities it exposes.

Wikinews - database size 2

Wikinews - database size 2 (Photo credit: Wikipedia)

The idea came from the web of relationships around this community organization. It has a website and a lot subscribers who are keenly interested in a particular style of nutrition. There are vendors in the community who provide relevant food and other products as well as health practitioners, educational support and cooking services. There are also other non-profits doing related work. The members of the TNG and some of the relevant businesses asked for a way to expose community resources to the membership.

In my discussions with some of the interested people of TNG, we decided that they needed a system that had categorized display of listings. A listing could be either a physical addresses, a URL or both. The users in the community needed to be able to submit the listing and each listing needed to be reviewed and approved by a moderator before being publically visible.

I investigated to see if there was a plugin that really matched the need and I couldn’t find one I was really comfortable with. I cobbled together a sort of a mashup using a forms processor to collect information and email it to an administrator who would then create a page or post. The administrators were already overloaded, so this scheme didn’t seem right.

Another idea was to modify an existing plugin. I found one called ‘interesting links’ for which modification into what TNG needed seemed plausible. I made a modified version of it that did most of what I wanted. However, I found that this plugin modified the database by creating its own tables. I recalled discussion at a WordPress meetup that indicated leaving the database structure alone was considered a good idea.

A Entity Relationship Diagram (ERD) for the pa...

A Entity Relationship Diagram (ERD) for the part of the WordPress database schema that deals with referencing files in the filesystem. For use on Wikiversity:Web application file-reference methods. (Photo credit: Wikipedia)

So, I started over. Over the years of programming, I’ve become much more accepting of just starting over along with the notion of prototyping and mocking up things in order to learn as early as possible if I needed to start over on a design. My earliest programming was characterized by trying to sit down and come up with a ‘perfect’ design out of the gate, one that could not only do all the possible needed things, but that would anticipate future needs. I’d have huge investments of time and energy before I ever produced a single byte of code. Because of that investment, I could really loathe tossing something it out and starting over.

It took me a long time to make peace with the idea that I couldn’t see into the future and that great unanticipated ideas would often materialize as I went along; that I should
preserve some budget for those opportunities. In agile programming research I really changed my approach. The idea was to decide upfront the most essential thing(s) the
software had to do and create a pass-fail test that would tell if the software actually did that thing. Then the programmer would work out the simplest way to do that thing and write software that passed the test, and only did that one thing. I still like that and I think it applies to much more than software development.

So, I worked on the newest resource plugin. I borrowed the display from the ‘interesting links’ package and modified it. I used WordPress’s custom post types and custom taxonomies to create a new post type called an rl2_resoure. It worked beautifully. There are was a lot that I didn’t have to program at all by relying on WordPress. The administrative tools, categorization and so on were done for me. I made a user form that uses ajax for submission. The rest of the work, really, was gluing together the pieces that WordPress offers to developers.

The whole process, including the initial discussions, the throw away versions, the building the resource plugin and testing took about about a week and a half of my time. There are some more features and options to add and WordPress itself was upgraded since I put my package into the plugin repository, so I’ll be doing more work on it.

RL2 resource plugin Development Environment

My development environment consists of my laptop which runs Ubuntu studio Linux. I run Apache and MySQL on this machine. That allows me to run my pluging locally. I use the error log for lots of debugging tasks as I can tail the local Apache error log in one window, while I run my browser in another. For front-end debugging and develpment, I use Firebug on a Firefox browser.

This entry was posted in Articles, Technology and tagged , , , , , , , , , , . Bookmark the permalink.