Programming Is Like Jazz

Jazz is all about breaking the rules in ways that enhance the music and make it come alive. Jazz is hot; it swings, it jives, it improvises, and it bucks convention to do this. Programming is like Jazz in a sense, sometimes you need to break the rules or improvise to make a harmonious website. This is a story about one of those moments.

I was given a simple task, add hours of operation to a page on a WordPress site. “Easy peasy, log into the backend, open up the page, and put in … um… ok… what is this?”

On the front end the web page there was a header, some text, a form, some graphics, a sidebar, and a footer; pretty standard. On the back end, all it had was a little bit of text running on an ancient version of WordPress; rather unusual.

“Alright, that’s fine, it’s probably plugins and widgets that make up the rest of the elements, I’ll just plug the hours into… um… wait… it’s not plugins or widgets… Did they custom code this thing?”

A thought crossed my mind, I could easily just create a div element in the WYSIWYG, throw in the hours, and absolutely position them where they needed to be. That would be bad CSS programming though, all my courses told me to avoid that solution and Daniel face-palmed when he saw me use it on a different site earlier.

“Ok… let’s connect with FTP, open up the theme directory and see if we can find something inside.”

What I found was that each page was drawing for different templates which accounted for where all the missing elements were coming from but the template for the page I needed to edit was missing. The minutes were ticking away on something that should have been very simple and very quick. After some snooping around and some trial and error I found the template, it was part of a parent theme in a file called pages.php instead of anything obvious or specific to the contact page.

I put the hours in but they simply would not go where I needed them to go. I got them above the text, in the sidebar, between the sidebar and the text, behind the form, in front of the form, in the footer, but the space between the footer and the text just could not be breached.

By this point, my supervisor was asking about how the job was going and I explained that this was actually more complicated than we anticipated and that I didn’t know how long it would take me. I didn’t mention my quick absolute positioning fix because I didn’t think it worth mentioning. He told me to hold off for now and talk to Daniel when he was back tomorrow.

The next day I went to talk to Daniel. To my satisfaction he (quickly) followed the same route I did, trying the same things, and even looking up the same files. If Daniel was doing everything that I had done, then clearly I was on the right track. Then he laughed and said, “just create a div in the WYSIWYG and position it absolutely.”

“Really?” I looked at him incredulously, “I’ve been trying to avoid that because it’s lousy programming.”

“Yeah,” he said laughing, “it is. You’re not supposed to position absolutely because it breaks the site if it resizes. But here’s the thing. This website is so old that everything is absolutely positioned already. It doesn’t resize, it doesn’t scale, so we don’t have to worry about absolute positioning causing problems. the only way you are going to get the hours where they need to be is to use absolute positioning!”

So, two hours into my five-minute job, I created the div, threw in the hours, and positioned it, absolutely finishing at 125 minutes (and we billed the client for only a fraction of that).

There’s a lesson to be learned here. Just like in Jazz music the more experience you have with the rules the more you are allowed to break them. Just like in Jazz you need the experience and the freedom to experiment and branch out to do programming well. While I am still new to the industry, I have taken some good courses and know enough to build on my own. Daniel, on the other hand, is a CSS master, he saw the situation and just knew that it was ok to break standard convention. He understands more than just CSS rules. He understands rules of design, HTML and UX, along with the reasons why the rules exist. Just like in Jazz we broke convention, not because it was easier to do or because we didn’t know better, but because it fit better that way, it was the best solution to the problem.

Share:
DID YOU ENJOY THIS ARTICLE?

If so, make sure to follow us on LinkedIn to be notified as we add more!

Recent posts: