Live data from Hacker News

The code culture problem

fraustollc.com

61–70 of 162 posts

Re: The code culture problem

#61

> the code is usually not particularly shit I'm sorry, but yes, it usually is. I've been in this business for over 25 years, and I'm one of the few people that actually enjoys the challenge of dealing with legacy code. But most of the code I've seen is shit. The answer to the question "could it have been done better" is usually "yes, if it had been done by someone who understood the basic principles of the paradigm t…

"Most code out there is shit code."

semantic point. if you're saying 'most code' is shit, aren't you saying average code is shit?

Kind of like saying a 6 min mile is shit because it's not a 4 min mile.

Re: The code culture problem

#62

> the code is usually not particularly shit I'm sorry, but yes, it usually is. I've been in this business for over 25 years, and I'm one of the few people that actually enjoys the challenge of dealing with legacy code. But most of the code I've seen is shit. The answer to the question "could it have been done better" is usually "yes, if it had been done by someone who understood the basic principles of the paradigm t…

My job is "first level support". I have to analyse problems reported by users and often to read source code to find bugs. I have seen a lot of shitty code and a lot of very clean code, but most of the problems come from shitty specifications. When the requirements reflect a poor understanding of the users need (or a poor sense of logic), whatever the qualities of the developer, the resulting code will always be a mai…

The developers should be able to push back on some of that - and at least document in the code that certain logical inconsistencies were raised but glossed over.

Simply understanding that something will be a maintenance nightmare should inform a developer enough so that they, at the very least, leave useful info/docs about what corners were cut and why. Until you've had to deal with mountains of various legacy projects completely undocumented, you won't even know this is something you should be doing.

Re: The code culture problem

#63

> the code is usually not particularly shit I'm sorry, but yes, it usually is. I've been in this business for over 25 years, and I'm one of the few people that actually enjoys the challenge of dealing with legacy code. But most of the code I've seen is shit. The answer to the question "could it have been done better" is usually "yes, if it had been done by someone who understood the basic principles of the paradigm t…

So what exactly is the point you are trying to make here other than that you are the smartest guy?

The article is not about the existence of shit code, the amout of shit code produced per year or how much shit code the average developer will see in his career.

It is about teamwork, and what kind of culture poisons the atmosphere in a company.

Not about shit code, which by the way everyone here has produced at some point or to be more realistic about it (since usually developers look at their old code and think it is bad) - is still producing on a daily basis.

Re: The code culture problem

#64
From my personal experience, individuals who say "this code is shit" are often far removed from the process of writing code in the first place.

I wonder where the whole "Worse is Better" paradigm fits into the universe with good code, acceptable code, and "shit code".

Re: The code culture problem

#65
post #47

In my time as a professional programmer I've come to notice a trend. It's true that there is a lot of bad code in the world and much of it is worthy of derision. That said, time after time I've noticed that when confronted with a smelly codebase junior and/or less-skilled programmers are quick to blame the code and the person who wrote it while more senior and/or highly-skilled programmers will start by placing the b…

