Live data from Hacker News

The code culture problem

fraustollc.com

131–140 of 162 posts

Re: The code culture problem

#131

This piece reminds me of Linus Torvalds. He's the kind of guy that lives these truths. Always respectful and constructive, never saying code is shit, etc etc. We need more developers like him.

Torvalds is BDFL. If you wrote it, it's widely acknowledged to be good, and people want to add code to it, you're entitled to tell people their contributions are unwanted. If no one other than the 6 people you're working with have ever read the code and nobody wants to add code to it, you need to really spend some time reading the code before you make a judgement call. At that point, it's better to make the code not…

Great reply, I agree.

Re: The code culture problem

#132
post #40

Earlier quoted context omitted.

>I've been in this business for over 25 years [...] The difference between shit code written by shit coders and less than optimal code written by good coders dealing with constraints is quite clear. [...] Most code out there is shit code. Denying it is not going to help either. I'm sorry, I respect your experience but this post is completely uninformative. It's much more specific on how awesome you are than on how to…

I think it's a bad case of "dislike due to knowledge". It's stark in the arts, but it applies to almost every human endeavor. As an example in the arts, I dance, and I'm good at it according to almost everyone who sees me dance. But I see myself as a terrible dancer. If I make a video of me dancing, others see every part that's well executed. I'm accustomed to them, and I tend to ignore those parts in favor of every…

[deleted]

Re: The code culture problem

#133

Earlier quoted context omitted.

You're probably right, what do I know I've only been programming professionally for 3 years. However, I find that it's more helpful to have a positive attitude when reading code I didn't write. "Why did he write it this weird way?" taught me so much more than "this is shit, let me rewrite it the way I'm familiar with". I'm not denying that I found seriously bad code running in production. And I'm not denying that it'…

"Why did he write it this weird way?" taught me so much more than "this is shit, let me rewrite it the way I'm familiar with". --------------------- You're 3 years in. In another 3-5 years (maybe more), this 'positive attitude' will (and should) go away. You'll have a much better understanding of the 'weird' ways, and will be able to tell 'quick hacks' from 'crap code' as the OP was referring to. You will have learne…

Needed to add on to this - without knowing what good code is, you can't learn much from bad code, and likely won't be able to identify it.

Re: The code culture problem

#134
Ugh. Another "let's-act-like-everything-is-happiness-and-rainbows" post.

In my experience, most of the time someone says "this is shit", it actually is, and it's indicative of serious failures in the hiring/training/code-review/management process.

The only ways that companies improve at those processes are by pointing out the shit, calling it by its name, and figuring out the best ways to keep it from happening again.

Having a "this is shit" culture can be GOOD -- it can hold people accountable and promote a culture of excellence.

> In the end it is a culture that values negativity rather than focus on solutions.

That doesn't follow. Call it shit, and then fix it.

> Start by understanding the code, and then find ways to improve upon it.

That means that, instead of fixing the underlying problem and making people accountable for their work, you take on the burden of cleaning after other people's shit? I don't think so.

The author is correct when they say:

> Don't blurt out negative assessments of others code for no reason, and with no understanding. ...Start by understanding the code

But that goes without saying. Don't be too quick to judge when you don't have the facts. But once you're sure the code is shit, it's ultimately counterproductive to hide that. Most employees will only start writing better code once they're expected to, and strongly held accountable -- like most people's performance in any job.

PS: To be clear, I'm not talking about disagreements over coding styles, etc. I'm talking about code with obtuse function names and no comments. I'm talking about CSS that is hack upon hack upon hack filled with negative margins and !important's. I'm talking about JavaScript that pollutes the global namespace by programmers who refuse to use "var". Or CSS declarations like "div div span div span tr td span {color:red;}". And there's a tremendous amount of this stuff out there. Stuff that there's never an excuse for.

Re: The code culture problem

#135

Ugh. Another "let's-act-like-everything-is-happiness-and-rainbows" post. In my experience, most of the time someone says "this is shit", it actually is, and it's indicative of serious failures in the hiring/training/code-review/management process. The only ways that companies improve at those processes are by pointing out the shit, calling it by its name, and figuring out the best ways to keep it from happening again…

Let me clarify a bit here. I am not denying there is a LOT of shit code out there. Nor do I have a problem with calling it out, whether the code is someone else's or my own. Fair's fair.

This article is arguing against a type of environment that praises negativity rather than contributions. One where the first reaction is to name something shit by default and not even offer any solutions to fix it or at the very least understand why it is shit so you don't end up making similar mistakes in the future.

Re: The code culture problem

#136

Ugh. Another "let's-act-like-everything-is-happiness-and-rainbows" post. In my experience, most of the time someone says "this is shit", it actually is, and it's indicative of serious failures in the hiring/training/code-review/management process. The only ways that companies improve at those processes are by pointing out the shit, calling it by its name, and figuring out the best ways to keep it from happening again…

No way "while bool.toString().getLength() > 4" can be a shit code! It works, what else do you need? Learn to understand first.

Re: The code culture problem

#137

Earlier quoted context omitted.

"Why did he write it this weird way?" taught me so much more than "this is shit, let me rewrite it the way I'm familiar with". --------------------- You're 3 years in. In another 3-5 years (maybe more), this 'positive attitude' will (and should) go away. You'll have a much better understanding of the 'weird' ways, and will be able to tell 'quick hacks' from 'crap code' as the OP was referring to. You will have learne…

I'd much prefer to have GP on my team than you, frankly. I think companies are much more productive when they have people willing to learn from and teach one another rather than bringing negativity.

"rather than bringing negativity"

That seems like a false dichotomy. Someone who's a pollyanna even about horrendous abominations is a problem in one way, someone who's indiscriminately contemptuous of reasonably useful code is a problem in another way. Software projects (or teams, or companies) can bog down or die in more than one way. Driving off people who are doing reasonably good work is one way, tolerating unreasonably low standards is another.

And also, correct criticism is not particularly "bringing" negativity. If there is something unacceptably technically bad, and you want to point to the person or people who brought the negativity, you'd do better to point to the original creators and/or the chain of people who have signed off on it since then, rather than pointing to the person who criticizes the problem. The irreverent child did not bring the negativity to the Emperor's famous tailoring fiasco.

Someone who reasonably reliably distinguishes between good and bad is useful. Making the distinction correctly is generally much more important than the style of expression. It's easy to hire pollyannas (or, indeed, to err in the opposite direction by hiring hard-driving abrasive jerks) who don't have the tech skills to make the distinction correctly and just fall back to emoting in their preferred style. It works better to hire the smaller fraction of people who can do a good job, and who can recognize a good job. When you do that, it doesn't solve all style-related abrasiveness problems, but it does help mitigate them. By the time you've worked with someone for a while you learn to translate A's "this is unacceptable" as synonymous with B's "this is flaming rancid goat barf". (And axiomatic though it seems to be to you, in my experience saying "flaming rancid goat barf" is not useful evidence of unwillingness to learn and teach.) Both A and B are useful as long as they're reasonably reliably correct. Much bigger problems are C who says "this is a good effort" about everything, and D who flips between praise and condemnation based on issues other than technical quality (randomness, politics, mood swings, whatever).

Re: The code culture problem

#138

This piece reminds me of Linus Torvalds. He's the kind of guy that lives these truths. Always respectful and constructive, never saying code is shit, etc etc. We need more developers like him.

Are you kidding? Read this, it's a commit by Linus Torvalds:

https://lkml.org/lkml/2013/7/13/132

We need more developers like Torvalds - not because he's nice, but because he's terrifyingly experienced and completely honest in his feedback. I couldn't think of a better mentor.

Re: The code culture problem

#139
post #40

Earlier quoted context omitted.

>I've been in this business for over 25 years [...] The difference between shit code written by shit coders and less than optimal code written by good coders dealing with constraints is quite clear. [...] Most code out there is shit code. Denying it is not going to help either. I'm sorry, I respect your experience but this post is completely uninformative. It's much more specific on how awesome you are than on how to…

As a coder the best compliment I've ever gotten was from a consultant. It was basically something like, "Hey, you're the [my initials] that wrote a big chunk of [system]? I can really tell the parts you wrote from the rest, it's so much easier to follow and understand." I had written the original code for that project solo and then it was passed on to another team for maintenance. That, to me, is the best thing a fel…

Persons { String[] first_name; String[] last_name; String[] address; }

Are you sure they didn't do it for performance? That is a well-known pattern for getting better data locality ("structure of arrays" vs. "array of structures").

Re: The code culture problem

#140
post #55

Earlier quoted context omitted.

"Stop fucking up" quickly ends up with "stop taking risks" and "design by committee", which may be a good idea if you write avionics or banking software, but perhaps not in other markets.

> "stop taking risks" and "design by committee", Those are both fuck ups. So, I respectfully disagree that "stop fucking up" leads to those ever and suggest you don't understand what fucking up entails.

Those are more subtle fuck ups that the company might not notice for a long time, usually when you're eclipsed by the competition and upper management has been replaced.

A better slogan might be "always make new mistakes".

Post reply on HN