Lyte's Blog

Bad code, bad humour and bad hair.

Asking Questions

Asking technical questions is hard… well, people get it wrong so often that I’m certain it can’t be easy.

There’s a bunch of reasons why questions get asked poorly or not at all, but here’s some common themes I’ve spotted.

P.s yes, I’m guilty of making every mistake here at least once.

XY Problem

How do I get this regex to match the closing HTML tag correctly?

This is probably the most common, it even has its own site.

It’s not uncommon to naively stumble in to a problem that’s way beyond ability and find yourself thinking you can fix it “if only I could solve Y”. The trap here is that if you just ask about Y and don’t put X (the actual problem you’re attempting to solve) in context it can be really hard to for anyone else to figure out you’ve asked the wrong question for you.

Lack of Context

How do I cast to integer?

This is the broader version of the previous problem. Your question may be perfectly reasonable, but without knowing enough about the original problem we have no way to guess what you’re casting or what language you’re in. I mean surely given you’ve used the words “cast” and “integer” you know (int)$foo casts in most languages, so you couldn’t be asking about that… could you?

Asking to ask

Oh I know you’re super busy, I hope you’re having a great day, it’d be great if you could help me with a problem I’m having with my code.

I often just wait to see if these people will ever ask a question.

If you’re going to ask a question, ask it. Asking hasn’t cost the other person anything, answering will and if you make someone work harder to answer you (by asking them to ask you the question you’re trying to ask) they’re going to be less willing to spend that time.

Lack of a Question

Can string a timestamp.

Sometimes someone asks something so garbelled it’s not possible to tell what they actually mean any more.

Sure it lexes and even looks like English, but I have no idea what you were trying to ask. There’s probably a string and a timestamp involved, probably some conversion between the two. Who knows what direction and in what language? Not me.

P.s question marks make it more obvious it was intended as a question.

Afraid to Look Stupid

If anyone thinks you’re stupid for asking a question, they’re wrong. Yes there are many things you could have looked up on Google and some of them might have given you the answer in an entirely reasonable way, but sometimes it’s hard to find the set of search terms that get you that answer.

Caveats: If you ask your question really badly, you can actually come off looking stupid. Don’t use this as an excuse to not try Google first.


This is way less common, but you know it if you see it - you just get a wall (pages and pages and pages) of text with no introduction to what the problem is. Lots of info is great, but put some structure around it and introduce the problem first.

Good Questions

It is possible to ask a question well, but it does take effort. Here’s what I think you need to focus on.


Start with a short summary of the problem.

You need to set the context, backtrack in your working to what you were actually trying to solve that led you down the path to your current question. Summarise that up front.

Consider the communication medium

A lot of the rest of this advice makes sense for text based chats (email, instant chat, etc). If you’re communicating in person information can flow back and forth much more quickly about what you’ve tried. If you’re communicating over email to someone in another timezone, you likely need to include excruciating detail to not wait a day just to find out you left out something important. If they can’t see your screen, consider including a screen shot, pastebin or codepen as appropriate.

Tell us what you’ve tried

Explain briefly any solutions (if any) you attempted and completely discounted. Explain the solution (if you have one) you are currently attempting and why you think it’s currently not working.

Consider the audience

Has the person you’re asking actually worked on the project you’re currently on or are they a domain expect and completely green to your current problem? This will make a big difference to the background required.

Make it easy

The easier it is to understand your question, the easier it is to answer it. If your question is hard to read, doesn’t include enough info, is clearly the Y part of an XY or any other problem - it’s harder to answer and anything you do to make the job of answering it harder makes it that much less likely someone will bother to answer it.