News for hackers. Stuff that matters.
Re:Junior programmer? This may help you by cauterized on Wednesday August 03, 2016 @08:20PM (#12222513)
> - if it takes me more time to understand what you wrote than completely rewriting it you're of no use to me. Since I'm wasting that time anyway, I better write it myself and save the money spent on you.

So well put.

Too bad it's not just juniors who write code like this. I wish I could show the sample code and the TODO comments to one of the "senior" engineers I work with. Because it's exactly (and I mean, EXACTLY) like a few hundred functions he wrote in our codebase in the past few years.

How do you suggest this sort of change of approach to someone who's your peer instead of a n00b you're training up, without sounding condescending or insulting?

Re:Junior programmer? This may help you by mikecb on Thursday August 04, 2016 @06:08AM (#12224515)
Two mistakes in his reasoning that make that point in particular not well put:

1. It takes time, and only time, to develop this skill. It can't be ordered by fiat. He hired junior devs, so this is what he gets.

2. He's thinking in terms of absolute advantage, not comparative advantage. Even if he could code the item more efficiently, it's worth it for him to give it to them.

As for your peers, mandatory/automated testing, mandatory code reviews, automated formatting, pair programming: all are designed to teach people to be better programmers. Implementing some/all of the above won't directly cause an issue between you and the coworker and will help everyone's code become better.

Re:Junior programmer? This may help you by cauterized on Thursday August 04, 2016 @08:36AM (#12225065)
As for point 2, if he's going to be reading it anyway, then there's no comparative advantage either.
Re:Junior programmer? This may help you by ciokan on Wednesday August 03, 2016 @08:28PM (#12222549)
Be better by example. A good project manager will see the value and you will be (hopefully) praised. Show him this post. Talk to him that you're having a bad time following his code. Rewrite some of his work and present it to him. These talks are always hard to initiate because they might not get the right message and turn on you. Good luck to you!