Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
How to best ask about algorithmic problems
The question How to efficiently remove every occurrence of one string inside another and discussions in the comments there got me thinking about the best way to ask about algorithmic problems. In particular, which pitfalls should be avoided to not make the question off-topic?
Some issues I see:
- What requirements should be stated? Is it okay to just ask for any algorithm that solves the problem in any way or should typical input data properties be specified and if speed or memory or other optimization criteria exist.
- Should an implementation language or set of languages be specified? Or is pseudo-code also okay? If no implementation language or set of languages is specified, there could potentially be a lot of answers in many different languages and voting on them might not make much sense.
- Do we care about duplicating external content (like Rosetta code for example)? The most often needed algorithms are likely already described or implemented somewhere else.
- Is the full implementation of algorithms feasible within the Q&A format? The description might just become too long (better suited for other content types like longer articles maybe). Where to draw the line between an algorithm that still can be described and one that cannot anymore?
How would a high quality on-topic question about an algorithmic problem look like?
1 answer
This question was of very poor quality and should have been closed. I closed it but someone disagreed, for reasons unknown. I'm not sure if it's an actual algorithm question or just a request for free code. C strings are very specific to that programming language and I'm not sure if it's even meaningful to discuss handling of them in abstract terms.
What requirements should be stated?
What language, compiler, system etc are you using (when this is relevant).
In case a question is about performance then the question might need to define if they are interested in actual run-time execution speed, or theoretical execution speed/number of comparisons ("Big O" etc), or memory consumption etc etc.
Should an implementation language or set of languages be specified?
Only if the question is about implementing an algorithm in a certain language. It is not OK to ask to have free code written by unpaid volunteers - it's (arguably) very rude and a violation of our "be nice" Code of Conduct, so the user might get suspended for posting such.
A question about how to implement something in a specific language is by definition not a broad algorithm theory question.
Do we care about duplicating external content
If some solution already exists we should point them that way; re-inventing the wheel is rarely ever a good idea. But answers that are nothing more than a mere link to an external resource should be avoided. Such can and should be posted as comments instead. Answers should add something of value to this site.
Is the full implementation of algorithms feasible within the Q&A format?
Yes, given that the poster has made an effort themselves and are asking about particular problems they are facing. Code review of complete working code is also on-topic here, use the code review category.
How would a high quality on-topic question about an algorithmic problem look like?
Detailed, with some research effort. Writing such questions is hard!
Here's one attempt I made at some point: https://cs.stackexchange.com/questions/68214/finding-the-spots-furthest-away-from-bad-data. Not sure if it's a great question but at least someone understood it well enough to give a great answer, after which I realized how to best design the algorithm.
0 comment threads