Live data from Hacker News

The code culture problem

fraustollc.com

51–60 of 162 posts

Re: The code culture problem

#51

> 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. 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 have a lot to learn.

I've seen all that. I've written all that. I've left code behind I would be embarrassed to show in public. I'm shocked some of it is still in use, and I'm sure people who have to maintain it will curse my name. That is part of the job.

What I'm talking about is pure, unadulterated shit code. No structure, no logic, no consistency and barely functioning only under very limited conditions. Utterly incomprehensible unless you immerse yourself deep into the mind of the author like an FBI profiler and a serial killer.

No, there is no one "right" way of writing code, but boy there are an awful lot of "wrong" ways.

Re: The code culture problem

#52

How about a culture of "stop fucking up". (I admit I stole this from Ted Dziuba, but it has stuck with me.) People who are willing to call things "shit" instead of being nicey-nice at least give a shit. But it is important to be intellectually honest, and not be egotistical about one's own code, which could be shit just like anyone else's.

>> People who are willing to call things "shit" instead of being nicey-nice at least give a shit.

Or they're just adhering to the culture of calling all imperfect code shit because that's what they see others doing.

>> But it is important to be intellectually honest, and not be egotistical about one's own code, which could be shit just like anyone else's.

Well said.

Re: The code culture problem

#54
Programmers are critical thinkers, that's why we are good at what we do. That's why no code anyone writes including our own 4 or 5 years down the line meets even our own standards. You have to be a critical thinker to get coding, to want to do it. The only down side is so much critical thinking wears us down over time. If anything, we should force ourselves to take more vacations.

Re: The code culture problem

#55

How about a culture of "stop fucking up". (I admit I stole this from Ted Dziuba, but it has stuck with me.) People who are willing to call things "shit" instead of being nicey-nice at least give a shit. But it is important to be intellectually honest, and not be egotistical about one's own code, which could be shit just like anyone else's.

"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.

Re: The code culture problem

#56

> 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. 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.

Re: The code culture problem

#57

> 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…

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'…

Exactly, that "Why did he write it this weird way?" helps you understand the programmer who wrote it (his level of expertise) and gives the opportunity to analyse the tradeoffs he made. This helps discern between real shit and unpleasant code that had to be written/structured that way.

Re: The code culture problem

#58

> 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…

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 learned most of what you need to know by investigating the 'weird way', and you'll see the patterns, and you'll be at this for 15 years, and you'll be seeing the majority of stuff coming out being crap code by younger developers. It's the way of the world.

Re: The code culture problem

#59

I still love it when you find some "shit" code, just to realize you wrote it yourself ages ago.

This is a sign of progress, actually. If you cannot find faults in the code you wrote ages ago and think it is awesome, time to find and fix some deep problems.

Re: The code culture problem

#60
asking people to be very specific is the first thing that should be done in any technical environment. "shit" is going down all over the place, please emphasize.

asking people to be nicer in a technical environment would require similar levels of education and understanding of the tools involved. you seem to be a person that makes other people get stomack aches from bad code, so maybe you should reconsider your abilities.

if you write overall good code it's inherently easier to find a bug in it than if you just stitch shit together. if you solve your problems with stackoverflow and/or huge books like "how to... in 21 days" you should maybe reconsider your career choices.

in code the attention to detail is always more important than the overall intention, so why not leave it at that?

Post reply on HN