14
\$\begingroup\$

I'm wondering how some users handle huge amounts of code. There's a question out there right now that I would really like to review. However, as stated in the question - it's 1400 lines.

I know that doesn't make it a bad question, or off-topic or bad code, and I'm not complaining about it.

But sometimes I see giant blocks of code in the tag I troll and I feel overwhelmed just looking at it. Maybe it's because I don't troll a real language, but it's near impossible to debug or even compile a lot of VBA questions without reconstructing the workbook layout, module layout, generating data of the correct type - just to avoid errors in trying to see what it does.

How is this handled in some of the other tags? Is there an acceptable way of asking a user to break it apart or provide sample data?


Possibly related meta posts:

\$\endgroup\$
  • \$\begingroup\$ To prevent it as being flagged a duplicate, I am concerned the site-culture has changed since the other questions were asked. \$\endgroup\$ – Raystafarian Apr 25 '16 at 16:23
  • 3
    \$\begingroup\$ One thing that strikes me with that particular one, is how hard it is to tell where a procedure starts and where it ends, because module-scope variables use the Dim keyword instead of Private, and because OP doesn't seem to indent the body of their procedures - these would be valid review points. \$\endgroup\$ – Mathieu Guindon Apr 25 '16 at 16:39
  • 1
    \$\begingroup\$ You can always write an overwhelmingly long code review. \$\endgroup\$ – Insane Apr 25 '16 at 17:31
  • \$\begingroup\$ Helpful meta. \$\endgroup\$ – SirPython Apr 25 '16 at 20:06
  • \$\begingroup\$ @SirPython thanks, added it to the post \$\endgroup\$ – Raystafarian Apr 27 '16 at 11:37
  • 2
    \$\begingroup\$ I'll be honest, I don't troll the tag anymore because I got tired of writing enough to fill a blog post and only getting 20 LoC into the Q. It can be exhausting, particularly when it's usually the same advice over and over again. Take a break, only answer the truly interesting questions maybe. \$\endgroup\$ – RubberDuck Apr 29 '16 at 22:17
  • \$\begingroup\$ @RubberDuck yeah I'm starting to feel the same way, it's just low-hanging fruit, but it's useful to the askers. Unfortunately I don't feel I can help much in other languages. \$\endgroup\$ – Raystafarian May 5 '16 at 17:57
19
\$\begingroup\$

There is no requirement for a Code Review answer to critique every part of the code exhaustively. If a question contains a lot of code, some possible responses might be:

  • Ask for clarification in a comment. If the question is just a huge code dump with no context, I think it might be fair to suggest that the author improve the question. (In general, I think that presenting too much code is better than presenting an excerpt that is too short to tell what is going on — up to a certain reasonable point.)
  • State your overall impression. Does it seem well architected? Can you, as a stranger, understand how the code generally fits together? Is this the right algorithm to use? If an interviewee presented this code, would you hire him or her?
  • Pick a few functions to focus on. If a few lines of code stand out as being problematic, dissect that portion of the program.
\$\endgroup\$
7
\$\begingroup\$

What @200_success said.

For the particular post in question, I just started at the top, started critiquing the Naming and, well, never even got past the first Sub before I'd already filled a whole post.

That's generally how I tackle those kinds of questions. Start at the start, critique as I go and stop once I've filled a post/run out of time.

\$\endgroup\$
5
\$\begingroup\$

You can always ask a user in a comment to improve the question. I often suggest question askers to read Simon's guide for asking a good question, which contain many tips for making a question easier to review and more attractive for reviewers.

Generally, I feel that the longer the code is, the more context and description there should be in the question. If there's very little context and description given, I downvote and add a comment suggesting the asker to improve their question, and move on.

\$\endgroup\$

You must log in to answer this question.

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