Ryan Kinal
100 E. St. Clair St.
Warren, PA 16365
716.581.1000
ryan.kinal@gmail.com

Google ProfileTwitter: @IndigloMouth
FacebookLinkedIn

Back End Redundancy

This post is not about data redundancy. It is not about RAID, or backing up your data. These are good practices, and I have nothing against them. In fact, I'm all for them, but I won't go on any further about techniques for preserving your data in the event a mad scientist takes over the world and decides that your server is the starting point for the digital phase of his plan. No no. None of that.

This is about why I dislike database and back end work. Before I get into any of that, I know there are differences in every back end application and script, and ways to format things, etc. etc. etc. But every time I write something for the back end of an application, I find myself thinking "Didn't I do this yesterday?". I find myself wondering if any given PHP application can be broken down into three steps:

  1. Put $_INPUT into the database
  2. ...
  3. Display stuff from the database

Over. And over. And over. And over. Infinitely. Stack overflow. Sorry.

Okay, so that was a recursion joke, when this is obviously iterative. But it's still infinite.

Now, step 2 is where all the "interesting" stuff happens, sure. But I find that the interesting stuff is mostly error checking, formatting, and excluding. Not very interesting at all. A few calls to date(), a slightly different SELECT statement. It's all the same.

I realized this before I started using Content Management Systems. Actually, when I was writing modules for a proprietary CMS was one of those times when I felt like I had just written the same code. Because I had. Names, addresses, phone numbers, fax numbers, etc. Same thing, different day.

Then I started a project with Expression Engine. Those guys had the back end right. It starts out as a blogging engine, but the user can create several different "blogs" - which are just collectiosn of data. They can define their own fields, and even define relationships between different blogs, based on the content of fields. I no longer had to create another damn contact info table. I just used the same set of fields in a different blog. Awesome.

Expression Engine, of course, has its shortcomings, and it's definitely not for everybody. But the way they genericize the back end is awesome. You can make a blog, a gallery, a news feed, a mailing list - damn near anything.

I feel like it could all be genericized further, though the little bits of processing that have to take place are the sticking point. I've kind of been thinking about it, and it may be possible to do simply make a function that takes whatever's in $_INPUT and puts it in the database. Then maybe a set of functions that gets you that data however you want it. An array, a JSON string, an HTML table, an HTML list, RSS feed, or anything you can think of.

Really, I think this is a pipe dream. It's foolish. It's not going to happen. But I'll continue using CMS's to get around the tedious and repetetive back end work of data collection and display. It gets to the point where it bores me to tears, and I'll go do laundry before I write another HTML form.

Oh, don't worry. I'll still do it. But while I'm doing it, I'll probably be looking for a way to make it generic.

Name:
Are you human? (enter yes if so)
Comment: