Live data from Hacker News

A Million Lines of Bad Code

varianceexplained.org

31–40 of 123 posts

Re: A Million Lines of Bad Code

#31
If only my clients and recent bosses would consider refactoring a valid billing line item...

I can only imagine sending an invoice today to my three top clients with "5 Hours Refactoring Bad Code That is Working But Could Be Better Looking....$400".

There is just no way I would get paid.

Unfortunately, I have interests outside of working on code that mostly preclude me from sitting for hours happily breaking-and-then-refixing code that is currently working ok and that I cannot bill on.

Hell, just keeping up to date with the unreal pace of change that is occurring in software right now is almost a full-time job in itself, much less fixing old stuff that is going to go away soon anyway.

Re: A Million Lines of Bad Code

#32
post #6

I recently read the book "How to Win Friends & Influence People", bad title great book. My main take away from this is I've been talking to people really badly for the last 27 years. I wish I had read this book in middle school. But this blog reminded me of some of the concepts from the book, its far more productive to give positive encouragement than to give negative feedback, and just adding a complement isn't enou…

"Hey pretty cool program! Its a great start. I bet we can make it run faster if we changed the way files are imported to something like this... nice work" I usually hear this referred to as a "criticism sandwich": Criticism surrounded on either side with compliments.

We Brits are the masters of allusive and indirect speech, and I would automatically automatically strip of both pieces of bread translate that to "you're reading in files wrong".

Re: A Million Lines of Bad Code

#33
post #6

I recently read the book "How to Win Friends & Influence People", bad title great book. My main take away from this is I've been talking to people really badly for the last 27 years. I wish I had read this book in middle school. But this blog reminded me of some of the concepts from the book, its far more productive to give positive encouragement than to give negative feedback, and just adding a complement isn't enou…

I too recently read that book and loved it.

But (yes, I buted), I think a lot of people go overboard. I've seen people get so bent up around coming off as nice and encouraging, that it becomes difficult to even understand what they want from you. Or worse, it comes off passive aggressive.

I'm not sure there's a better fix for that than practice.

Re: A Million Lines of Bad Code

#34
What if you are an experienced engineer talking to another experienced engineer ?

Seems to me if someone writes bad code when they SHOULD be writing good code, code-shaming might be in order.

I'm all for being nice and understanding. Everyone programs at a different level and I may not write code that is as good as I think, but some code is just obviously bad...and constructive criticism (if willing to be accepted) might help

Re: A Million Lines of Bad Code

#35
post #6

I recently read the book "How to Win Friends & Influence People", bad title great book. My main take away from this is I've been talking to people really badly for the last 27 years. I wish I had read this book in middle school. But this blog reminded me of some of the concepts from the book, its far more productive to give positive encouragement than to give negative feedback, and just adding a complement isn't enou…

In short, "yes and" instead of "no" or "but".

Re: A Million Lines of Bad Code

#36
post #6

I recently read the book "How to Win Friends & Influence People", bad title great book. My main take away from this is I've been talking to people really badly for the last 27 years. I wish I had read this book in middle school. But this blog reminded me of some of the concepts from the book, its far more productive to give positive encouragement than to give negative feedback, and just adding a complement isn't enou…

This is helpful for sure, but it's also very useful to work on having a thick enough skin to take insulting feedback in a positive fashion. After all, the only way someone can offend you is if you let them.

Re: A Million Lines of Bad Code

#37
post #6

I recently read the book "How to Win Friends & Influence People", bad title great book. My main take away from this is I've been talking to people really badly for the last 27 years. I wish I had read this book in middle school. But this blog reminded me of some of the concepts from the book, its far more productive to give positive encouragement than to give negative feedback, and just adding a complement isn't enou…

I like teaching. I don't think I'm amazing at it, but I like sharing knowledge and experience with my friends and co-workers and see them improve, or just sometimes for the abstract sense of helping. Of course, sometimes I fall flat and come across as arrogant or condescending, but I hope that's rare. I read "How to make friends" a long time ago, and I apply those rules diligently to my interactions with people. Rece…

Very well said. It's wrong to be a dick, but it's also the natural response to a lot of stressful situations. Think of trying to give tech support to relatives, for example. It's too easy to get annoyed with other people, and this is especially true when you're under pressure and they're MEANT TO BE HELPING, DAMNIT!

FWIW, I suspect that you're much more experienced in this stuff than me, so it's a bit arrogant for me to offer a suggestion. But still, I'm going to offer one. Is the guy quite self-motivated? If so, one thing that might help you is to spend some time curating good learning resources for him, and then linking him to them. It's essentially the ethical version of RTFM. You help him figure out what the useful "M" actually is, and he'll get himself up to scratch from there.

Just a suggestion, anyway. :)

Re: A Million Lines of Bad Code

#38
post #6

I recently read the book "How to Win Friends & Influence People", bad title great book. My main take away from this is I've been talking to people really badly for the last 27 years. I wish I had read this book in middle school. But this blog reminded me of some of the concepts from the book, its far more productive to give positive encouragement than to give negative feedback, and just adding a complement isn't enou…

This is helpful for sure, but it's also very useful to work on having a thick enough skin to take insulting feedback in a positive fashion. After all, the only way someone can offend you is if you let them.

I kind of get a kick out of your response.

You've offered a compliment, then suggestion, then a platitude, while telling someone that being rude is acceptable if it's technically correct and seemingly disagreeing with the previous poster.

It's sound advice, to have thick skin, but you've just shown how easy it is to give corrective feedback in a tactful way. Still good advice to not let people offend you though.

Re: A Million Lines of Bad Code

#39
Yeah, you shouldn't shame people because their code is bad. But the other side of that is when someone says your code is bad you don't take it personally. There is more than one way to not be a nice person.

Just think, if everything is pretty good and isn't that bad and doesn't need that much improvement, why should anything ever get any better, ever?

Re: A Million Lines of Bad Code

#40
There are some useful ideas here, and public shaming per se probably isn't the answer. But publicly talking about bad code, and the properties of code that makes it bad, is an important way to socialize what makes good code, plus the meta fact that code quality is important.

To the extent that the aphorism about writing bad code is true, I think it's just another way of saying that people's code improves with their coding experience. I really don't think you need to write bad code _in order_ to learn to write good code. It's hard to know for sure, but I think the most positive influence on my code quality was _reading_ lots of very good code, not having written bad code. (It's the same with my writing, too.)

[Edited for clarity, ironically.]

Post reply on HN