Skip to content

simpledream

I make web sites and web applications that are simple, attractive, and easy to use.

I am Lance B. Willett, web designer and developer. Read my take on web design, learn about me, or view my work.

Craftsmanship and Coding Standards

Inconsistencies [in your coding style] are jarring and require more time to read and comprehend. Consistency is such a valued quality that developers often abide by a coding standard even if they dislike the coding standard itself. —Chris Shiflett and Sean Coates

I consider following a coding standard a sure sign of a craftmanship. A craftsman knows his tools and languages well, and is consistent in his coding style. Ego and personal preference give way to consistency and best practices.

If you develop on your own, create a coding style and stick with it. There are many practical reasons to abide by code standards when developing on your own. It enforces good habits and helps avoid simple syntax bugs. It speeds up your development process by giving you structure and taking the guesswork out of naming and spacing tasks. And, possibly most importantly, it ensures your code is readable to your future self.

This is all fine and dandy when you’re the only one touching the code. When you share and collaborate with other developers, however, following a coding standard is not a choice—it is mandatory. If you develop for a platform, use the coding standards of the platform. Even if you don’t agree with the standard, you should follow it anyway so that your code is understandable and usable for other developers. Chances are the standards were put in place for very good reasons, both practical and philosophical.

To learn the coding standards for a project you work with, start by looking at other people’s code. Put the standards into practice in your own code and don’t be afraid to ask for a review from someone else. Check your code against similar structures in your software’s codebase, or popular modules, themes, and plugins for the software.

A big part of my job as Theme Wrangler at Automattic is reviewing themes. Lots of themes from lots of designers and developers. Everyone seems to have their own coding style, which makes it difficult to review code and find errors quickly. As a result I spend a lot of time cleaning up themes to match WordPress coding standards before I can even begin the actual work of reviewing and updating the theme.

For that reason code style consistency is especially important to me. It enforces best practices, produces consistent code, and speeds up development between collaborators.

Examples

For the languages I code in often (PHP, HTML, CSS, JavaScript), I use the same general set of standards.

  • Use standard syntax.
  • Remove extra whitespace and line endings.
  • Use consistent spacing and indentation.
  • Use human-readable labels and names.

Following are examples of specific coding standards that I follow in my everyday development.

For a top-notch example of coding standards within a company, see the Fellowship Technologies Code Standards. That, friends, is a well-crafted coding standard that we can all learn from.

Coworking at Spoke6

The May 2010 edition of Tucson Green Times includes an excellent writeup of my favorite Tucson coworking spot, Spoke6. Centrally located in the Warehouse Arts District, Spoke6 is run by Tim Bowen of Creative Slice, a Tucson-based web design agency.

I work there once a week—usually on Friday—and love the quite, productive atmosphere, fast WiFi, and the ability to connect with like-minded individuals (learn more about coworking). It’s also within walking distance of three areas: Downtown, 4th Avenue, and University Boulevard, all of which offer great choices for lunch or a post-work happy hour.

You should come try it out if you live in the area. Your first visit is free!

Spoke6 also hosts Tucson Digital Arts Community events, including the Tucson WordPress Meetup which I host once a month.

You Should Follow ThemeShaper

I’m blogging about WordPress themes and theme development over at the ThemeShaper blog.

My first two posts are up:

I’ll be posting more at ThemeShaper.com over time so make sure you grab the RSS feed to receive notifications about new posts.

See also my fellow Theme Wrangler Ian Stewart’s introductory post, What Is The Automattic Theme Team?

May 2010 Events

I’ll be presenting at two Tucson Digital Arts Community events in May 2010.

I’m particularly excited about the “Introduction to HTML5” talk since it’s my first time co-presenting with long-time friend and former coworker Aaron Wagner. I will cover new features in HTML5 and CSS3 while Aaron will talk about the new JavaScript APIs and browser extensions. Plus, he’ll give us a demo of an HTML5 application called “Times Up” that he built for his church. Can’t wait!

Tucson WordPress Meetup April 27th, 2010

Tucson WordPress Meetup April 27th, 2010.

Join me and the Tucson Digital Arts Community for an evening of WordPress discussion.

Automattic Theme Team

I’m proud to be part of an awesome team bringing improvements and craftmanship to WordPress themes. Today we publicly announced our team goals over at ThemeShaper.com.

So, just what is this Automattic Theme Team anyway? In a nutshell, we’re a bunch of people who really care about WordPress Themes and want to see them get better and better on WordPress.com and for every WordPress.org user. And this is our blog.

Be sure and subscribe to our blog at ThemeShaper.com.

(via What Is The Automattic Theme Team?)