News for hackers. Stuff that matters.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by mabbo on Tuesday July 24, 2018 @10:21AM (#17601239)
> “code someone else wrote that I’d rather rewrite than understand”

I'm not disagreeing, but there is something to be said for writing code that any idiot can understand so that future developers don't even want to rewrite it, and can maintain it.

I've landed in code bases on both ends of the spectrum, and I never asked management to rewrite the well-written ones.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by omeid2 on Tuesday July 24, 2018 @10:27AM (#17601292)
In a wicked way, people who write that kind of code never get credit for it, and often lose leverage of their job.

I am not saying that writing convoluted code is good, no, but I can tell, even if based on personal experience, that barely anyone talks about "wow, this is such a straight forward code" or gets promoted for "everyone can understand your code!".

It is a weird dynamic that gets worst by having non-technical managers, and the reason why I believe team leaders should be hands-on in software development and involved with code review.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by waterlink on Tuesday July 24, 2018 @10:32AM (#17601348)
Let me get this straight:

Person A, a programmer, who writes easy-to-understand code, but takes a bit more time to finish their tasks

Person B, a programmer, who writes dirty code, but takes much less time to finish their tasks

The current non-technical manager will see only one part of the picture and promote Person B. Moreover, Person A might get in trouble, and pressure to “compromise on quality.”

Within a short-term, it is understandable.

Within a long-term, this is a disaster scenario!

So should the “code quality” be part of a performance portfolio of the developer when it gets to promotion time? And how do we get there?

Re:Ask HN: As a CTO, what is your most frustrating problem w... by monocasa on Tuesday July 24, 2018 @10:42AM (#17601438)
I've also seen

Programmer A writes straightforward code that's easy to change and understand.

Programmer B writes convoluted "clever" code that completely falls apart when requirements change, or even just in production because their clever solution didn't account for all of the edge cases.

Now Programmer B has to save the day consistently, and therefore is seen as the person saving the company, when the problems were all of Programmer B's construction to begin with.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by hinkley on Tuesday July 24, 2018 @02:00PM (#17603476)
If you are a CTO and you haven’t had the “no more heroes” conversation with your employees, then it is my long reasoned opinion that you are being negligent. I can’t trust “leadership” like that.

And if you don’t take “I can’t trust you” as the highest insult a developer can give, then you are in the wrong line of work.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by linuxftw on Tuesday July 24, 2018 @11:30AM (#17601900)
I would expand upon this and say that Progammer B doesn't ship the code at all, it wouldn't pass code review muster.

Unless we're talking about a seriously silo'ed org, or Programmer B is actually "Team B"

Re:Ask HN: As a CTO, what is your most frustrating problem w... by monocasa on Tuesday July 24, 2018 @11:50AM (#17602132)
A lot of teams are a cult of personality around one developer. Particularly if there are a bunch of juniors on the rest of the team, Programmer B can usually get anything through code review with the 'ol "of course it's complicated, that's why _I_ am the one working on it. It's not for mortals to understand".
Re:Ask HN: As a CTO, what is your most frustrating problem w... by hinkley on Tuesday July 24, 2018 @02:02PM (#17603499)
Treat every question about your code as feedback. If multiple people ask the same question you have a problem that needs to be fixed. Documenting the gotcha should be your last resort. Implying incompetence isn’t even in the board.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by waterlink on Tuesday July 24, 2018 @11:38AM (#17601980)
Yeah, that is probably a few first months of a start-up (or even first year).
Re:Ask HN: As a CTO, what is your most frustrating problem w... by zenogais on Tuesday July 24, 2018 @11:18AM (#17601775)
^ This is pretty much standard at any startup in my experience.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by waterlink on Tuesday July 24, 2018 @11:39AM (#17601994)
This is not just bad. It is also unfair.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by phyller on Tuesday July 24, 2018 @10:43AM (#17601443)
You have multiple engineers working with each other on the same code base, reviewing each other's code before it can be merged into the main branch.

Then you start to find which engineers the other ones don't like to work with.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by hinkley on Tuesday July 24, 2018 @01:57PM (#17603447)
The real value of that sort of person is in the leadership they can provide and not the mountain of dramatic code that everyone mistakes for brilliance.

I would and do advise anyone who possesses that sort of clarity to push for more responsibilities. They should be involved in all of the major problem solving discussions.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by collyw on Tuesday July 24, 2018 @10:39AM (#17601406)
Yes, good code is a lot harder to spot than bad code.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by mmt on Tuesday July 24, 2018 @05:26PM (#17605092)
At the risk of sounding too glib or reductio ad absurdum:

The best code is impossible to spot, because it's not even there.

Put another way, a truism I've often heard from the most senior programmers (especially in the context of critiques of LOC as a measure of productivity), is that their best work is often writing less code, or outright deleting existing code. It stands to reason that this kind of work is much more difficult to spot if all one looks at is the codebase in its current state.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by jibal on Wednesday July 25, 2018 @02:22AM (#17607230)
See "The Most Beautiful Code I Never Wrote" by Jon Bentley.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by waterlink on Tuesday July 24, 2018 @10:25AM (#17601274)
It seems like:

“rewrite” is in sense of “I don’t even want to understand it, going to just delete it, and implement anew”,

VS

“refactor” is in sense of “I had to spend quite a while trying to understand this code, and I think it can be improved, so that the next developer doesn’t have to spend this time.”

Re:Ask HN: As a CTO, what is your most frustrating problem w... by MaxBarraclough on Tuesday July 24, 2018 @10:37AM (#17601384)
See also "Chesterton's fence"
Re:Ask HN: As a CTO, what is your most frustrating problem w... by sixstringtheory on Tuesday July 24, 2018 @10:59AM (#17601601)
That is a fantastic tidbit, TIL. This is pretty much what I had in mind to refute the assumption the earlier parent made about rewrites being desired so code doesn't have to be grokked. IME, the tech debt we complained about was in situations where we knew what we had to do to write a new feature, and why it wouldn't work because of the decisions made previously, and the monumental amount of work involved in putting just one more bandaid on that system, instead of just fixing the dang data model.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by ben509 on Tuesday July 24, 2018 @11:57AM (#17602214)
That makes me wonder: if I fix something, if I set up Chesterton's fence, how can I make it a bit more obvious why I'm putting that fence there for the benefit of future us?
Re:Ask HN: As a CTO, what is your most frustrating problem w... by gknoy on Tuesday July 24, 2018 @12:29PM (#17602573)
At the risk of sounding snarky, I feel like a block of code comments explaining the naiive approach that was rejected, as well as the particular edge cases that this is handling which the simpler generalized case doesn't handle, would help a lot for that.

I realize that as developers we often glaze over the comments (my editor even shows them as low contrast grey), but docstrings and code comments can be tremendously valuable when trying to understand why something needs to do things a particular way.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by MaxBarraclough on Tuesday July 24, 2018 @12:09PM (#17602352)
The usual code-comments/self-documenting code/git commit descriptions, no? If a long-form explanation is justified, wikis are cheap.

I see no excuse for leaving the reader to guess at what on Earth you were thinking. Implementing a wacky solution is sometimes a necessary evil. Incomprehensibility isn't.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by hinkley on Tuesday July 24, 2018 @02:06PM (#17603529)
I am downright militant about people not relocating code and breaking the commit history.

When I see WTF code, I want to know what story it was associated with so I know why the fences were erected. Sometimes they are right and I need a complex solution. Sometimes they were accomplishing something the hard way and there was an easier spot to achieve the goal.

Basically I am fixing two bugs. The old one again, and the new one.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by mabbo on Tuesday July 24, 2018 @08:27PM (#17606025)
I just love doing that part. I wish I could be paid to just refector shitty code bases all day.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by maxxxxx on Tuesday July 24, 2018 @10:24AM (#17601261)
There is a level of luck involved in producing well written code. Sometimes your assumptions turn out to be correct and sometimes a big requirements change comes and turns your code from simple to super complex.
Re:Ask HN: As a CTO, what is your most frustrating problem w... by MaxBarraclough on Tuesday July 24, 2018 @10:31AM (#17601335)
Sure, a giant-ball-of-mud codebase might be the result of changing requirements and assumptions, but it could be the result of laziness/unskilled development.

There's a skill to writing readable, ideally self-documenting code. If that skill is wanting, even the most stable requirements won't save you from the mud.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by mixmastamyk on Tuesday July 24, 2018 @10:40AM (#17601413)
> could be the result of laziness/unskilled development.

Or not being allowed/kept too busy to fix it.

Re:Ask HN: As a CTO, what is your most frustrating problem w... by maxxxxx on Tuesday July 24, 2018 @10:36AM (#17601378)
Correct. But don't forget that it can also go the other way. The best code writing skills can be defeated by ever changing requirements. Besides code writing there is a also a skill in being disciplined about requirements changes.