What to do about a 11000 lines C++ source file?

Merging will not be such a big nightmare as it will be when you’ll get 30000 LOC file in the future. So:

  1. Stop adding more code to that file.
  2. Split it.

If you can’t just stop coding during refactoring process, you could leave this big file as is for a while at least without adding more code to it: since it contains one “main class” you could inherit from it and keep inherited class(es) with overloaded functions in several new small and well designed files.

Leave a Comment