Reddit, steady, fail (or: Copying code from the Internet)

The risks of googling code answers. Image of a runner in starting position, ground looks like a cell phone.

Prevaricate: To deliberately misstate or create an incorrect impression, to speak falsely.

Do you ask questions and post answers on forums like Reddit or Quora? Do you copy code from those sites? This might be funny if it wasn’t true.

How to use Reddit for programming

The following post has been doing the rounds on LinkedIn:

“Every time I have a programming question and I rly need help, I post it on Reddit and then log into another account and reply to it with an obscenely incorrect answer. Ppl don’t care about helping others but they LOVE correcting others. Works 100% of the time”

(Note: I’ve quoted it verbatim. I don’t abbreviate “really” and “people”. And I don’t see why you need to if you can accurately spell “obscenely”. But that’s just me.)

Is it true?

I don’t know if the writer was making a joke, or dead serious. The responses ranged from laughter to agreement, to social commentary on human behaviour.

I suspect the post is, at least, partly true. It rings true about common human behaviour. A developer may see a question on Reddit that he/she/they is quite capable of answering. But he doesn’t, because he has work to do and deadlines to meet. But then some idiot posts a stupid answer. Maybe work can wait a few minutes, because such ignorance cannot go unchallenged.

Do you trust Reddit?

But there is a more significant problem here. What about inexperienced developers who don’t know the fake answer is wrong? How will they choose when there are conflicting answers?

And what about all the well-intentioned, but wrong, answers that don’t get corrected? Maybe the people with the right answers didn’t notice, or that deadline was too urgent. Some hapless developer will think the answer applies to his problem and try to use it. Enter a whole new eco-system of buggy code.

I’m not exaggerating. This happened in a particular eco-system of code in a large organisation. I know this, because years ago one of the developers shared the story with me. Developer Zero had created code for what would later evolve into a much bigger system. He didn’t take particular care with some identifiers. Perhaps it was still experimental. But generations of developers after him copied and pasted it. Over time it became their shoddy, but standard, naming convention.

The problem with copying code

We all google for solutions.

The first problem is the source that you choose. Go to a source that strives to be accurate, like the official documentation. Don’t rely on Google’s own attempts to answer the question, or some-one’s comments on Quora.

The second problem is the assumption that you can copy and paste some code you found and it will work. It probably won’t. You have to understand the code so that you can work out the right answer for your problem.

The solution is not on Reddit

This is why developers need training. It’s not just about individual topics. It’s about understanding the bigger picture. The philosophy, if you like, of how a language or framework works. A quick answer to a narrowly-defined problem does not equip you for the next problem.

You learn from interacting with the instructor and other delegates. You learn from other people’s questions and comments. You learn from asking questions and getting the answers explained in different ways.

For all its convenience, this is the one area where online training falls short. I’ve been doing an online course that also has a live (Zoom) component. The live component has done more to embed the concepts for me than working through the online material twice.

I’d love to hear your comments. Do you have stories about terrible code you found online?

Leave a Comment

Your email address will not be published. Required fields are marked *

Thank You

We're Excited!

Thank you for completing the form. We're excited that you have chosen to contact us about training. We will process the information as soon as we can, and we will do our best to contact you within 1 working day. (Please note that our offices are closed over weekends and public holidays.)

Don't Worry

Our privacy policy ensures your data is safe: Incus Data does not sell or otherwise distribute email addresses. We will not divulge your personal information to anyone unless specifically authorised by you.

If you need any further information, please contact us on tel: (27) 12-666-2020 or email info@incusdata.com

How can we help you?

Let us contact you about your training requirements. Just fill in a few details, and we’ll get right back to you.