This post originally appeared on Tandem's blog.
At the most basic level, code is a bunch of 0s and 1s. Some people might think that means code is inherently neutral, and that problem-solving in a logical way doesn’t leave room for introducing an individual’s values. But nothing could be further from the truth.
Code doesn’t live in a vacuum: by existing in our world and society, the products our code creates are not neutral. There’s a difference between writing code that helps people receive their unemployment benefits and writing code that excludes, harms, or does violence to people.
In addition to considering the impact of a shipped piece of software, developers have the opportunity to express their values within the code itself. My engineering team embraces this opportunity with coding practices that express our values.
Our core values can be expressed through code
At my previous company, we have six core values that we are very intentional about: we make sure our job expectations, our performance reviews, and our interview process all align with them. Our commitment to those values extends to the way we approach our work as a development team, too. Here are three of the values we express through the way we code.
Ship quality work: When we leave a project, or hand off code to a client to maintain, we want it to continue to be quality regardless of who maintains the code. So, we have tools to help us do that:
- We’ve set up our CI/CD pipeline so our code is linted to make sure it follows stylistic standards, functions correctly, and doesn’t introduce any known security vulnerabilities. This helps remove opportunities for human error as the code continues to be enhanced over time.
- We add customized pull request templates and issue templates to the code repositories we work with. These templates include fields that ensure documentation remains robust and clear.
These practices help the code’s quality live on, even once our team is no longer the keeper of the codebase. And that means we’re realizing our core value to ship quality work.
Open the door: This core value means that we help each other, we value diversity, and we are inclusive.
- Our PR templates and commit messages give us opportunities to be inclusive. By providing clear context for future developers, we avoid gatekeeping and instead, bring that future developer on the code’s journey with us. Documentation is a way of demonstrating empathy for other coders.
- Another way we open the door is by avoiding variable names that have potentially problematic implications. Our team maintains a list of words that we avoid (like ‘whitelist/blacklist,’ ‘master/slave,’ ‘middleman,’ and others) and preferred substitutions that we use instead (‘allow list/denial list,’ ‘primary/secondary,’ ‘intermediary,’ etc.).
When we open the door, we do our part to make our work accessible and welcoming to all who might interact with it in the future.
Continuously improve: Technology is an exciting field because there’s always something new to learn. We strive to make experimentation, teaching, and learning both expected and safe, for our own team and for those we work with.
- Our CI/CD pipeline setup ensures there is value in writing tests, because they run automatically and if something is broken you’ll be alerted. So if a client is new to working with us, their team will know that we wrote tests on their project and that those tests add value.
- When working with a client’s existing codebase, we incrementally make improvements to the code and help make that code more resilient over time. By clearly documenting our reasoning in the commit messages, we both improve the code and educate developers who look at the commits in the future.
Our engineering team believes strongly that we should always leave code better than we found it. Leaving clients with better development practices is one way we contribute to a broader developer culture of learning and teaching.
How to instill your values into code
If you’re looking to be more intentional about incorporating your values into the code you produce, the first step is to identify and define what those values are. What’s important to you and how you prioritize will impact your coding decisions.
Once you know what your values are, find places where you can make them automatic. There will always be pressure to ship code faster, work harder, and get everything done quicker. Taking steps to make your values a permanent part of your workflow, instead of a thing you have to actively remember, really helps overcome that barrier. Think about making a PR template that always asks the questions that are important to you, or setting up your CI/CD pipeline to run tests automatically.
By keeping your values at the forefront of your coding practice, your work can be more fulfilling and can give you a feeling of ownership and pride. Often, thoughtful application of values also ends up making the product stronger! Wherever you are in your journey toward values-focused coding, I hope this overview of our approach provided some inspiration.