revjim.net

October 4th, 2002:

“discussion” not worthy

Earlier I mentioned a threaded discussion forum class written in PHP called “discussion”. After reviewing the code, I’ve decided it sucks.

The author starts out with the right idea: he makes a class which calls a separate configuration file and that class is then called by a third page which does the front-end and/or admin. From there, everything just gets bad.

The first thing I see is that there are HTML templating functions in the “discussion” class. Um, no. If you need to display HTML, then you need to make another class that handles that. If you mix the two, then you have one class that does two jobs, and that defeats the purpose. However, I figured I could rip out the HTML templating functions (as they are most likely only called from the third script that does the actual front-end work) and still have a very usable class with very little work required.

As I dug deeper into the code the first function I see is called getTopics(). Sounds good. The first few lines of the code show SQL queries being generated. I see that PEAR::DB is being used for database access. This is great. Then, what do I see? Inside of getTopics() the author beings calling his HTML templating functions. Um, wrong again. getTopics() should get the topics. There should be another function (maybe, displayTopics()) that actually spits them out. No big deal, I figure. I’ll just store the information that getTopics() is collecting and then, instead of spitting it into the template functions, I’ll just have it return that value.

As I look at the code that actual gathers the data I see the author calling a _linkHTML() function. I search for the function name only to find that this function reads cookies!! Um, what the fuck?! If a function needs some data, and it’s in a class, that data should be passed to it, or set in the class. It certainly shouldn’t be obtained from a global variable equal to a stored cookie that may or may not exist in the final usage of the system. At that point I gave up.

Even though the code is built in a class. It is useless. The class depends on the code and the system working in one particular way. I’m sure the discussion board works just fine. But, this author should have saved himself a lot of time made his code much more efficient and ditched classes all together, because his use of classes absolutely defeats the purpose.

If you need a prebuilt, ready to roll, discussion board, I wouldn’t bother looking at this piece of software. There are thousands of much more feature rich discussion boards out there. If you are looking for a discussion board class, this is most certainly not the place to look.

Move along. Nothing to see here.

See what happens when I let my guard down and begin to think that the state of PHP software isn’t as bad as I think it is? Ugh.

threaded discussion in a PHP class

I found a threaded message board named discussionthat looks very promising. It is written in PHP and, aside from HTML output of the message board, all the code is in a PHP class. This means, if it is written well (which, at first glance, it appears to be), I can easily integrate threaded discussion functionality into revjim.net. The biggest advantage of this is that, comments will work a lot nicer. Since it is in a class, I should be able to easily attach it to each post on revjim.net. It will allow user information to be preserved, threaded comments, and email notification of new replies.

I love well written, modular code. If I get this working well, I’ll offer a how-to, and downloadable code for integrating this functionality into your own Movable Type installation.

side note: Why does Movable Type require so much damn Javascript to operate correctly? And why is it so slow?

blo.gs sucks

I use blo.gs to track many of the sites I read and when they have updated. Those sites that ping blo.gs directly, are shown to me immediately. Those sites that ping weblogs.com (or several other places that accept update pings) are updated every hour. This has always worked very well for me. Unfortunately, blo.gs has been down a lot lately. I know I can’t complain too much, since it is a free service, but it was a service I really enjoyed using.

I would prefer an actual news aggregator (which I am in the process of authoring one that doesn’t suck but reading RDF is rather complicated when you are a perfectionist like me and want to do everything “right”), however, until I find one (or write one) that I like, I’m looking for a (temporary?) replacement service for blo.gs.

Any suggestions?

side note: Why doesn’t Movable Type have a spell checker?