Code, while often invisible to the business owner, is the core component to a software product. It literally instructs the software how to behave. Unfortunately, many business owners don’t really understand why or what code quality means to their business.
The reality is that code quality can be critical to a business’ success. Good code means developers are able to build and change features quicker, and the risk of bugs arising from these changes are lower.
Good Code = Changeable
Bad Code = Concrete
Many business owners think high quality code is for established companies with high budgets. In fact, the inverse is true.
The younger the software company, the more important code quality is to its success. This is because there is more uncertainty in the business itself, which often means the software will need to evolve quickly to keep up with the shifting foundation beneath it.
With high quality code, developers can make feature changes like a skiier cutting back and forth down moguls on a black diamond. Left, right, hop over that one, and boom — you just won the race.
With low quality code, it looks a little bit more like this:
So, what exactly is “Code Quality”?
You can think of high quality code as a well-written story. The reader of this story is a future developer that is hoping to change it. The better the story, the easier it is for this developer to pick up on the narrative and move it forward.
If good code is like good writing, than the question is: what makes one piece of writing better than another?
Here are a few ideas:- Good writing is easy to read- Good writing is logical- Good writing is grammatically correct- Good writing is succinct (i.e. doesn’t unnecessarily repeat itself)- Good writing tells a full story
With these attributes in mind, which of the below pieces of code do you think are better written?
x = 50 / 100 print x
number_of_questions = 100 number_correct = 50 test_grade = number_correct / number_questions print test_grade
While the first option is much shorter, it does a terrible job at telling a story. What is 50? What is 100? Why are we dividing them? These are questions that as a reader of the code I would immediately begin to ask.
In the second option, I know exactly what is happening. We are calculating the grade for some type of test. There are 100 questions on this test and there are only 50 correct answers, so the person got a 50% grade. While longer, this option is much better as it tells a full story about why the code was written in the first place: to calculate the test grade.
Now picture the difference between these two bits of code being compounded across an application with thousands of lines of code. If all of the code is written like the first option, it takes days to make changes to the application because one must figure out what the code is doing in the first place. What is 50 and why did we need that again?
To an untrained eye, the first option may appear to have good code quality. Wow — look how succinct that first bit of code is! Only one line baby! But a veteran is not fooled — this code is not telling a story and the business owner who paid for this line of code will have to pay for this story to be rewritten some day in a manner in which other developers can actually read and understand.
How can I make sure I have good code quality?
Test Your Developers’ Writing Skills
The first check is to make sure the developers you are hiring are good writers. This sounds funny but it’s honestly a great first check. Have them explain (in writing) something technical and see how easy it is for you to understand. For example, ask “What is Ruby on Rails and why are we (or are we not) using that for our project?”
If the answer is over your head, it’s not because you’re an idiot, it’s because the developer either doesn’t have a good grasp on what they’re trying to explain or they just plain aren’t good at writing. Either way, this will manifest itself in your application in the form of convoluted, hard to read code. Steer clear.
Grade the Code
There are some tools that can give you a high-level pulse of your code quality.
The tool we use at LaunchPad Lab for this is called Code Climate. It integrates with Github so it takes all of 30 seconds to set it up. Once setup, Code Climate will grade your code on a 4.0 scale.
If you are thinking about building a new piece of software, start out with Code Climate right out of the gate. There is nothing stopping business owners from having access and being privy to the code quality metrics offered by tools like Code Climate — so take advantage.
Setup Continuous Deployments
Make sure your development team sets up continuous deployments. This will encourage them to write the code with tests, which are a big contributor to code quality. It also just makes it a lot easier to make quick iterations on the code base. We recommend Codeship for this.
Don’t Hire Offshore Developers
This is a guideline, not a blanket statement. But in my experience I have seen far more horror stories than successes when hiring overseas. Many of our clients have first hired overseas only to have to scrap the whole application and start over with a US based team.
Although invisible to the naked eye, Code Quality can deliver a huge ROI, especially for companies that are rapidly changing. Make sure to hire developers that want to write an eloquent story for future developers to read. And use tools like Code Climate to keep a pulse on your Code Quality score.
Ready to Build Something Great?
Partner with us to develop technology to grow your business.