title: HowToAsk

A quick introduction

Imagine you want to know how to get from “Old street” to “New street”. You call a random person to get help and you ask “What is the fastest way I can get from Old street 19 to New street 3?”. Would the random person be able to help you?

There are a lot of “New” and “Old” streets in the world, so first he would need to know what country and city you are in. If the street layout is complicated then maybe you need to name some buildings that are near you. Of course because speed is an issue then your means of transportation is also important; are you by foot, bike, car or truck? You can go on foot into places where you can't get by truck.

Those questions around the immediate question “How do I X?” is the context of the problem, it helps other people orient to the problem. Giving advice without context could mean that the other person will describe the wrong city.

In person it's easy to ask those questions and can be done in rapid succession, although on the forums this will result in a lot of back-and-forth questions that can be avoided. So, how to properly give the context to the problem?

How to ask a good question

People on the forums have limited time available. So, to speed things up, here is a small template for asking a question that will get better answers and answers quicker:

The gist of the problem you are having.

Things to keep in mind:

Of course, don‘t worry too much... you can’t answer all possible questions. It's not needed to write a 4 page essay on the whole thing. People can always ask when something needs clarification.

Why is that template necessary? Let‘s put you in the shoes of the answerer, and let’s say you get this question:

From the askers perspective this may look like a straightforward problem. Of course, you have no idea what the asker is trying to do. Is he trying to set a value on a value, struct, array or a map? This means you need to ask the first question: Can you give an example?.

Now the asker will provide an example:

Now you‘ve got some code that even doesn’t compile. This means you need to copy paste it somewhere and fix the mistakes. Putting it on play.golang.org makes it easier to see the problem (e.g. play.golang.org/p/fCxBlL9V4Y).

The fix is simple; just use SetMapIndex instead. Of course that may not be the full story. The asker now comes back with another problem:

What does “faster” mean? What is he trying to do? So you need to ask more about the specifics of the problem. So you ask: What are you trying to accomplish?

Well, ok, but that still didn‘t answer why it needs to be faster. Why is he using reflect for that anyway, when you can use map instead. So you answer: Can’t you just use map instead (e.g. map[type]struct{})? What are you writing the set package for?.

Finally we have all the information that‘s needed. The solution is straightforward: biogo https://code.google.com/p/biogo/ has most of the stuff necessary for handling large datasets and parallelism etc. Also what’s the “NucleotideIndex”. The asker may have found the answer and say: Thanks that's really nice. but there is a possibility of:

That looks weird, why would you do it that way. Nevertheless we've all done something stupid, so... now you can start suggesting something better: Probably dealing with map[Type]map[int]struct{} would be much easier. Because you are dealing with sequences and the set elements are always used in an increasing order you can just store the index in an array e.g. map[Type][]int. Also if the memory starts to become the problem you could make it into a run-length-encoded set...

Now we can have a more meaningful discussion about the (dis)advantages of different set types.

Hopefully after this long example, you probably understand why it's useful to provide more information. The initial back and forth questions could have been avoided. Proper question could have saved time for the question asker and the answerer.

The initial question could have been:

Summary: