Live data from Hacker News

Ask HN: How do I get my team to write better code?

news.ycombinator.com

61–70 of 87 posts

Re: Ask HN: How do I get my team to write better code?

#61
post #47

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. Why not? I do. I have 8 direct reports and I review every single line of code that they write. Some days this is all I do. Others think I'm crazy but our group outperforms every other group by any measure. I'm convinced it's because of peer review. A few thou…

+1

100% peer review is the only process change that has been implemented anyplace I've worked in the last 18 years that seriously and lastingly improved code quality. I don't like reviewing, but it's very very effective, especially once you get good at it (and, like anything, it takes practice) - also, fwiw, it really improves you own coding

Re: Ask HN: How do I get my team to write better code?

#62

You need to stop thinking of them as 'coders'. When you think of them that way, you're putting them in a box and limiting them. Instead consider them to be a team of people. As you said, each of them are at different stages in their career in programming. You need to understand this and sympathize with them and their code. This takes time and effort on your part to help lead the way. You say that you review the commi…

You're very right about the coders bit - I guess it was more an issue of framing it. I've corrected it now.

I do bring the issues up - but usually end up being really frustrated because I assume that these things should be obvious. A lot of the comments in this thread are forcing me to reflect though, and realize that I didnt "know" those things out of the box either - but learned them by seeing others' good code and learning from that or because someone was patient enough to walk my through my mistakes (of which I certainly still make many).

While a pull-request based system would be ideal - it's the timeline and the scope of work that has us a little bit stuck with setting up such a new process.

My key takeaways from this thread would be though that I should certainly do more of the code-reviewing & maybe even get some of the team more involved in code-reviews.

Really appreciate the tremendous feedback here and it makes me realize again why I end up spending so much time on HN - there's just so much to be learned here from some truly helpful folks!

Re: Ask HN: How do I get my team to write better code?

#63
post #47

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. Why not? I do. I have 8 direct reports and I review every single line of code that they write. Some days this is all I do. Others think I'm crazy but our group outperforms every other group by any measure. I'm convinced it's because of peer review. A few thou…

The logic of "spend time now because otherwise you'll spend 10x later" - really resonates with me. I guess I need to see it as an investment rather than a waste of time - that really turns the entire thing around quite a bit! Thanks :) - I also completely agree with number 9 - it is easier said than done though in some companies :/

Re: Ask HN: How do I get my team to write better code?

#64
post #60

I think you can get a long way with "automated code reviews" - basically, linting and static analysis. There are various ones out there for your language - disclaimer: I wrote one for Python called https://landscape.io They can take a little while to get set up exactly how you like them, but once you do, run them on your CI server after every commit and it'll output the warnings about style violations and so on. That…

this is great - I love coding in Python and would definitely use this in the future. Currently we're doing everything in Node.JS though - do you know of any tools for that ? We do use Jslint etc - but landscape certainly seems to go a step further..

Re: Ask HN: How do I get my team to write better code?

#65

We do 1-1 peer reviews and make changes in real-time so that the developer can see the preferences for code style, naming, indenting, etc. You 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.

Right, well it's one thing when posting on HN - I'm not really running a spelling and grammar check. That said - my complaints are not around their writing style. Many of them are non-native speakers and I can live with bad grammar & spelling in comments. The pain-point is really the coding style that leads to bugs where they could have easily been avoided.

I do get your general point of leading by example though - and like the idea of "show them whats wrong instead of just telling them by fixing it in real time".

Re: Ask HN: How do I get my team to write better code?

#66
post #51

You need to stop thinking of them as 'coders'. When you think of them that way, you're putting them in a box and limiting them. Instead consider them to be a team of people. As you said, each of them are at different stages in their career in programming. You need to understand this and sympathize with them and their code. This takes time and effort on your part to help lead the way. You say that you review the commi…

Agree 100%. My boss has invested in Treehouse to improve code practice. We also started pair programming to help each other identify potential bugs and teach each other new ways of doing things. It reduces tech debt as well.

Treehouse? All the searches for that keyword with this topic led me to some sort of beginner's course on programming... Link, please?

Re: Ask HN: How do I get my team to write better code?

#67

Honestly, the things you describe are not that bad. If they are writing code that passes the test cases, move on and be happy. If you'd described things like circular dependencies and passing brittle "magic strings" through multiple layers -- things that will GENUINELY cause maintainability issues I'd sympathize more. I doubt anyone named it the "...last6hours" but then parameterized the number of hours -- so you're…

Thanks - while a lot of the other advice on this thread is helpful in terms of being a better team lead in general - I think the stuff you mentioned is really what I can apply almost immediately - especially the last bit about makign things maintainable.

Re: Ask HN: How do I get my team to write better code?

#68

Saw something interesting at a conference a while back. If you have a few days, it might be worth trying. It's called "mob programming" Basically you get everyone in a room. The basic premise here is that everybody brings their "A game" and shares it with everybody else. One person types, everybody else decides what to type. Sounds chaotic, but as long as folks stay focused, what happens is that very quickly the enti…

I find this both crazy and quite appealing! Maybe doing so after also dishing out some of the good books recommended elsewhere in the thread could work well. First read about good practice, then participate in it?

Yes. It struck me as one of those "crazy enough it might work" things.

Looking forward to trying it!

Re: Ask HN: How do I get my team to write better code?

#69
post #60

I think you can get a long way with "automated code reviews" - basically, linting and static analysis. There are various ones out there for your language - disclaimer: I wrote one for Python called https://landscape.io They can take a little while to get set up exactly how you like them, but once you do, run them on your CI server after every commit and it'll output the warnings about style violations and so on. That…

this is great - I love coding in Python and would definitely use this in the future. Currently we're doing everything in Node.JS though - do you know of any tools for that ? We do use Jslint etc - but landscape certainly seems to go a step further..

You should check out https://codeclimate.com/ then, they support JS and Ruby. There's also https://scrutinizer-ci.com/ who do PHP and apparently Python and Ruby now too.
Post reply on HN