2

If I've written about 50 lines of badly written code, is it permissible to ask someone to look over it and explain what the problems are and what I ought to be doing instead? Particularly if the errors are of a 'schoolboy' nature?

If not, is there another Stack Exchange site where I should go? I did ask something once on Code Review, but they told me that because there were errors, it wasn't allowed.

10
  • 2
    Any way you could narrow it down a bit? A large block of code with multiple errors can be pretty difficult to address with an answer. Commented Aug 21, 2019 at 15:39
  • 2
    If the code is working, then the Code Review Stack Exchange might be a good fit. But make sure to study their rules before posting there.
    – BDL
    Commented Aug 21, 2019 at 15:47
  • Unless it's not yours, you can ask on Code Review. They have a very nice, helpful community there and I've redirected quite a few people myself. Just make sure to read the guidelines first: codereview.stackexchange.com
    – S.S. Anne
    Commented Aug 21, 2019 at 17:42
  • 1
    @JL2210 wonder why you didn't directly refer these CR.SE guidelines, with their wonderful six-yes criteria
    – gnat
    Commented Aug 21, 2019 at 17:59
  • @gnat Probably unaware of them or just laziness; it's reasonable to expect a user navigating to cr.se.com for the first time to also stop by their help center and/or tour before asking a question, and I'll never be persuaded <strike>wrongly</strike> otherwise.
    – TylerH
    Commented Aug 21, 2019 at 19:50
  • @TylerH as far as I can tell this micro-study suggests that expecting newcomers to get to posting guidelines may be a bit too optimistic
    – gnat
    Commented Aug 21, 2019 at 19:53
  • 1
    @gnat It may be optimistic but that doesn't mean it shouldn't be expected. Standards must be upheld
    – TylerH
    Commented Aug 21, 2019 at 19:59
  • 1
    @TylerH observing what frequently follows indiscriminately referring newcomers to site front page I would say this is the case when unrealistic expectations cause pain for everyone involved (except for maybe careless advisors). Site regulars get frustrated by off-topic stuff dumped at them, newcomers get frustrated by closures and downvotes that could be easily avoided if they started at the right page in help center (which is practically impossible to guess for an inexperienced user when they are at the front page)
    – gnat
    Commented Aug 21, 2019 at 20:10
  • @gnat I was aware of them, I just figured that the user would be able to navigate to them through the help page (considering that it wasn't a new user).
    – S.S. Anne
    Commented Aug 21, 2019 at 22:50
  • 1
    @gnat I would like to echo the results of that survey and admit that I never noticed the Help icon, despite clicking on the the trophy one to the left of it regularly!
    – benwiggy
    Commented Aug 22, 2019 at 10:11

1 Answer 1

11

Stack Overflow works best when you have a particular problem you're trying to solve. A particular problem is typically defined as a problem other programmers would face.

If your code has multiple logic errors, then it's up to you to research them, figure out which are applicable to other programmers, and ask individual questions as a last resort. Since Stack Overflow has been around a long time, you may already find your answer here while doing the research.

So far looking at your questions on Stack Overflow, they're reasonably scoped. You want to keep them reasonably scoped. Asking about 50 lines of code is likely not reasonably scoped; unless it all happens to only do one thing (although even then I'd suggest you narrow it down to the exact few lines that you're having an issue with).

We don't work so well when questions are "show me how this code should be written" though you can get that effect if you ask your question in such a way where it's useful to others. By default, people want to share what they know and will demonstrate how you should write your code, all without asking (and asking only serves to draw attention to that, which garners a less-than-stellar response, generally).

To recap:

  • Pull out your issues into small discrete chunks that are useful to others (your existing questions do this; so I'm confident you've got this part down)
  • Don't ask someone to tell you how you should write the code -- that's implicit in their answer
  • Focus on how you can ask the question in a way where it's useful to others

If the code doesn't have compilation/logic errors, then feel free to take it to codereview.stackexchange.com. They're used to those sorts of questions.

Not the answer you're looking for? Browse other questions tagged .