Every software development team has experienced it: the exciting project, the shiny new framework, the enthusiastic client with an optimistic timeline. Left unchecked, these goals, this optimism, can prove fatal to even the best managed project. The thinking can prove disastrous for a very specific reason: code consistency. The void left by improper planning or conflicting ideas can be filled with bugs, unmaintainable fragments and every developer’s worst nightmare: spaghetti code. The argument for code consistency is a simple one, almost a no brainer: set time aside at the start of a project to define code standards and make sure the entire development team is on the same page. With a few simple tools at their disposal, a team can go from spaghetti to lasagna in no time.
Code Consistency Tools
One of the most important code consistency tools in a dev team’s toolbox is the lowly linter. A linter is a piece of software that runs through code and flags any suspicious constructs, which can be bugs, syntax errors or style inconsistencies. Most modern editors like Atom, Visual Studio Code or Intellij have plugins for linters, which are extendable and configurable to virtually any programming language. The best part about these editor-based linters is their configurability. Software teams can define code standards to their preferences, and enforce those standards to live in the editor. Early in the development process, a team should meet to hash out those code standards, either starting with a defined style guide, or from scratch and building the linter configuration to suit their needs. There are good linter options for most modern programming languages such as:
- Tslint (https://github.com/palantir/tslint) for Typescript, or
- Checkstyle (http://checkstyle.sourceforge.net/) for Java.
The third, and simplest, tool in a dev team’s toolbox is proper utilization of source control. No matter the chosen SCM (Source Control Manager), a commit standard should be established. Commits should be compact, they should only include changes from related edits, they should be categorized, file creations and deletions should be committed separately from edits, and they should be organized, feature branches are a dev team’s best friend. Likewise, commit messages should be short, succinct and to the point, providing descriptive information about the changes made. If the team uses team collaboration software such as JIRA, Trello or Github, commit messages should be tagged with issue numbers to link to feature descriptions and bug reports. With proper source control management, a team’s collaboration can rocket to new heights of productivity.
When planning a new software development project, be sure to plan for code consistency. A strong code base can transform a messy project into a streamlined, efficient productivity powerhouse, empowering developers and providing clarity and insight to project managers and product owners.