Saturday 07 January 2012 by

Update 05 Nov 2012: Please note that this post has been superceded.

Calling all programmers: we need your help.

As you may well know, Textpattern 5 is undergoing a major rewrite; moving from the old function-based approach to a more modern MVC framework: Spark/Plug.

Since the announcement, things have gone slow. No, actually slower. Various projects and other commitments have meant that we couldn’t divert the resource required to do the project justice.

While public movement of Txp 5 has been glacial, in the background three things have happened:

  • I (Bloke) have been learning the ropes of this MVC malarky and documenting key Spark/Plug functionality as it relates to Textpattern. This gives potential patchers, developers and plugin authors a leg-up on what the underlying framework offers. It’s still pretty scant and a long-term work-in-progress that will probably transfer to the wiki at some point, but it offers some insight into the naming conventions and core features that make working under S/P a joy.
  • In tandem, Sam has been answering awkward questions and hammering updates into Spark/Plug which have actually justified the crawl. For example, the framework now supports shiny CSRF protection for starters, which means porting over Txp 4.4.1’s security features is, well, not necessary in the code since the framework does it for free (as long as the conventions are adhered to).
  • Phil’s admin theme has matured to the point where it’s a pretty slick replacement skin for today’s classic theme, so it’s been incorporated at this stage. We know there are hundreds of iterations to go as it’s tweaked and refined to bring in new features which improve workflow, but it’s a solid base upon which to build.

One screen to rule them all

To demonstrate the way of working, one (admittedly simple) tab has been coded pretty much end-to-end: Presentation->Styles. This shows off a lot of functionality and best practice working with Spark/Plug. There’s a little work to go, but it pretty much functions as it does in 4.4.1 today.

Part of the reason this screen was chosen as the blueprint was because it required no DB changes. Things like “rename sheet” need to be factored into the UI yet, but that relies on a few changes to the workflow and a schema change or two, so it’ll be folded in further down the line once the install/update mechanism has been started and Phil has had a chance to reconcile the functionality into the theme.

As it stands today, you can use a stock Txp 4.4.1 database with Txp 5’s Styles tab. All the other tabs are just HTML mock-ups.

Hobbits unite

The real work now begins. While we could continue to hammer away at this behind closed doors, the spirit of community involvement and the benefits of using Mercurial as a VCS are that clones and branches are fairly slick to manage. So instead of the old “here’s a patch” methodology, a more visible “I’ve cloned the branch, here’s a pull request” approach is being taken.

The distinction is subtle but the ramifications are huge. No longer will one person submit a patch to a dev list and wait: you’ll publicly clone the master branch and work on your edits in public. If anyone else wants to join the party, they can clone the clone. Peer review of the clones is public. Anyone can download any clone direct from the repo and use it, offer advice, and shape it until it suits everyone. We’ll all be involved in that: devs (gatekeepers if you will), enthusiasts and people who want to push Textpattern forward. Once a clone has been tested to destruction by the community and it’s ready, a simple Mercurial pull request notifies us so the functionality can be folded into the core.

And the first job is to port all the existing functionality of Txp’s admin side over to the Spark/Plug framework using the Presentation->Styles tab as a blueprint.

To make all this work, we do need some kind of master list of who’s working on what so we don’t duplicate effort. A simple public spreadsheet ought to do it for now. If you want to tackle a tab, jot your name down, maybe team up with someone, clone and get cracking.

Over time we can expand this so if you’re thinking of tackling a new feature you can add it to the list to signify your intention, which will also attract like-minded people to download, test and/or develop your clone. Cloning a repo adds it to the Google Code Clone page so maybe there’s a better way than a spreadsheet to keep everyone on the same page. Please speak up if you know of one, or can donate some Basecamp bandwidth :-)

The road to Mordor

There’s not much else to say. Get in touch with one of us to gain access to the developer guidelines doc and spreadsheet (they’re both Google Docs so can’t be made blanket public, unfortunately. Maybe they should be moved to the wiki sooner rather than later).

At the back of your mind, keep a copy of the Txp platform mantra:

  • Powerful
  • Lightweight
  • Flexible
  • Plugin/theme extensibility over core bloat (i.e. lowest common denominator as default functionality with hooks for easy enhancement)

then please clone and help make Textpattern 5 the CMS you love.

Let’s fling Txp 4 into the volcano and forge a better, smarter ring from the molten metal. It’s what Dean Frodo would have wanted.