Junior programmers aren't aware that reading code is hard, since they've never really been forced to read much code (AFAIK there's no point in a CS course where "scour this 500KLOC non-didactic codebase for the cause of this bug and fix it" is assigned.) Because they aren't aware that reading code is hard, they think that code that's hard to read is a code smell, whether the complexity comes from obfuscation, or just the inherent complexity of the problem domain.

They also don't know that they don't know this, because they've seen code that's comparatively easy to read -- why, they've written it themselves! Their implementation of only the minimal requirements of the domain is much clearer than someone else's complete solution with all its required business-warts. As such, obviously, throwing out the previous complete solution, and filling in the gap with their own minimal reimplementation, is an improvement. (They don't notice that after fixing the ensuing regression bugs, their version now bears a much stronger resemblance to the previous one....)

Eventually, you read enough code that you get used to that particular "smell," and you realize that it's not really pungent in the way the other smells are. The "complex problem-domain, completely expressed" smell becomes the grease on the equipment[1] -- the sign of a well-patched and long-running system.

---

[1] http://www.joelonsoftware.com/articles/Wrong.html

Re: The code culture problem

#66
post #35

> the code is usually not particularly shit I'm sorry, but yes, it usually is. I've been in this business for over 25 years, and I'm one of the few people that actually enjoys the challenge of dealing with legacy code. But most of the code I've seen is shit. The answer to the question "could it have been done better" is usually "yes, if it had been done by someone who understood the basic principles of the paradigm t…

I'm just going to ask the question... What do you think makes your code good? I bet the next guy that comes around in 15 years and reads your legacy code (Grats on having code actually runs for 15 years!) will think it's the worst piece of shit ever created and are sure to think you are one of the worst developers in the world.

> What do you think makes your code good?

Answering for myself: (1) it's short. Often significantly shorter than my colleagues'. (2) it has few bugs, if our bug tracker is to be believed (I reckon I'm not very confident about that one).

On the other hand, I tend to be slower, especially when I have to write against less than optimal APIs.

Re: The code culture problem

#67

Earlier quoted context omitted.

Most code out there is shit code. Denying it is not going to help either. So you do it "right" then, I assume. What do you think the next guy is going to say about your code? Do you really think they're going to praise the excellent code quality? Or will they declare to all around that it all needs to be rewritten because it doesn't conform to the newest flavor of the month? I absolutely and unequivocally agree with…

Maybe I haven't been entirely clear. I'm not talking about a mismatch between approach (over- or under- whatever) and goal. I'm not talking about quick hacks that were never refactored (because of course, there never is time). I'm not talking about code that has gone through many cycles of unpredicted change and has acquired many layers of cruft. I'm not talking about code made by inexperienced developers who still h…

I would suspect that such practices are more prevalent in the web development world. Enterprise software and embedded development (my focus area) suffers far less from the pure unadulterated "shit" code pattern.

Mostly I suspect that is because the software development practices such as code reviews and coding standards are actually enforced.

Re: The code culture problem

#68
...when I asked my coworker to explain...why is the code shit, I couldn't get a straight answer.

Maybe because there are only so many straight answers and we get tired of repeating them so often...

Class A: It's too difficult for the next programmer to understand this

  - poor (or horrible) variable naming
  - poor (or horrible) function naming
  - repeated repeated repeated repeated code
  - comments don't match code
  - comments needed but not there
  - comments needed by unintelligible
  - unbalanced structure
  - poor (or horrible) choices for iterations
  - poor (or horrible) choices for conditionals
  - poor (or horrible) choices for data design/storage
  - poorly maintained by Programmers #2 thru x, who didn't understand it
  - etc., etc., etc.
Class B: Poor machine performance, not by 10%, but by 10000%, because of extremely poor design and development choices.

Class C: It's broken. Insufficiently tested & broken in production.

Re: The code culture problem

#69

Earlier quoted context omitted.

Most code out there is shit code. Denying it is not going to help either. So you do it "right" then, I assume. What do you think the next guy is going to say about your code? Do you really think they're going to praise the excellent code quality? Or will they declare to all around that it all needs to be rewritten because it doesn't conform to the newest flavor of the month? I absolutely and unequivocally agree with…

Maybe I haven't been entirely clear. I'm not talking about a mismatch between approach (over- or under- whatever) and goal. I'm not talking about quick hacks that were never refactored (because of course, there never is time). I'm not talking about code that has gone through many cycles of unpredicted change and has acquired many layers of cruft. I'm not talking about code made by inexperienced developers who still h…

I know what this guy is talking about. It's the sort of code where the programmers spend 80 lines copying key-value pairs from one Perl hash to another Perl hash instead of doing it in 3-4 lines with a loop, because they don't know any better. coughibmcough

(Of course, this is among the least of their offenses.)

I try not to work at places like this.

Re: The code culture problem

#70

Earlier quoted context omitted.

Most code out there is shit code. Denying it is not going to help either. So you do it "right" then, I assume. What do you think the next guy is going to say about your code? Do you really think they're going to praise the excellent code quality? Or will they declare to all around that it all needs to be rewritten because it doesn't conform to the newest flavor of the month? I absolutely and unequivocally agree with…

Have you never seen a piece of code that sucked so much that you could shrink it by a factor of at least 2? You lucky swine… Much (possibly most) code I have had to deal with was that ugly.

Almost all code except the stuff written by the Masters of Succinctness can be shrunk by a factor of 2. Order of magnitude reduction is the only impressive metric.
Post reply on HN