6
\$\begingroup\$

I have a project that I used to try out in-memory databases. After fighting it for a few days, I'm code blind and need to have it reviewed. I haven't been on this particular site much (I'm well acquainted with Stack Overflow, though) so I thought it better to ask than have this epic downvote and a bucketfull of lamenting irritating the other users.

When I checked the FAQs, I didn't find info on how to ask a question regarding the format, so I'm asking it here.

Is it acceptable if I post a link to an external repo for cloning and, if so, how much code do I post in the question body? Anything at all? Just any parts that need extra attention and scrutiny?

\$\endgroup\$

2 Answers 2

13
\$\begingroup\$

We actually have a few guides on how to ask good questions:

Basically, long story short:

  1. Include the code into the question. While links are useful for bonus context, they are no substitute for the code itself. Whatever you want to have reviewed, has to be in the question and not behind a link. Links rot. As a note: our body limit is 2x the size of Stack Overflow, specifically to put all code in the question.
  2. Make sure your code works to the best of your knowledge. Yes, sometimes unexpected things are broke, we'll mostly excuse that if it's not a major, obvious thing.
  3. Make sure you are open for any and all commentary. We're less of a "directed" community, and more of a "here's some general advice."
  4. No MCVE's. Post the actual code, and any usable examples, nothing contrived, please.
  5. Once you have an answer, don't edit the code in the question. This happens a lot, but basically, once someone has answered your question: don't edit anything related to that answer. (Otherwise, the answer is out-of-date.)
  6. Make sure you know what your code does, and why. Please don't post someone else's work, and please don't post something you don't understand. We can't explain how code works, we can only help you do it "better".
  7. Tell us about your code. We want to know what the code has set out to accomplish, not what type of coding you did. We can tell if it's OOP, FP, etc., what we can't tell is what you really wanted to do.

All-in-all: have fun, make sure things work, and keep an open mind. :)

\$\endgroup\$
5
  • 3
    \$\begingroup\$ Note that all the links you provide here point to meta.codereview.se, while the original post explicitly asks about the FAQ, which is situated in the help center. \$\endgroup\$
    – Vogel612
    Commented Jan 25, 2019 at 19:41
  • \$\begingroup\$ @Vogel612 Aye, OP indicated the FAQ did not answer the questions they had, so using Meta as additional, supplementary sources makes the most sense. \$\endgroup\$ Commented Jan 25, 2019 at 19:42
  • \$\begingroup\$ @Vogel612 I'm thankful for any information that will help me improve the quality of my posts. So the links, the elaboration and FAQa are all appreciated. Regrettably, I haven't been successful this time reaching sufficient level of excellency in said question because I got -2 and no comments on why. Care to throw in a more specific comment on how to improve this particular question? \$\endgroup\$ Commented Jan 27, 2019 at 22:23
  • \$\begingroup\$ @KonradViltersten as far as I can tell from a quick glance (before my morning coffee) the comments are already giving you a hint. You could try soliciting more extensive feedback from Code Review Chat. People seem to want more context on the code that you present there. \$\endgroup\$
    – Vogel612
    Commented Jan 28, 2019 at 11:31
  • \$\begingroup\$ @Vogel612 Thanks for the reply. May I ask how you figure? I've only seen a single request for more context and I've added more description after it's been made. Do you see additional comments that I'm missing? \$\endgroup\$ Commented Jan 28, 2019 at 22:32
2
\$\begingroup\$

To answer this specifically

Is it acceptable if I post a link to an external repo for cloning

Yes, if you do so only as an additional way for people to get the code. Any code that you expect to be reviewed should be present in the question body with enough context (other code) to see how it is used. The context can be in the form of tests, a custom written (just for the question) demo, or your actual code. If you wrote the code for the question, please state that.

If you post a repo link, it should be to a specific point that matches the code in the question, not to the constantly changing current version. It is acceptable to post both links (snapshot and always current version) if they are clearly identified.

how much code do I post in the question body? Anything at all? Just any parts that need extra attention and scrutiny?

If possible, all of it. We have an expanded 60k character limit for that reason.

If your code is longer than will fit in the question (figure 50k characters or so to allow for a problem statement, etc.), then pick the aspect that you want reviewed. Post all of that code. Then post any additional code that is necessary to understand the code you wanted reviewed. Some things to include:

  1. Any classes that your code uses that you wrote (you do not need to include the code for external imports of code written by others).
  2. Examples of how the code is used. Tests, demo, or actual code.

In regards to your specific question, people are complaining that you haven't explained what the code does. Step back for a moment. If you were asking someone to write this code, what is the specification for it? You currently have a rather generic

The test is carried out on a simple controller that returns a full list of entities from the DB or returns a specific entity by ID.

This is so generic as to be able to describe almost any code that accesses a database. More specifically, what are you doing? If you're working with games, tell us that. Some possibilities (I'm not a C# guy, so not trying to describe your actual code):

  1. Return all games from the database.
  2. Return all games from the database with property Foo (please tell us what Foo actually is, e.g. category, price range, etc.).
  3. Return a specific game based on an exact match to the title.
  4. Return a specific game based on a fuzzy match to the title.
  5. Return a list of games based on a fuzzy match.
  6. Return a specific game based on the game identifier from the database.

And what are you actually testing? That the correct game is returned? That a game is returned? That a list is returned?

In general, you should include enough explanation that we could write the code. We then use that to see if your code matches the explanation. The explanation should usually not be language specific. So even though I don't know C#, I should be able to parse the statement of the problem that the code solves.

As is, to understand what you are doing, I had to read C# code just to figure out that you are working with games. Is this for a store? A review site? Something else? I don't know. But I should.

On Stack Overflow, it is encouraged to make questions generic so that they'll be reusable. And similar questions get closed as duplicates. We don't do that. We ask you to be as specific as possible. You can even post the identical problem statement with revised code additional times (the iterative review process) if you feel that you want feedback on the revisions that you made based on answers to your first question.

\$\endgroup\$

You must log in to answer this question.

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