Over the last few months, the Wufoo Team has been steadily refactoring their code base to work with a new more flexible and more powerful API we’ve developed on the backend. In that process, I’ve had the opportunity to rewrite some of Wufoo’s oldest code from the founder’s earlier, more hectic days.
One thing that’s really nice about working with Wufoo is that the attention to detail doesn’t stop at just our UI. Whether it’s the efficiency of a query or the tools we’ve developed for backend development and benchmarking, the team is equally fanatical about making the code on the inside as beautiful as the design on the outside. In fact, whenever one of us is creating a brand new feature or interacting with an old, inflexible piece of code, we’ll take the additional time to ensure that it’s clean and readable for any future programmers working on that code.
The thing I like about our rewrites is that the focus isn’t solely on making it work. We also always strive to make it easy to work with—basically, creating maintainable code. Now, making sure our new code is clear and easy-to-read can be a tedious process that slows down the initial pace of development. But, we’re all firm believers that while the last programmer to write a piece of code might not have known any better, it pays off when Alex, the Programmer of the Present, is nice to Future Alex, the guy that’s going to have to fix the bugs left behind.
While reading through lots of code can give you an appreciation of what well-written code looks and feels like, the ability to create it is a skill that is developed from experience and frustration. Luckily, there are a number of excellent articles and books out there to help the aspiring code perfectionist. The following resources are ones that have helped me personally strive to write code worth looking at :
Articles
Seven Pillars of Pretty Code - Sage advice from the developers at Perforce. A great article and example giving credibility to the fact that maintainable code is essential to a software development companies bottom line.
Code Brevity - Advice on the benefits of being succinct. Learn about the dangers of over thinking your solution and overestimating your problem.
Style is Substance - “What benefits do we get from freedom of style that outweighs the cost we pay for it?”
Books
“Creating Code as an Essay”, Beautiful Code - A description of the principles that guided Yukihiro Matsumoto’s goal of making Ruby a language that creates happy productive programmers.
Domain Driven Design - Stresses the importance and benefits of clear communication in a development team’s code, design, and even speech. Describes a ubiquitous language and design as the base of a products distilled knowledge.
Refactoring: Improving the Design of Existing Code - A guide to improving program internals from with the wisdom of lifelong programmers’ experiences. “Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.”
Code Complete 2, Themes in Software Craftmanship, Chapter 34 - “Communication with other people is the motivation behind the quest for the Holy Grail of self-documenting code.”
Excellent article as always! I’m currently reading through the articles linked in this post.
One of the links points to a local file rather than the online resource, #1 under articles:
“Seven Pillars of Pretty Code - Sage advice from…” points to: a file:// reference.
Just FYI. Keep up the good work!
Good catch Ben. I updated the link.
These are great pointers. It’s always nice to see an appreciation for the subtly artistic nature of code.
I added a bunch of those books to my Amazon wish list!