Have you ever been on a project that is simply riddled with problems? We’re not just talking about bugs either but trouble of all kinds – regression errors, performance issues, unnecessarily complex code, !important rules sprinkled with abandon into your stylesheets. All of this as if no one cares! Well, maybe they don’t, but there are good reasons why they (and you) should.
Quality begins with a sense of pride in what you do. It is far above simple competence. It requires passion and is one of the things that will make or break your project, your app and your career. Fortunately for us, quality can be managed and to some extent taught.
What does craftsmanship mean in a digital product?
“You shall not, for the sake of one individual, change the meaning of principle and integrity,” ― Jane Austen, Pride and Prejudice
Craftsmanship comes from the heart. That sounds corny but it’s true. It’s a high level of quality and attention to detail that cannot be achieved unless you love what you do. You could easily follow this point with a comparison of cars. For example, a 1971 Ford Pinto vs. a 2005 Mazda MX-5 but we can just as easily compare digital products or even just compare a snippet of code.
The example above is pretty terrible. In fact, it’s almost unreadable and contains a whole host of other problems (over-nested, no protection, poor naming conventions and unnecessarily complex). Let’s clean it up.
Here’s what we did:
- Declare our variables at the top of the method
Removed unnecessary logic
Removed unnecessary statements (console.log, etc)
Applied consistent formatting (whitespace and indentation)
It didn’t take too much effort to make that better but the difference is remarkable. Not only is the 2nd example easier to read but its easier to maintain. Both of those things will lead to fewer bugs. It also didn’t take any special skill to clean that up, just a desire for good code and an intolerance of bad code. If looking at the first example makes you nauseous, that’s a good sign.
Strive for quality and attention to detail in your code. Remember that when coding, you’re writing in another language. That language should be used effectively so that other people can read it and understand it with ease. Establish a set of coding best practices for your project and then strictly and consistently adhere to them. If you decide that all indentation should be 4 spaces then don’t tolerate 2 spaces + 1 tab. If you think all object properties should be lined up on the colon, then do it and do it every time.
Why poor quality is a systemic problem
“Everything nourishes what is strong already” ― Jane Austen, Pride and Prejudice
The best project leadership creates an atmosphere that emphasises quality. That leadership includes the senior developers. We were once on a project that required peer code reviews and a unit test to be done for each commit. Occasionally, we would pair program on complex features. Some of those code reviews were brutal and we were all very critical (but not in a mean way) of each other’s code. Projects like that can appear to move slowly at first. However, productivity gains are made by virtue of never (almost) having to sacrifice a sprint to fix bugs. Additionally, regression errors are almost unheard of. With more than one person looking at the code, it will be easier to read and even easier to refactor.
We’ve been on other projects too. Ones where management focused solely on costs and expediency. Some of those sprints introduced as many bugs as they fixed. In an attempt to “just get it done” we made phantom fixes that “seemed to work”. The majority of the team lacked a sense of ownership in the product and we kept kicking our technical debt down the road until eventually things broke.
Taking pride in your craft will improve your app and your career
“Yes, vanity is a weakness indeed. But pride – where there is a real superiority of mind, pride will be always under good regulation.” ― Jane Austen, Pride and Prejudice
No one wants their legacy to be “I reached for mediocrity and achieved it.” Everyone has the potential to be great. All it requires is a bit of extra effort and a little of what we call the three “takes”.
1. Take pride in what you are doing
This is what you do for a living or passion. Be proud of what you are delivering to your clients. Don’t just write an application. Craft it! If you create something beautiful and durable, it will last and you will have something to be proud of.
2. Take time to learn best practices
If you find yourself on a project with new technology then take the time to learn the best practices for that technology. Establish a best practices guide for your project. Keep learning, keep improving and keep practicing.
3. Take criticism from your peers
Criticism can be hard to take but don’t make it personal. We all have the same goal – build the best app possible. So, solicit code reviews from your peers. Better yet, establish a formal code review policy for your project. When everyone is sharing and critiquing each other’s code, we all learn and we all become better programmers. You can head off a lot of bugs and greatly improve project quality with this one takeaway alone.
Use these three things in your project and your app and career will thank you.
Tools and techniques to help manage quality
“The creatures were crawling on their hands and knees, biting into ripe heads of cauliflower, which they had mistaken for stray brains.” ― Seth Grahame-Smith, Pride and Prejudice and Zombies
There are a number of things we can do to help manage quality. Bear in mind these things are just extras. They will give your project some additional standards but in no way are they a replacement for pride and the love of what you do.
- Automated Testing
Even though this one goes without saying, there are a surprising number of projects out there that don’t do it or try to add it in after the project is 85% done. At a bare minimum, add unit tests for your controllers and basic UI tests.
This one can be a bit expensive resource-wise. If you can afford it though, it pays off in spades. Pair up your junior devs with the seniors, even if it’s just on occasion. There are number of pair programming tools to help accomplish this remotely too.
While engaged in pair programming, share the task of testing as well. This is a great time for each person to maintain a healthy level of suspicion of the code that’s being produced and correct many first-level problems before they are found in formal QA.
Sometimes you end up with someone on the team who’s just a stick in the mud. Don’t let standards drop just because one or two people won’t follow the rules. If you find yourself outnumbered, then maybe you need a better team to work with.
Code Coverage & Complexity Tools
There are a number of these available depending on your project language(s). If you are doing peer reviews, then the complexity tools should never find anything to complain about. Code coverage can help you identify where more automated testing is needed.
Did we mention peer reviews? We’re firm believers in this one, which is why we listed it twice.
“Elizabeth sheathed her sword, knelt behind him, and strangled him to death with his own large bowel.” ― Seth Grahame-Smith, Pride and Prejudice and Zombies
Craftsmanship starts with pride in what you do. It demands that you pay attention to the small details and never accept “good enough”. It will take extra effort but it’s worth it. It will require passion, pride and a maybe a little prejudice; but, your project and your career will thank you.