Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 141951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:51:32+00:00 2026-05-11T07:51:32+00:00

I was wondering today about how much code people normally have in a single

  • 0

I was wondering today about how much code people normally have in a single source file before they decide to split it into multiple smaller files.

Personally I tend to keep my files fairly small (exspecally header files when working with C/C++). That is I will generally only have one class or a bunch of functions in a given file so the file is generaly <500 lines. However all the stuff related normally shares the same namespace.

On the other hand some of the stuff I work with seem to quite happily try to stick as much as possible into a single file which is then 1000’s of lines long.

I like the small files better since any changes only requires recompiling that one piece of code, and I find it easier to navigate the source when it is broken into smaller files each with a specific purpose, rather than one massive file about the entire thing. Is there any real advantage to a few massive files?

For example my particle system is broken into system.h, emitter.h, load.h, particle.h, etc and corosponding .cpp files for each one. However some particle systems ive looked at seem to have put the entire source into a single .h and .cpp 1000’s of lines long.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:51:33+00:00Added an answer on May 11, 2026 at 7:51 am

    Smaller files are without any doubt easier to read and understand. However, I don’t think you can make this decision based on the number of lines in a class or source file. Consider splitting up your code if you feel that common functionality should be placed in a different file instead. It will also allow for better reuse of code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was always wondering about this and today I have finally came to a
I have come across a situation today which has me wondering about best practices.
I discovered today Servlet 3.0 asynchronous facility. I have read about it and think
I just today learned a little about Composition over Inheritance . I was wondering
Today, I was just told about the seed() function from a programmer much more
I read something about Lua today, and I was wondering what it was. I
I was asked earlier today about adding WordPress to a website and was wondering
I'm learning about graphs(they seem super useful) and was wondering if I could get
This is a pretty general question, but I was wondering today about delegates. At
Today I was wondering about c++ destructors so I wrote a small test program.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.