Live data from Hacker News

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

news.ycombinator.com

21–30 of 87 posts

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

#21
You absolutely need coding standards (the stricter, the better, as long as they make sense), especially with languages like C or Perl where you can shoot yourself in the foot with what looks like particularly "smart" coding.

I'd also recommend choosing a strict language with useful conventions like Go (www.golang.org) if you have the possibility to switch. If will prevent many (not all) headaches in the long run, even if it's not immediately obvious.

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

#23
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 entire group gets on the same page about IDE, coding standards, patterns, and whatnot.

I'd plan for a few days, but you might see results just in a solid morning of doing it. Don't know.

Of course, you probably don't have a few days. But -- how much time are you losing to this other stuff? Couldn't hurt. Beats giving people a book to read.

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

#24
the best way you can improve the quality of code is to LEAD BY EXAMPLE. you're not alone in that you've been given a leadership position in a circumstance outside your control, and it's naive to think that even if you were given your pick of the litter, that they'd all be A players who respect you and don't want your job, have issues with your quality, etc.

You absolutely cannot control people. The only way to get people to do things, and i mean the ONLY way is to get them to WANT to do it. Therefore, you have to ignore the people who aren't cooperating with you and focus on the one's who do. Treat them like gold and be willing to make compromises with your quality standards because they will not be the same as yours. Then, as you make inroads on the project together, the rest of the team members either have a choice to get on board or get left behind. It is that simple.

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

#25

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?

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

#28
It is your team, with your own culture, so I would not presume to tell you exactly how to do it, but I can give one general bit of advice:

Communicate.

Tell them what you are seeing, and just as importantly, why it can be a problem. Many times, beginner mistakes arise simply because they never have been exposed to the reasons for them being "mistakes" in the first place. So teach them. Nicely.

Think of them as students, and you are their teacher/mentor. Help them grow, support them and act as a resource so they can do their own jobs better. Treat the whole experience as an opportunity for growth, not a judgment on their skills.

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

#29

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…

This 100%, but also OP says due to the nature of the timeline of the project he cannot review all of the commits, this leads me to ask: what are your developers' timelines for delivering work like? Equally important, what do they feel like their timelines are like?

It's really easy to write problematic code if you're being pushed to crank out work fast, all the time. The more stress and tighter the deadlines the more easily correctable problems you are going to see. Other than that you have to assess whether your team believes the errors you see are actual errors.

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

#30
1. Smaller commits. Break the project down into smaller tickets and have them check-in more frequently.

2. Rotate who reviews so everyone gets a chance to review everyone and put yourself in the rotation.

3. Lead by example. Write some code into production and submit yourself to review. Everyone writes code, everyone reviews, everyone gets reviewed.

4. Each review find just one thing to refactor and let them know they should be looking for the same thing in other people's code.

Post reply on HN