8
\$\begingroup\$

My code is around 480 lines and a little over 13,000 characters(12,000 if not counting spaces). It consists almost entirely of headers and implementation files, with a very short main.cpp. Should I put all my implementation into my header files when I post it on Code Review? That would shorten the number of lines a bit and I figured it might make it easier to go through and analyze.

Is that a good idea, or should I keep it the way it is in my actual code, with separate declaration and implementation?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ What is the total character count of your files? There's a difference between 480 short lines with many empty lines vs long lines with barely any empty ones. Code Review has a maximum of 65536 characters per post, including descriptions of what the code does (excluding tags and title). If the code is bigger than that or comes close, posting it in a single question is already not an option. Please clarify. \$\endgroup\$
    – Mast Mod
    Apr 5, 2021 at 11:20
  • \$\begingroup\$ @Mast The total character count is a little over 13,000 characters (counting spaces). I've edited the question to include it now. \$\endgroup\$
    – JensB
    Apr 5, 2021 at 12:10

1 Answer 1

8
\$\begingroup\$

First of all, you're allowed to post the whole thing as-is, all in the same question. 13,000 characters is well within the limit of what a post may contain (65,536 characters as a hard limit), leaving plenty of room for a project description. A description should ideally contain:

  • what problem does your project solve
  • what prompted you to write
  • what are your current gripes with it

This usually takes a couple thousand characters at most, so you probably won't go over 20k. Just to point out we've seen big posts before and you're no way close to breaking any records. We can handle it.

The benefits to posting as-is are that it's:

  • easier for you (less preparation required)
  • easier on the reviewer if they want to run the code themselves (again, less preparation)
  • easier on anyone else trying to get a piece of it to work in their own project

It's also the most accurate representation of your current code and project. We can't point out you've missed a couple of includes or added includes you're not or no longer using if we can't see which you have where. We also can't help you restructuring your includes if you all pile them together.

On Code Review, we like context. Context tells us a lot about the code, the project, the developer and the problems it may have. Strip away the context and you're actually making it harder on us.

I think all of these (and there are probably more) good reasons not to do what you suggest, outweighing the benefits of the alternative. Keep it as-is, please. I understand the sentiment and on Stack Overflow they'd probably agree with you, but we're a little different.

\$\endgroup\$
2
  • \$\begingroup\$ Okay, got it. I will post it as-is. Where should I put my comments where I explain what the purpose of certain methods are, in the headers or the implementation files? \$\endgroup\$
    – JensB
    Apr 5, 2021 at 15:06
  • 1
    \$\begingroup\$ @JensB The purpose of the project in general should be in the question body. If there's a structure you want to explain, do that all in the question body as well. \$\endgroup\$
    – Mast Mod
    Apr 5, 2021 at 16:12

You must log in to answer this question.

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