in Coding, General, Technology, WordPress

Re-thinking the concept of the “impossible”

In today’s society, it seems to be a common occurrence to use the word “impossible”. For example, after climbing a mountain, one might say something like; “wow, that was impossible”. No it wasn’t… you just did it. Nowadays we seem to have a tendency to over-exaggerate (pardon the tautology there) and, in many cases, start to believe what we’re saying. Surely, this affects how we approach tasks and situations. Why should it?

Over the past few years (I’d say, since about 2008), I’ve decided to approach tasks day to day from a different angle. How can we say that a task is “impossible” if we haven’t even yet attempted it?

This is quite a common occurrence in web development… developers looking at a task, attempting to analyze it, getting “stuck” at one point and then moving on, deeming it “impossible”. Why does it have to, all of a sudden, be “impossible”, if you haven’t even attempted it yet? Why settle for the “shortcut” when you could just sit down and develop it how you envision it in the first place?

It’s not about it being “impossible”… you just haven’t found the correct pieces yet, or how they fit together.

As a small example to illustrate how this approach sucks and how it could be improved with a simple re-thinking process, lets take a look at a real-world scenario I experienced last year.

During the development of our “Editorial” theme at WooThemes, we wanted to add functionality to provide the administrator with more control over how many columns their content should be laid out in. This, at first glance, seems quite straight forward. A simple PHP script to cut and re-arrange the words at certain points would do this.

What if the author wants to control where the content is cut off? What if they want virtually infinite possible columns? Well, a shortcode would do this, right?

What if they switch themes? Their content would look ugly and be riddled with a bunch of shortcodes that aren’t in use anymore. In a context like this, where the content is everything, we couldn’t have that.

This is where we got down to the drawing board and found the solution that stands to date. A simple button that adds an HTML comment into the author’s content. We then use a WordPress filter (and regular expression) to convert the HTML comments into semantic HTML tags on the frontend, keeping count of how many columns are being generated and adjusting the layout accordingly. If the administrator decides to switch themes, the HTML comments won’t affect the display of the content, nor the functionality of the WordPress admin. The button itself, as well as how the HTML comments are displayed in the WordPress admin, echoes how WordPress itself handles similar functionality, integrating seamlessly into the authoring experience.

To illustrate how this relates to the “impossible”, many would settle for the shortcode option, as it is the most direct and “obvious” choice, without taking into account the ramifications thereof.

We’ve taken this same approach on many other pieces of functionality within themes and functionality developed at WooThemes. I’ve made this concept a part of my day to day approach to things as well.

To sum it up in a sentence, I’d say, “don’t assume something is ‘impossible’ until you’ve tried it. You never know… you may just get a better result”. 🙂

Leave a Reply

  1. and this is why a lot of people don’t like frameworks etc because you end up locked in.

    Best option is to make it a plugin so it’s portable between themes

  2. Nice post man 🙂 it reminds me of just after I joined Woo and Adii and I had a conversation about if a certain feature was “impossible” and reached the same conclusion as above. Nothing is impossible until attempted, especially on the web!