12
\$\begingroup\$

Code submitted for review is supposed to be "working code". I imagine this to be for 2 reasons:

  1. We are not looking to fix broken code
  2. Being able to run the code allows deeper review

Is this correct? Does (2) apply?

When reviewing for style or readability it is less important but questions like this that want performance improvements really suffer from not being able to run the code.

In this case a non standard module is imported by the Python code but is not made available to reviewers. I added a comment back in April to point out that we cannot profile without the module, but there has been no response and the question has received no answers.

I am disinclined to suggest closing a question just because the code cannot be run if it is just asking for feedback (provided it isn't obviously broken). However, when the question specifically asks for performance improvements are there any other options?

I'm hoping to see any other possibilities before resorting to suggesting closing.

\$\endgroup\$
1
  • 4
    \$\begingroup\$ Code that can't be executed as posted isn't necessarily broken. Sure it's nice if you can run it as a reviewer, but in some cases that's simply impossible without posting an entire project. You can always ask in a comment for the OP to supply the missing relevant pieces that would allow for a more complete review. \$\endgroup\$ May 29, 2014 at 22:43

1 Answer 1

8
\$\begingroup\$

I don't believe that it is reasonable to require a question to include the entire codebase. For more substantial projects, that codebase could be quite large. Furthermore, people may have valid reasons for not wanting to publish all of the source code for the world to read.

No doubt, withholding some of the code makes it a poorer question and makes the code more difficult to review. It also increases the likelihood that there would be fewer (or no) answers. However, I don't think that publishing all of the code should be a requirement. It just needs to be reasonably clear what the intention of the missing code is; if it isn't you could ask for clarification or close it as "unclear what you are asking".

There are many supplementary materials that could make things easier for reviewers and increase the response rate: test cases, a live example hosted externally, the database schema, output from SQL EXPLAIN… They would all be beneficial to be included in a question, but we don't require them.


For this particular question, it turns out that import maths is an extraneous import. The program never uses anything in the maths module.

\$\endgroup\$

You must log in to answer this question.

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