Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.

For the Copy and Paste Programmers

One of the things that has been absolutely fantastic about the web is how much information we can publish and how much we can access it at any given time. I don’t know many who would disagree with that.

Even more so, for those who are interested in learning how to write software, there are various articles, podcasts, videos, tutorials, and so on all of which aim to teach a person the skills they need in order to actually get from not knowing how to write code, but knowing how to do so in a productive manner.

One of the downsides of this – and even more generally, open source – is that breeds this copy-and-paste mentality that completely undermines the very thing that it’s trying to teach: that is, how to write code.

Custom Meta Box Tabs in WordPress

One of the things that has become relatively common within themes that offer a lot of options is the use of tabbed navigation. That is, options that are related are logically grouped into tabs and then the user can navigate through each tab in order to select the options.

Whether or not this is a good thing for themes is outside the scope of this particular post; however, another place in which tabs may also be used is within the context of custom meta boxes.

That is, a custom meta box sits below the post editor and it offers several options or additions to the post meta data each of which is group together in their own tab.

Though I personally find this a bit more effective than using tabs of pages for screen options, that discussion is outside the scope of this post.

Regardless, there are ways to improve the ways in which custom meta box tabs are created such that they are organized in a more maintainable way, and each tab has its own view, partial, or template so that it’s easier to work with over time.

WordPress Theme Updates Are New Themes

I know that there are different ways that people approach building WordPress themes and I’m not one to argue that there’s a single right way to do it. Sure, some ways are better than others, but that’s true of a lot of things.

Personally, I approach building themes, plugins, and so on as I would as if I was building some type of software. That has to do with my background. Similarly, someone who has a background in design and in front-end development will conceptualize what they are building in a different way.

Like I said, all of that’s fine (in fact, I think it’d be interested to see how different people view building themes, but I digress), but I do know that one common thing we always have to think about as it relates to updated our WordPress themes is the actual front-end design.

Specifically, does it make sense to completely change the design of a theme for a different version of the theme?

Design Patterns for Refactoring: The Facade Pattern

For some time now, one of the things that I’ve been considering writing about is the idea of refactoring.

Not necessarily in an incredibly specific sense – because each project is different – but in the sense of using some strategies that can help to take an existing project that’s running in a production server and slowly begin to refactor it so that its architecture changes but the functionality remains the same.

Anyone who’s worked in the software world knows just how nasty a codebase can get, and WordPress is no different. And I’m not talking about WordPress core – I’m talking about plugins, themes, apps, or whatever else it is that you may be building on top of WordPress.

For the most part, we start our projects with the idea that it’s going to have a great architecture, a pristine design, and that it’s going to basically be the best thing that we’ve ever worked with.

At some point, usually due to external factors, the thing devolves into a pile that we no longer want to touch, and we hope that it holds together to continue solving the problem at hand.

But it doesn’t have to be that way and even if the code you end up working with – be it your own, or someone else’s – has devolved into a big ball of mud, there’s still a strategy (probably multiple strategies) that you can use in order to refactor it into something far more elegant.

Everything Is Bloated, Nothing Is Good

One of the things that’s becoming more and more common place regarding front end frameworks, utilities, or applications is the use of the phrase “it’s bloated” followed by an argument as to why we should dismiss it.

No, this isn’t something that’s new, but it’s something that’s becoming appears to be becoming more mainstream – at least as far as I can tell – in how people describe the tools, apps, frameworks, libraries, and other tools that they work with today, or have worked with at some point in the past.

Obviously, this isn’t to say that nothing is bloated – I mean, I’ve written enough articles on the idea on “decisions, not options” and on how things should be more focused on a single niche – but sometimes I think that we often write off certain utilities as being “bloated” when that’s not exactly the case.

Just because something has a number of features that you don’t use doesn’t make it bloated.

JavaScript and WordPress Page Performance

Last week, I was having a conversation with a fellow WordPress developer about improving page performance as it relates to JavaScript. Specifically, we were talking about if it makes sense to load JavaScript sources at the bottom of the page.

If you’ve done any client-side development for a moderate length of time, odds are strong that you’re well-aware that it’s considered a best practice to include JavaScript sources before the closing body tag rather than in the head element.

This is because it allows the browser to render the page more quickly without waiting for larger files to download (and JavaScript files are normally heavier than HTML documents because of their file size and the processing they do on the DOM).

There’s a lot that could be said with respect to this in terms of general web development, but in terms of WordPress, opting to enqueue your scripts at the bottom of the page versus the top of the page may require a bit more consideration.

The Beginner’s Guide to Type Coercion

This week, I started a new series on Tuts+ Code that walks readers through understanding type coercion.

Type Coercion

Type Coercion

Generally speaking, the series of articles starts at the most basic level by discussing strongly typed and weakly typed languages, data types and how they work in different environments, and then begins to branch out more into how data types work within dynamically typed languages.

The main motivation for this is because people who are coming from a strongly-typed background, or those who are just getting into programming may end up finding themselves making a few mistakes especially as it relates to comparisons, conditionals, and other similar evaluations.

This series aims to mitigate that.

Aim for a Single Way to Achieve a Single Task

When it comes to user interface design and user experience, I’m no expert (nor have I ever claimed to be). I’m barely an intermediate. if even that. I’m fortunate enough people to have peers who are willing to review certain projects in order to help tighten up certain aspects of my work.

I don’t think we should ever be afraid or ashamed to ask people who are more skilled than us in a certain area to help us out (or to pay them, even!). After all, we have nothing but to benefit from it.

This doesn’t mean that a couple of ideas, rules, and general practices haven’t come up over the years.

For example, one of the rules of thumb that I have whenever I am working on a user interface is to try to make sure the user only has one way of achieving something.

In other words, I don’t like it when there are multiple ways to do the same thing. I think that it confuses the user, it complicates the code, and it makes it more difficult to maintain over time. The code aspect of this is enough content for another post.

For now, it’s just about finding a single way to achieve one task.

Thoughts on Design Patterns in WordPress

Whenever the topic of talking about using WordPress as a foundation for web applications comes up, I always get mixed reactions. That is, I’ll hear anything from how that’s a silly idea to how a person wants to know more (as well as everything in between).

One of the more common things that I hear developers often try to do is to retrofit the MVC pattern around WordPress in order to try to make sense of how existing themes, plugins, and applications work, as well as how they can take advantage of MVC to produce their application.

Don’t do that!

WordPress doesn’t use MVC. It uses the event-driven design pattern. But for whatever reason, this doesn’t stop us from trying to wrap MVC around WordPress. When it comes to design patterns in WordPress, there are other approaches.

There are reasons for why I think this is a relatively common trend, but there are alternative ways to approach development on WordPress, as well.

Steps for Soft Launching WordPress Products

One of the things with which I’ve just started experimenting is soft launches of product updates. That is, I’m providing updates to users of certain plugins through automatic updates in order to garner feedback – if any – prior to announcing it and launching it to everyone else.

For those involved in the software world, this is nothing new, but for those who are just getting into building products for others or who are looking for ways to test the proverbial waters of their projects without a public announcement for every single release, then this isn’t a bad idea.

Wikipedia defines a soft launch:

A soft launch is the release of a website, hotel, or other product or service to a limited audience. Soft-launching is a method for gathering data on a product’s usage and acceptance in the marketplace, before making it generally available as a hard launch or grand opening.

I think the idea of soft launches, open source, and the general WordPress economy is a really broad topic about which there’s a lot to discuss, but I thought I’d share some quick ideas based on my experience for those who are looking for a process on how to perform soft launches of their work with their existing customer base.