WordPress 2.0 RC3 Upgrade

I decided to upgrade the site to WordPress 2.0 to see what the new version looks like. Currently, I’m having some problems with permalinks and some plugins may not work. I will continue debugging later on in the next two weeks. One thing I will say is the new version looks great. The admin section has been majorly overhauled, complete with AJAX enablement, drag and drop placement of sections within the admin screen, and live preview of your post so that you can see what you’ve written in context with your theme – something I’ve been waiting for for quite some time.

The main problem (that I know about right now) is that it seems as if the comments do not work on posts since the upgrade. For some reason, on newer posts you just cannot get to the comment template. I’m currently tracing through that to figure out what the deal is.

As I get the bugs worked out, I’ll post up the details of what I’ve found.

Head First HTML with CSS & XHTML

Head First HTML with CSS & XHTMLLast week one of my team members requested a copy of Head First HTML with CSS & XHTML by Elisabeth Freeman and Eric Freeman, as we are doing some work on a CSS implementation of our web site based on the results of some initial research that I had done back in June of this year. I started vacation on Friday and by Saturday I had a note from the post office saying that the book was sitting there waiting to be picked up (apparently our postal delivery person was too lazy to get out of the truck and leave it on the doorstep).

I started paging through the book a little and was a little suprised and put off by the format at first. It seemed to me to be almost formatted as a kids book, with large pictures, large type, and conventions like interviews being conducted with tags, or conversations between specifications. As we were on our way Christmas shopping I was actually reading it to the family and kind of goofing on it. I couldn’t believe that my team members actually requested a book like this that tried to explain things in such simple terms. It seriously felt like a ‘Dick and Jane’ book.

Well, thankfully I didn’t write it off and actually kept reading it. What I soon came to realize is that there is a reason that ‘Dick and Jane’ have been around since the earth cooled. These are some great books, removing all of the technical jargon out of your way and explaining the concepts in an extremely understandable way. The book makes the concepts seem much more realizable and less intimidating to actually try yourself. Surprisingly, I learned quite a bit that I didn’t know by hitting the O’Reilly books that I had read earlier and found myself thinking about the concepts much more frequently (and freely) than I did as I was wading through the highly technical format of these other books.

So while I started out goofing on the book, I found a ton of value in it, so much so that I’m going to grab a few more of them. I think I’ll start off with Head First Design Patterns and then work my way from there.

If you are looking to dip your toes into CSS and XHTML and want to understand the purposes and reasons for the different specifications, I highly recommend picking up this book. I was absolutely pleasantly surprised and found a ton of value in the format and presentation of the information. It was really cool to finally run across a series of books that teach the concepts so effectively while giving you just enough technical information to be able to work.

Pick this one up. You won’t be disappointed.

Too Much Object Orientation?

Ed Gibbs has an article entitled Spaghetti OOs Code in which he talks about a conversation he had with his brother about “too many objects” vs. more “meaty” objects and it reminded me of a position I was in once, and hopefully a lesson that makes sense.

I’ve always ahered to the idea to have enough objects to get things done in an understandable way, without having 4000 objects to keep track of in order to get something done. I’ve seen many applications written where there are several layers of indirection that you have to traverse in order to figure out whats going on, as you have objects that perform certain actions on other objects such as rendering its contents as HTML or XML. These would all be great if they worked on a base class of the actual object being rendered, however they work on specific derivitives, requiring a reimplementation of a rendering object for each specialization of the original object.

Here’s an example. I worked at a place once that had a general rule (big red flag here) that each piece of functionality had to be made up of four separate components:

DA (Data Access)
This object was responsible for retrieving data from a database or other data source.

BO (Business Object)
This object was normally a result of retrieving data through the DA object and represented a business object.

BS (Business Service)
This object was responsible for performing services related to the BO.

BA (Business Access Object?)
I know we had something called a BA, but I can’t remember what it was used for (second red flag). However, it was a required component.

These components had no base classes or framework around them (third red flag), they were just required components that had to be used. Now, for some, this doesn’t seem like a big deal, but try writing some simple code that renders a pulldown in HTML off of a database query and then multiply that work by 10 and you’ll see where this becomes problematic. No framework in place, but all objects were required.

When I first came on, I had to write code that rendered a pulldown box in HTML and I wrote something like the following (Editors note: This was written to illustrate a point and most likely will not execute – its been a while since I’ve written Java):


/**
* Yes, this should or could have been an interface. I was a beginning java programmer at the time, coming from C++ - so
* this made much more sense to me at the time!
*/
public abstract class PulldownData {
/**
* Generate a hash table from a query in which the keys are the select values and the values are the descriptions to appear
* in the pulldown
*/
public abstract Hashtable getData();
}

public class PulldownRenderer {
public String renderData(String name, PulldownData dataObject) {
StringBuffer strHTML = new StringBuffer();
String keyName = null;
String itemDescription = null;

if (dataObject != null) { /* still have arguments whether this is necessary in Java */
strHTML.append("n");

for (Enumeration e = dataObject.keys() ; e.hasMoreElements() ; ) {
keyName = e.nextElement();

if (keyName != null) {
itemDescription = dataObject.get(keyName);

strHTML.append("" + itemDescription + "n");
}
}

strHTML.append("");
}
}
return(strHTML.toString());
}

Once this framework was completed, all you had to do to create a new combo box was to derive a new class from the PulldownData object and pass this object to an instance of the PulldownRenderer class and voila! You had a pulldown!

Despite the decrease in actual work involved, I actually spent quite a bit of time arguing why this was a better approach than having four tightly coupled objects that could not be reused to render my combo box with an “architect” that was on staff at the time. I had violated the “general rule” and written something simple and useable.

All of this was written just to illustrate a point. The simpler the better. If you are decomposing things into 500 objects because “thats the way we do it” or “everything else here is written that way”, you are doing it for the wrong reasons. There has to be a reason to decompose things to a level that makes sense for the person coming after you, or the people you are working with. Object orientation has the ability to make your job a hell of a lot easier, but its a two edged sword. It can also make your life extremely difficult if you ignore the KISS principle and abstract for the sake of abstraction.

Aardvark’d: 12 Weeks with Geeks

Aside

Joel Spolsky of Joel on Software fame has announced the completion of the movie Aardvark’d: 12 Weeks with Geeks, a documentary chronicling the development of a software product called Aardvark. DVD preorders are being taken now for a ship date of December 1. The trailer is available on the project page and I have to say, it looks really cool from a geeks point of view. I think I’ll be preordering this one.