Live data from Hacker News

The code culture problem

fraustollc.com

161–162 of 162 posts

Re: The code culture problem

#161

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…

I've been programming professionally for over 10 years, and when I see some weird code, I still try to figure out who wrote it and ask him before I change it. Often he admits it's shit and needs to be changed, or he just doesn't know anymore, but sometimes there was actually a very good reason for doing it like that.

Those few times make it worth to never judge too early.

Blindly assuming you know better is arrogant and will inevitably lead to problems. Discussing the underlying reasons will almost always teach you something.

Re: The code culture problem

#162
post #156

Earlier quoted context omitted.

It's easier to refactor something that has already been created than to create that thing. This is why refactoring is such a good thing. It doesn't mean the original creation was "shit", it just means that it was massively improved by refactoring, which is sort of the point.

That's like saying, hey that rough draft of my essay is just fine to use. Not it's not, it's a rough draft, clean it up (refactor your code).

That's not a very good analogy, and doesn't really address the point I was making. Note that my comment was very favorable to refactoring.
Post reply on HN