Video in progress
In an engineering department of 60 people, how do you introduce clean code and design standards so they don't stay on paper?
I give everything that can be automated (formatting, static analysis, architecture rules) to CI, and I show the remaining decisions through ADRs and a sample project. We write the standards together with the teams and keep them few but mandatory.
📖 Answer
A long "coding guidelines" Confluence page almost never works: nobody reads it, and code review arguments turn into arguments about personal taste.
I do it in layers:
- What a machine can check, with no discussion.
- formatting: Spotless or google-java-format, with
checkin CI; - static analysis: Error Prone, SpotBugs, Sonar: only real bug categories are mandatory, taste issues are warnings;
- architecture: ArchUnit rules as a shared library that each service plugs in;
- everything is mandatory for new code, and "frozen" for old code.
- formatting: Spotless or google-java-format, with
- Design decisions go in ADRs. "Why a JPA entity is used as the domain", "Why Kafka and not RabbitMQ". Short, in the repo, with the decision and the reason. A new hire finds the answer on their own.
- A sample (golden path). One template service: package structure, error format, logging, tests. New services are generated from it. People follow a sample, not a rule.
- Review culture. A short review checklist (5–7 items), and a "nitpick:" prefix to separate taste issues from blockers. Rejecting big PRs is normal.
- A guild / architecture forum. Every two weeks, team representatives look at proposals to change the standards. A standard that is an agreement and not an order from above gets followed.
I know whether it's working by watching: the trend of violations in CI, repeated review comments (those are candidates for automation), and the time to a new hire's first PR.
A mistake: making everything mandatory in one day. Teams stall and look for ways to switch the rules off. Introduce them one at a time, and explain why.
Sign up to mark studied questions and save your progress.