revjim.net Rotating Header Image

sick and tired

Sometimes I get so sick of the way other people write web software. I guess I cannot complain. Not really. They are spending their time creating something that they need, and they just happen to give it to the public for free use. But I really can't help being aggravated.

I am looking for a particular piece of software to handle a particular task, and instead of reinventing the wheel, I figured I would just find something close to what I wanted, make some modifications and be happy. So I head on over to FreshMeat and do a little search. Fifteen matches are found and I begin investigating.

At the first site, the software's author is complaining that users have been filing bug reports regarding the software not accepting single quotes in the input forms. He claims that it is a problem with MySQL but that he has made a fix to work around this bug, and that his fix will sometimes cause backslashes to show up in front of the single quotes.

Wha? Are you serious? You don't realize that either the software is not adding the slashes that MySQL requires in order to enter data with single/double quotes in it, or you are not taking into account the users magic_quotes_gpc() settings. Obviously, that code is useless, so I move along.

I then proceed to analyze and download four or five more pieces of software. They seem okay until I dig into the source code. Either the author has made each "function" of the application a "page" of it's own, smashing HTML and PHP together in a big mess of junk, or the author has created functions inside of functions inside of functions that, at the very end, call a function that builds some small chunk of HTML. Therefore, eventually, the page gets built, but it is nearly impossible to understand when what gets called and why without reading every line of source code and writing out a small function reference.

Haven't you ever heard of classes? What about a template system? Can you not even take into consideration that, if you are going to be sharing your code with the world, other people might actually try to use it?

Even when I make a small application with code that no one else would ever even WANT to use I take these things into consideration. I break it down into logical pieces. I use functions instead of the same three lines of code over and over again. I create classes for larger portions of code that perform a relatively common task that could be reused. If the application has even the slightest bit of potential of being edited, or having the look/feel of the code changed, or generates more than one "page" (i.e. something other than a page that shows a few statistics about something) I strip all the HTML out of the code and throw it in a template file. I either use a well known template engine, or I roll my own and use a commonly accepted style for the template files.

I guess doing it this way just makes sense to me. Apparently it makes sense to other people too, they just never thought of doing it that way. I have contacted the authors of various software packages on MANY occasions in order to tell them, "Hey… your software is great, but, is there any chance you are going to separate the code from the content any time soon? Because if not, I am going to do it myself." More times than not, they either reply saying, "Actually, I am working on that right now" or they say, "That sounds like a REALLY good idea. Can you point me in the direction of a good template engine?"

So… to make a long story short: I'm gonna roll my own. And it is reinventing the wheel, but this time, the wheel will be circular, and not a great big square.

Share and Enjoy:
  • Facebook
  • StumbleUpon
  • Digg
  • del.icio.us
  • Google
  • Reddit
  • Technorati
  • Furl
  • Spurl
  • Live
  • Pownce
  • TwitThis