Live data from Hacker News

The code culture problem

fraustollc.com

91–100 of 162 posts

Re: The code culture problem

#91

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.

I don't know whether code verbosity is a measure of shit (indeed, that is one of those arguable points where one guy likes the single line ultra-functional version, and the other likes the same split into 20 lines).

I'm not disagreeing on the notion that there is some shit code in the world. Of course there is. But if anyone thinks that all or most code is shit, it often says more about the speaker. And I don't mean this as a personal attack on anyone, as it is possible that someone is in particularly dire code straights, but by and large the people who I've known who think all code is shit tend to be of questionable talent.

I have a friend who is constantly regaling the horrors they meet on the roadways because, in their opinion, everyone is a shit driver. Only it's my friend who is the shit driver, and their reactionary, panicked driving technique puts them in such constant peril that they can only imagine that everyone else is to blame.

Re: The code culture problem

#92
post #10

Behold, the aftermath of the brogrammer. What was seen here is a particularly insidious, caustic and ultimately, demoralizing and self-defeating attitude from your colleague (and something I've seen routinely on HN). I don't particularly think he was in any way truly convinced that it was deserving of it, however it must be thrashed in accordance with a self selected pecking order in order to assert his dominance. Th…

"Brogrammer" is ill-defined. It's silly to blame something on an ill-defined concept.

http://gizmodo.com/5910824/theres-no-such-thing-as-a-brogram...

Re: The code culture problem

#93
my first instinct is to laugh this off because its talking about web developers... obviously all of the code is shit because its not hand optimised assembler!

not sure why i hold onto this 20 years out of date mentality..

Re: The code culture problem

#94
post #40

> 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'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 fellow coder can say, that my code was easy for them to maintain.

Conversely, I've seen code written in Java where instead of using objects the original coders used hashmaps with key/value pairs for fields. Sometimes they used some public static strings or an enumeration for the keys but often times they're just randomly hard coded throughout the program with string literals for field keys.

In another system I've worked on the coders did not understand objects/collections at all. So rather than having an array of type Person you had the Persons object that looked like this:

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

While it's true that good vs bad code is somewhat subjective... code like the examples I provided above is pretty horrible by the standards of all but the worst coders.

Re: The code culture problem

#95
post #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.

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

Re: The code culture problem

#96
post #7

A factor I think the article doesn't point out clearly enough is how the main attraction of dissing code is that it serves as an ego-defense mechanism. Understanding code is, almost without exception, challenging. It's much easier on our self image if we believe the code is to blame, rather than us. An unfortunate side effect is that this perceived badness of the code is then often used as an excuse to not really try…

Well said. My most important development as a programmer has been my skill in reading other people's code. I've noticed that I think a lot less code is 'bad' nowadays. A lot of the time, it's not how I'd write it if it were me, but that's not the same as it being shit.

Re: The code culture problem

#97
post #81
post #72

Earlier quoted context omitted.

No, a 6 min mile is not average. And yes the average of most things is shit. Shit isn't bad (unless it is), it is the output of useful work usually. It just needs to be covered up and stayed away from.

This reminds me of how pretty much everyone believes they're a better than average driver. Everyone also thinks other drivers are terrible. Both claims cannot be true. I'd say its appropriate to call 'most/typical code' average code, not shit.

Exactly the analogy I went with.

"Everyone is a shit driver" claims almost universally come from terrible drivers: When you have no situational awareness and aren't actively predicting the behaviors of drivers around you, and you don't have confident control of the tools at your disposal, every move that other drivers make seems dangerous and scary, needing panicked reactionary responses. Every trip is a perilous journey with tales of imminent death.

I honestly feel the same about people who walk around declaring all code shit. People who aren't competent with their development tools, can't naturally trace code and truly understand functionality, and can't adapt to different styles and era of code tend to be the ones, in my experience, that declare all code shit.

Re: The code culture problem

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

Why would you bet that?

We have a broad understanding of how to structure and write software. These ideas have been collected together in books. I refer to books like Code Complete, Debugging the Development Process, Clean Code, Refactoring, Programming Pearls, Beautiful Code, and so on. Then there are the language specific books. I don't believe you can craft well written C++ without reading Scott Meyers' books (or having absorbed the same knowledge from others), for example. Even the much maligned Design Patterns, which has been turned into the truly dreadful design by pattern, helps us to think about how to structure code.

I can't type it all in a post. But we are talking about modularity and extensibility. Decoupled code, so you can make changes here that don't break something over there, and so you can easily move code from one project to another. Well commented code - where 'well' means the author takes the use of the code into account - some deeply internal function named ComputeAverageSalary probably doesn't need much in the way of extra comments, anda top level api call to a framework being used by thousands needs a lot of documentation. Well structured code. The if statements make sense. They are not deeply nested. logic is not duplicated, or contradicted when it is nested, because that always leaves you scratching your head as to the purpose of the author(s), and clueless as to how to add code.

So, back to the question, why would you bet that? I've opened plenty of 15 year old code that is good to beautiful. This is not an arbitrary judgement of "oh, OO good/bad", nor an reactionary "it wasn't written by me, so it must be bad".

I do consider myself a pretty clean programmer, but I learned it by observing the code of others, reading a lot of books, and relentlessly applying a critical eye on everything I write and others write. All borne not on some arbitrary judgement, but from recognition of how quickly/slowly I can grok a piece of code, how easy it is to find and fix bugs, how easy to add features, and so on. In some code bases that is all fairly straightforward, and in others it is impossible - any fix or change has so many side effects that you need to add 50 if statements strewn about 50 files, in code already filled with if statements, and your if statement break about 15 undocumented assumptions about the behavior of the tightly coupled code.... that, my friends, is shit.

Re: The code culture problem

#99

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

For me, the tell-tale sign is a demonstrated lack of understanding of type theory. Like calling toString on string objects. Or even worse, calling parseInt on a string that was created by calling toString on an integer!

Also, comments-used-as-source-control. If I see one more gigantic block of code commented out with a set of initials and a date "this was removed by/on". Use the source control to do that, dammit.

Re: The code culture problem

#100
This also seems like something you could get fired for. You are not just disrespecting your teammate's judgement but also your boss's judgement in hiring your teammate. Therefore you are not a team player and maybe shouldn't be on the team.
Post reply on HN