Theme:

How to Copy & Paste: Effectively working with strangers (and robots) on the internet

Tagged with:
AI
Community
Developer
Since the dawn of CodeProject and Stack Overflow, we've been copying and pasting other developers' code and now with the advent of ChatGPT, Copilot and other AI solutions, it's easier than ever to use code somebody (or something) else wrote... without necessarily understanding the code completely.

Hello there, professional googlers!

We've all heard that software developers are just "professional googlers" and the more senior you are is mostly a product of how good you are at Googling things... and it's a great joke... but have you ever tried being a developer without internet access? It doesn't feel like much of a joke then, does it?

But I don't see that as a negative, as such. When we're isolated we may feel weak and hopeless but as a team, as a community, we're quick and efficient problem solvers.

And that's where the idea for this article came from - how can we work together more effectively as a worldwide developer community without getting stung along the way?

How can I ask for help?

Before we start with how and what to copy and paste, let's first start with some places we might find answers.

Obviously, please google* your query before you start asking people!

* I'm using the term "google" as a search-engine-agnostic term. Personally, I google it on Bing these days.

Sources that you might find useful include the official documentation; YouTube demos, tutorials, talk recordings (there's even a talk I did covering this very topic on YouTube if you're not a fan of reading!); people's blog posts (hello 24 Days in Umbraco!); or even looking at the source code.

Particularly if you're looking for help around open source projects like Umbraco, existing answers to other people's questions are very prevelant. So any destination we're going to talk about with regards to getting help, there might already be solutions there for you without you even needing to ask the question.

Phoebe and Joey meme from where she's trying to teach him french. The panels read Phoebe: "Read", Joey: "Read", P: "the", J: "the", P: "documentation", J: "documentation", P: "Read then documentation", J: "Copy StackOverflow answer!"

Image source: @VishalMalvi_ on X (probably, memes are really hard to attribute!)

Where to ask for help

Now we've established we can't find the answer already on the internet, so we need to ask for help but where do go to do that?

StackOverflow is good for some more generic development questions.

Some repositories on GitHub have discussions or some developers might like you to raise issues if you're confused about a situation.

Are there any specialised communities that you're part of? (I'm looking at you, Umbraco!) Specialized communities are smaller communities who are experts in the thing you're trying to do. There are forums, Discords, Slacks for these groups of developers.

Umbraco has a thriving community with plenty of places to ask questions, and we should take advantage of that!

Social media is a another fantastic place to find people to help you - Mastodon, X, Bluesky, Reddit, whatever your social media of choice is and wherever a developer community exists.

How to ask for help

Now we have these places to ask for help, but how exactly do we do it? It feels like an odd question but perhaps more specifically, how can I ask a question in a way that's going to get an answer that's most appropriate and most helpful to me? Because although the community is generally very helpful, it's to our own benefit to ask the right questions in the first place.

I've developed a 6 item checklist for a good question (and we know this is good advice, by the way, because it's inspired by StackOverflow's "How to Ask" and if anyone is fussy about how you ask a question it's StackOverflow!)

  1. Do your research first

    Although we've already searched for answers to the question it's also important that we do some background research so that we can explain ourselves correctly and be very specific about our problem. There's also very little point asking a question if we don't know what we're asking - if we don't understand what we're asking then we need to ask a different question.

  2. Comprehend the problem

    I'm using the word "comprehending" here to mean "understand". But I'm using the word "comprehend" because it emphasizes the fact we don't need to know everything - we don't need to "understand" everything, just "comprehend" what we want to understand.

    Try rubber duck debugging as a helpful tool to help comprehend your problem.

  3. Be polite and patient

    ...because nobody has to help you. Any prospective answerer is just on the internet looking to reach out and give you a bit of a hand. They don't have to do it. So being polite and patient goes a long way to getting the best answer to your questions.

  4. Be on topic and be suitable

    This includes any tags and categories you apply to your topic. So if you're posting on a forum make sure you're posting it in the right category and use the right tags. If you're using social media, it's really, really important to ask- if you're going to be asking the right people the right questions you need to make sure you're asking these questions in the right places in places people are expecting questions on the subject you're asking questions about.

  5. Summarize your problem

  6. Include a reproducible example

    I’ve grouped these two together here. It's really important to get across what you're trying to say in a concise manner but with an example. It also can really help to simplify your example too, removing any code and context that's irrelevant to your question - you don't need to give everybody all the information about the project you're working on but if you can find an example that is a little bit simplified, it can make everyone's life a lot easier. (Actually, simplifying your code can help you narrow down the problem yourself!)

Rubber ducks sat at desks with computers in an office setting. AI Generated.

Rubber duck debugging can be a useful tool to help comprehend a problem. Created with DALL-E.

What about AI?

So what about AI? I've been talking a lot about community and collaboration so why am I bringing up artificial intelligence? (It's not just so I can apply the trendy "AI" tag to the article, honest!) LLMs (Large Language Models) have been scouring the internet looking at our problems and our code samples and, as I see it, they’re tools effectively built by the community and it takes a lot of the same skills to effectively use an AI-generated answer as it does to pick the right StackOverflow answer.

LLMs are the AI tools we’ve seen popping up all over the place in the past few years, be that OpenAI ChatGPT, Microsoft CoPilot, Github Copilot or Google Gemini - they’re all LLMs and largely work in the same sort of way and we have to provide the model with the same context (and treat their responses with the same level of scrutiny as) we would if we were asking a stranger on the Internet.

What can I ask AI to do?

AI is really good as a starting point - and this is quite key for most AI generated responses - for various programming tasks.

