I'm wondering how some users handle huge amounts of code. There's a vba 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:
3 Answers 3
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.
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.
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.
Dim
keyword instead ofPrivate
, and because OP doesn't seem to indent the body of their procedures - these would be valid review points. \$\endgroup\$