Live data from Hacker News

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

news.ycombinator.com

81–87 of 87 posts

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

#81

Depending on the language and context, an explicit method name like "findEventsFromLast6Hours" isn't that bad. If it's just a private helper method, I'd let it pass. Empirically, I've found that methods with ambiguous parameters (e.g. "findEvents(6)") are a much bigger problem (event amongst senior programmers).

I also had a problem with this example from OP. It is generally a good idea to implement the minimum amount of functionality to satisfy the requirements. I have seen many complex systems fail because it was over-engineered with the idea that 'we might need this down the road'.

When requirements change, you almost always have to rewrite the code. If you don't have to rewrite the code, you still have to go back and read it to make sure it satisfies the requirements. Less code to deal with will make this process easier. There is no reason to over-engineer today for what might happen tomorrow.

Code for the here and now, and aggressively delete code whenever possible.

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

#82

Depending on the language and context, an explicit method name like "findEventsFromLast6Hours" isn't that bad. If it's just a private helper method, I'd let it pass. Empirically, I've found that methods with ambiguous parameters (e.g. "findEvents(6)") are a much bigger problem (event amongst senior programmers).

I also had a problem with this example from OP. It is generally a good idea to implement the minimum amount of functionality to satisfy the requirements. I have seen many complex systems fail because it was over-engineered with the idea that 'we might need this down the road'. When requirements change, you almost always have to rewrite the code. If you don't have to rewrite the code, you still have to go back and rea…

If your 'coders' are writing functions like findEventsFromLast6Hours, you are not giving them clear requirements.

I assume you gave this engineer the requirement 'find all events from the last 6 hours.'

You should have given them the requirement to find the latest events for a specified interval.

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

#83
I think you need to come up with a coding guideline. After that, you review/discuss it with your team.

Also, you may need to create a "checklist" and encourage your team to follow it as a way of self-check on their work.

In this way, you will be able to concentrate your reviews on important things (such as logic, etc) since the trivial errors were already eliminated.

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

#84
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…

My current company does this also. The team is slightly smaller with 6 but we are in the process of taking on a couple more developers and the peer review process will still remain. The CTO like yourself reviews all code commits as a final sign off once the change has been through a more thorough peer review. So it is possible to do 100% peer reviews.

Your point 10 highlights exactly how I feel about it.

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

#85
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…

I just spent the better part of a month cleaning up some CI issues. By the time I go to bed tonight, I hope to have a CI process completed for two platform implementations of an application that's been under development for some time. Part of the process is static analysis and linting.

I've seen the static analysis and lint results already. Not pretty, but we can clear most of it up as we develop new features.

Definitely a process that anything beyond a trivial app needs in place.

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

#87
post #66
post #51

Earlier quoted context omitted.

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?

http://teamtreehouse.com/
Post reply on HN