Clean code is a set of habits, not a book you finish. Fix names, function size, flag arguments and error handling one habit at a time, let a formatter and linter settle style, learn to refactor in small steps behind tests, and keep a list of the review comments you get twice: that list is your personal curriculum.
What people tell me
I started my first developer job a few months ago. My code works and passes the tests, but every pull request comes back with a long list of comments: rename this, this function does too much, do not swallow this exception, this should be its own class. I fix them, but the next pull request gets similar comments. I read part of a clean code book, but I do not know how to turn it into habits, and I am worried my reviewers think I am slow to learn.
A composite of the messages behind this question, with personal details left out.
Key takeaways
- Repeated review comments are a lesson you have not learnt yet, not a judgement of you; write them down.
- Pick one habit a week, such as guard clauses or no flag arguments, and apply it everywhere you touch.
- Let a formatter and linter handle style so reviews can focus on design.
- Learn your IDE's rename and extract shortcuts; small safe refactorings are how clean code happens in real code bases.
- Review your own diff before you ask anyone else to.
First, this is normal
Almost every junior developer I have worked with went through exactly this. Working code is the start of the job, not the end. Code is read far more often than it is written, and your reviewers are teaching you to write for the next reader. A long list of comments means people are investing in you.
The problem is not the comments. It is that you are fixing them one pull request at a time instead of turning them into habits.
Turn review comments into a checklist
Start a note today. Every time you get a review comment, write it down in your own words. When the same comment appears a second time, move it to a short pre-review checklist. Before you send any pull request, read your own diff against that list. Within a few weeks, most of those comments will stop, because you will be catching them yourself.
One habit a week
Books on clean code contain dozens of rules, and trying to apply all of them at once does not work. Pick one habit a week and apply it everywhere you touch:
- Names that explain themselves: no
data,info,temporManager. Rename with your IDE the moment you find a better word. - Small functions: if you need a comment to explain a block, extract it into a function with a good name.
- No flag arguments:
send(message, true)becomes two clearly named functions. - Guard clauses: handle invalid cases at the top and return early, so the main path is not nested.
- Specific exceptions: never catch everything and carry on; catch only what you can handle and add context.
- Comments that explain why, not what.
Let tools settle style
Formatting arguments waste everyone's time. Set up the formatter and linter your team uses, run them on save and make sure they pass before you push. Then reviews can focus on design, which is where you learn the most.
Learn to refactor safely
Clean code in real code bases comes from many small, safe changes, not rewrites. Learn your IDE's shortcuts for rename, extract function and inline, and run the tests after every step. Keep refactoring and behaviour changes in separate commits so reviewers can check both. The Gilded Rose refactoring kata is the best practice for this: do it once now and again in a month.
Where to learn it on Sefism
- The Software design and clean code roadmap has a full stage on clean code, another on refactoring and a last one on code review, giving and taking it.
- The software design cheat sheet has a smell to refactoring table you can keep open while you review your own diff.
- Refactoring.Guru's code smells guide is free and has before and after code for every smell.
- Google Engineering Practices explains what reviewers look for, which tells you what to check first.
Send smaller pull requests
Finally, make your changes easier to review. A small pull request that does one thing, with a clear description of what and why, gets careful comments. A huge one gets tired ones. Smaller changes also mean fewer comments at once, which makes each one easier to learn from.
If you want a second pair of eyes on your code or your checklist, create a free account and book a session with me. You can also read more answers on the questions page.
Was this answer helpful?
Your situation is not quite this one?
Members get written answers to their own questions, a roadmap built for them and feedback on their projects. Early access is open: sign up and your account is active shortly after. Prefer to talk? A free call works too.