Take writing regular expressions for example. Say we ask it to "give me a regular expression for UK phone numbers", it will give you a starting point for that. But it will also give you a starting point for sort of more generic coding questions as well.

AI is also good as an autocomplete. One of the big use cases I have for GitHub Copilot is as I'm typing some very repetitive code Copilot will quite often suggest doing the same thing I've been doing to the code above to the code below. It's very good at picking up repeating patterns or spitting out very common structures.

You can also use AI, though, to explain code samples and error messages or to convert from one format to another. Perhaps "convert the following XML file into JSON" isn’t the best example, there are numerous XML to JSON converters online, but if you're trying to convert between two very niche formats or between programming languages where there wouldn't necessarily make sense to be a direct converter, AI is pretty good at that sort of thing.

Another option is to use LLMs to be your rubber duck.

A rubber duck sat at a laptop "rubber ducking" with a rubber human. AI Generated.

As we saw earlier, not only is AI good at helping with code, AI tooling is also pretty good at generating images of rubber ducks in an office setting. But, it turns out, it's also pretty good at generating images of rubber ducks "rubber ducking" with a desktop rubber human. Created with DALL-E.

When might I want to ask elsewhere?

AI isn’t always useful, though.

LLMs can have a poor understanding of performance.

It's pretty bad at understanding versions too, particularly in the .NET world (Microsoft's not always the best at naming things!) When .NET Framework was completely rewritten as .NET Core and then renamed .NET, AI is not particularly good at understanding the difference between those two (three?) versions. In the front-end world too distinguishing between Angular and AngularJS isn’t always clear. AI is not very good at picking out on these specific weird naming conventions and giving you answers that make sense for the language you're asking them in.

It’ll often invert boolean logic (which is a problem for me because my human brain also likes to invert boolean logic!) so asking AI for a string of ands, ors and boolean operations is not always the best option because it will often get those completely the wrong way around (or should that be “way wrong around”?).

You can struggle to persuade LLMs to make modifications to previous code samples. I’ve often asked for tools to "write me a regular expression for international phone numbers", which it does, but often omitting one thing or another. Following that up with a query like “please also allow the hyphen character” (as our friends across the Pond are fond of them) has previously resulted in the model returning a US-specific expression, ignoring the “international” requirement. It’s always worth double checking both the initial response as well as any later modifications.

And, boy, does it make things up! In my experience, AI will rarely tell you that you can't do something. It will generally make up a way that you can even if those ways are not possible, using API methods that don't exist, mythical namespaces and libraries that it’s invented - it will never say no.

It will never ask questions or give options like a human would. If a human doesn't fully understand the question it will say "oh sorry, I'm not sure I quite follow - can you provide me this context?" AI doesn't do that, it will give you an answer to what it "thinks" the question is which can lead you down the wrong rabbit holes!

Assessing the suitability of an answer

All right, so we've asked questions to humans, we've asked questions to AI now we need to know how to copy and paste.

We've established AI can be wrong because AI learns from people and people are wrong too so whoever you've asked it's very important that we assess the suitability of an answer.

It’s important to reiterate how important it is to comprehend the problem we’re experiencing. We can’t assess the suitability of an answer without this initial comprehension - we can’t grade an answer without knowing the criteria we’re scoring against.

Once we’ve comprehended the problem, it’s time to comprehend the solution. As before, we don't need to understand every intricacy of the code, we don't need to understand line by line exactly what's happening but we should know roughly what each line of code is doing and why it's there - we should have an idea of how it works.

This brings us to another checklist (I really like checklists, don’t I?!), my solution suitability checklist!

  • Does it answer my question?

    Does the answer that's been given make sense as a response to the question that I asked? It could have been misread or misunderstood. And if I’m reading a solution to someone else’s question, is my question the same one as is being answered? A keyword search might have brought up questions that are very subtly different, which means they could have a less subtly different solution.

  • Line by line, what is this doing?

    If it's a code solution what does each line do? You don't have to understand every intricacy of the code but we should have an idea line by line what it's doing.

  • Does the code match the description?

    If someone's written a description of what a code sample does (LLMs usually do this too) does that match up with what the code actually does? If it doesn't, then we've potentially got a problem!

  • Does that feel right?

    This feels like a bit of a “fluffy” checklist item, but as a developer I often rely on my “gut feel” to hunt down “code smell”! We should ask how can we apply our existing knowledge to the answer to see if it makes sense.

  • How can we increase our confidence in this answer?

    If we don’t have enough background knowledge to instantly know the solution is correct, what else could we ask or what else could we look up to help us reassure us that this is the way forwards? If the solution is a regular expression, for example, perhaps we could plumb it into a regular expression explainer tool to ensure it matches our expectations. We could even dry run the code as a sanity check.

Four young adults running away from the camera through the desert, towards cacti and large rocks

(Please appreciate the visual pun here. They're running in the desert, therefore, they're dry running!) Photo by Annie Spratt on Unsplash.

Adapting code to meet our needs

The next thing we might need to do is adapt some code to meet our needs. Perhaps we simplified our question and now we need to adapt the answer to fit back into our more complex solution. This is only possible when we’ve understood the solution, but now that we have a better understanding we can tweak it to what we're expecting it to be.

And if we’ve established the answer we’ve found doesn’t quite meet our suitability criteria, through our further research we may be able to tweak an answer that’s close to correct to be the ideal solution.

How to Copy & Paste

(Hey look! That's the title of the article!)

If you thought two checklists were enough for one article, you were wrong! I've condensed the whole article into five-point checklist for how to copy and paste:

With these tips, I hope we can level-up our Ctrl+V game and become better developers and a together stronger community.