July 20, 2023•806 words
Style guides are used to get your team on the same page so you can work effectively together.
Different guides cover various aspects of the software development process. Some exist to help you write readable code. Others give business context. And others help the team make consistent decisions. These guides can be a mix of tools and documents that help your team understand how to interact with the system when writing new code.
Code Formatting Guides
Coding styles are often convention-based, with each language community having a "proper" way to write code, like C#'s
PascalCase for class names or Rust's
snake_case for local variables. These consistent styles help other developers read code more easily, since the conventions communicate semantic meaning beyond simply how the text looks on the screen.
Code formatting can be automated as part of the development process. These formatting tools can be integrated into your IDE to run when a file is saved or work is committed to source control. By automating the code formatting process you can save time and mental energy because you no longer need to have discussions regarding the code's format. Since the tool is formatting everything for you and your teammates, the code is more readable for everyone on the team, regardless of who wrote it.
In addition, code formatters can save time during development since you don't need to manually style anything. No more tapping the spacebar 8 times to get that line just right. Instead, you write the lines of code that are in your head in any format, hit save, and the code formatter takes care of the rest! Or at least pretty enough. There will always be differing opinions on how the code should look, which is exactly why you need a good formatter!
Business Domain Guides
Other style guides are business domain specific, such as using certain acronyms and terminology. Glossaries in particular are helpful for new teammates to understand conversations about the business.
Standardized naming conventions across the technology department can also reduce confusion. For example, if teams use different names for their various environments, business stakeholders might have a hard time understanding where to look for new work or data.
Making sure you use the same terminology allows you to communicate more clearly with other business units and better understand their needs. And taking the time to learn the business domain will make you and your co-workers better developers who can collaborate effectively with stakeholders.
Often these documents turn into long lists of acronyms that are jumbled together with no groupings. Take time to organize those lists and put similar terms together. And don't forget to make them searchable so you can look up definitions on the fly in a meeting!
Technology and Implementation Guides
Effective teams create and communicate consistent standards for selecting new technologies or writing more code. This type of style guide differs from code formatting because they are more about the why behind how code is written.
For example, a front-end team might decide to use the MUI library for a React project. This decision should be written down and agreed upon by the team, and everyone should commit to using the selected technology. It would be inappropriate for a developer to introduce a second component library because this breaks the established pattern and adds complexity to the codebase by having two different ways of writing UI for the project.
These technology decisions can also include chosen best practices regarding algorithms to use, architectural patterns to implement, or infrastructure services to reach for when creating new projects. Every team is under a unique set of constraints, so there's no one-size-fits-all list of the types of guides you need.
A good tech lead will make sure there is enough documentation to help the team make good decisions, but not so much that nobody reads the various essays on best practices.
It's helpful to create all these different style guides as a team and to make them part of your team's onboarding process. Every new teammate should read through them when getting started and bring any questions or learnings from their own experience to the team.
In addition, regular reviews of the documents are useful to ensure they still match the team's day-to-day practices. You can either remind the team that they are straying from the guide or get the guide updated to match the team's new reality. I recommend setting a recurring task or calendar event to check over the documentation a couple times a year!
Over time you'll have a small, refined set of documentation that serves as a guidepost to keep the team writing excellent code that is maintainable.
This is the sixth of nine articles delving into the processes that every effective development team should use. Stay tuned for more!