I review commits now and then and find some of these issues - but due to the nature and timeline fo the project cannot do it for each and ever commit of course. So I'm wondering what I can do about this? Is there a short guide or book that I can recommend my team to read? I of course tell them these things myself too - but it gets frustrating because I keep feeling like a lot of this should really just be common sense.
Ask HN: How do I get my team to write better code?
1–10 of 87 posts
Re: Ask HN: How do I get my team to write better code?
#2Simply put: we use git and developers can't commit to the master branch. They commit to their own branch, the build system builds/tests that branch and the developer makes a pull request and gets the code reviewed.
Re: Ask HN: How do I get my team to write better code?
#3You need two other seniors to give you +1 to move on. The number "two" comes from the fact that we are still a small team.
People can will still review stuff that has already two +1's but the commiter could already move on if needed.
The advantage of pull requests is less "teaching how to do it properly" but more "learning from each other" and "continous exposure to all parts of the codebase".
Thus it's not the job of the Team Lead to do this reviews but everyone's.
Pull requests reviews are done (asynchronously) done each morning (whatever this means for each person/timezone). This leads to the fact that you usually can expect PRs to be done within 12-36hours.
I could not imagine working in a team with different experience levels (not speaking of countries/timezones/specialisation) without pull request reviews.
Re: Ask HN: How do I get my team to write better code?
#4Re: Ask HN: How do I get my team to write better code?
#5pull requests also essential but it's still admin overhead for you to review everything
Re: Ask HN: How do I get my team to write better code?
#6I wrote a short blog post for work about this http://blog.cloudflare.com/making-code-better-with-reviews/ Simply put: we use git and developers can't commit to the master branch. They commit to their own branch, the build system builds/tests that branch and the developer makes a pull request and gets the code reviewed.
1) You're more likely to catch bugs, security issues, and potential performance problems before they get into your main branch.
2) Your developers will get feedback on their code, which is hugely important to growth (you can't learn from your mistakes if you don't know you're making them).
3) Your developers will learn how to give feedback, and how to have constructive discussions about code by virtue of reviewing and commenting on pull requests.
4) I think there's some light, healthy social pressure when you know that other people are going to be doing code reviews. People seem to be a bit less likely to take the "easy" (read "hacky") way out of a problem when they know there will be eyes on their code.
My experience has been that most developers really like getting feedback and having these discussions. And I've definitely seen them pay off.
Re: Ask HN: How do I get my team to write better code?
#7You should also lead by example. Your post includes numerous spelling and grammatical errors. If you want them to be precise with such things, you yourself must do the same. Sorry, not picking on you, but your developers will follow your lead with any form of writing.
Re: Ask HN: How do I get my team to write better code?
#8http://www.amazon.com/Code-Complete-Practical-Handbook-Const...
Re: Ask HN: How do I get my team to write better code?
#9Re: Ask HN: How do I get my team to write better code?
#10http://www.barnesandnoble.com/w/clean-code-robert-c-martin/1...