HomeLeadership

Lessons learned from code diving

Like Tweet Pin it Share Share Email

I couldn’t stand it anymore.

Objectively, it wasn’t that time-consuming. Subjectively?

I’m talking about how I’ve been publishing KJR for years. It’s been … less than elegant.

It is connected to running IT. I think. Bear with me.

I use WordPress to manage the KJR archives. I embed them in my main site on the archives page, courtesy of an <iframe> tag.

But I put the current column and ManagementSpeak on the carefully formatted issurvivor.com home page. That’s been a cut-and-paste operation — three separate cut-and-paste operations — one from MS Word into WordPress, the second from WordPress onto the home page, and the third from the home page into the email transmission. Worse, the headline, sub-head, ManagementSpeak and column text all required separate handling.

It’s been annoying because: It’s cumbersome; it takes about a half hour a week; and it’s stupid.

So I finally bit the bullet. Time to make the current ManagementSpeak and column material automagically appear on the issurvivor.com home page from WordPress.

I’ll spare you [some of] the details, which involved much more about PHP, WordPress, and cascading style sheets than I’d ever wanted to know.

But along the way I was reminded of some principles that also apply to much larger operations than mine. Starting with:

Wrapper your data: WordPress runs on MySQL. Going after the database with SQL code would have been way too much work, starting with figuring out the WordPress table structure.

Fortunately, WordPress spared me that particular agony. It provides functions that navigate the database for me.

Do the same. Give everyone canned data views to work with. It makes everyone faster and makes debugging much easier.

Strategize first. Re-strategize second. And sometimes third. Then code. My first thought was to retrieve the week’s posts via their unique WordPress identifier, then call up the page invoking a custom template. But that meant … oh, never mind. I promised to spare you the details. Short version: After a couple of blind alleys I figured out I could get the job done quite efficiently using categories.

The point: Choose the right programming strategy carefully and everything that follows is a lot easier.

Assume the tools are there: Same example, different lesson. Far too many companies that implement large COTS solutions mess with core code or build satellite applications, assuming the COTS solution doesn’t come with tools that will get the job done for you within the solution architecture.

Maybe not, but don’t assume it. Instead, invest in creating system gurus who know the system inside and out. Solutions that use the systems architecture are almost always less expensive, more robust, and easier to maintain than the alternatives.

And they’re usually there. In my case, WordPress had everything I needed to get the job done, other than positioning things on the home page which I was able to accomplish with a <table> and a couple of <iframe> tags.

There’s always one more complication: I needed different header fonts for the home page than for the archives. I had to figure out how to add them to the .css file, and how to invoke them from a template.

I also needed a header that didn’t include the top-bar … the bar that includes tabs and a search box. That mean figuring out how to add and invoke an alternative header file.

Read the syntax carefully: Turns out, alternative WordPress header files must have names structured as “header-xxxxx” but are invoked by “xxxxx“. That took me a half-hour to figure out.

Also (I’m embarrassed about this one) … if you don’t put a </iframe> tag after your <iframe> tag, nothing else will render on your page. That only took fifteen minutes to debug.

Know when good enough is good enough: The new home page looks marginally less attractive. To compare, go to https://issurvivor.com. You’ll find an “Old Home” link at the bottom.

Also: In the archives, click on the current column or ManagementSpeak. You’ll find they look pretty raw. I figured, who’s going to do that when they’re already formatted quite nicely on the home page?

The way I figure it, saving twenty minutes and the feeling of doing things stupidly every week makes these minor cosmetic deficiencies worthwhile trade-offs.

There’s something peculiarly satisfying about writing code that works: If you’ve ever written code for a living, you know this. If you haven’t, you probably don’t, but if you lead developers you need to.

Because knowing what makes the people you lead tick makes you a better leader.

Comments (2)

  • So, just out of curiosity, why didn’t you just use an RSS feed/Read? It isn’t that big of a deal to grab an RSS feed from a wordpress site, and feed it into a page. Just curious.

    • If you’re asking what I think you’re asking, it’s because the issurvivor.com home page displays two separate posts with different formatting … the most recent ManagementSpeak in a blue tint box, and the most recent column. The other possible answer: I don’t actually know what I’m doing, and this is what I was able to figure out that worked.

Comments are closed.