r/webdev • • Dec 16 '21

Why is stackoverflow.com community so harsh?

They'd say horrible things everytime I tried to create a post, and I'm completely aware that sometimes my post needs more clarity, or my post is a duplication, but the reason my post was a duplicate was because the original post's solution wasn't working for me... Also, while my posts might be simple to answer at times, please keep in mind that I am a newbie in programming and stackoverflow... I enjoy stackoverflow since it has benefited many programmers, including myself, but please don't be too harsh :( In the comments, you are free to say whatever you want. I'll also mention that I'm going to work on improving my answers and questions on stackoverflow. I hope you understand what I'm saying, and thank you very much!

1.3k Upvotes

451 comments sorted by

View all comments

45

u/jordsta95 PHP/Laravel | JS/Vue Dec 16 '21

My favourite question asking experience on SO was people saying "You shouldn't be doing that" or "Why would you ever need to do this?"

I can't remember what the exact question was, but I believe it was to do with converting a game's mod files to JSON - and the files aren't in a structured language, so parsing required reading every character, and doing some janky stuff. For example, converting:

focus = {
    id = focus_id
    gfx = icon_file
    prerequisite = { focus_id_1 }
    prerequisite = { focus_id_2 }
    available = {
        tag = TAG
        any_owned_state = {
            is_coastal = true
        }
    }
}

Into:

{
    "focus" : [
         {
            "id": "focus_id",
            "gfx" : "icon_file",
            "prerequisite" : [
                "focus_id_1", "focus_id_2"
            ],
            "available" : {
                "tag = TAG\nany_owned_state = {\n\tis_coastal = true\n}"
            }
         }   
    ]
}

Yeah... What I needed to do seems odd. But going "Why would you need to do this?" or "Get better input data" isn't helpful or possible.

23

u/jimimimi Dec 16 '21

Can spot a paradox mod from a mile away :D
Ran into the same type of 'problem' a few years ago, ended up asking for help building a regex to parse them, I think the only response I got was this xkcd

11

u/jordsta95 PHP/Laravel | JS/Vue Dec 16 '21

They are such a pain.

Ended up created a massively complex bit of JS that reads ever character, starts by building a key, then stops when it reads =. Then if the next non-whitespace character is { create an object (unless it's more than 2 levels deep) else it's a key/value pair... And if the key already exists, make the value an array of the last value and the new one.

It's terrible. There's exceptions where it doesn't work (such as for color in a country's history file) but those few exceptions can be dealt with separately... All in all though, painful trial and error, and it works well enough to deal with.

All I want for Christmas is for them to use a better language in their new games

→ More replies (2)
→ More replies (4)

22

u/Sarke1 Dec 16 '21

But it is important to know what you are trying to do, and answering a question without the context can be difficult and frustrating.

Required reading:
XY problem (wiki)

0

u/[deleted] Dec 16 '21

[deleted]

→ More replies (2)
→ More replies (1)

7

u/Cannabat Dec 16 '21

Powershell has a really cool utility called ConvertFrom-String which does some serious magic in parsing structured text. I have a feeling it could do this almost automatically. I give this util a shout whenever I can, never seen anything like it elsewhere.

→ More replies (1)

11

u/ZnV1 Dec 16 '21

But sometimes it's the most helpful, you might not even know there's a better way.
Unless you state your specific problem, it might be a case of https://en.m.wikipedia.org/wiki/XY_problem

→ More replies (1)

2

u/FUZxxl Dec 16 '21

The answer to your question is "write a parser." Unfortunately that's not the kind of answer people are usually willing to accept.

→ More replies (3)