What are the alternatives, the division of code into modules? That is, the question is in the approach to the design of the architecture itself, and not the use of any features of a specific development environment or code optimization (such as removing templates). For example .h .cpp in C ++.

The main goal: increase compilation speed.

Additional goal: usability.

@Flammable

  • one
    None? To keep everything together with dependencies in the head for a project with a size of 1000 lines of code is fraught with wild mistakes. And why do you need an alternative? What do you want to achieve? - VladD
  • one
    I wonder what you will answer. In fact, the modular organization of the project is just used for: - increasing the compilation speed due to separate compilation of only the modified modules, - ease of use (including ease of debugging, ease of reuse). Come up with something else - the Nobel Prize ... - morin
  • one
    - use more ready-made code in the form of modules (they will only link). - minimize the code (not to reduce, but to minimize, that is, to know the features of the compiler at a very low level). - use precompiled headers - switch to scripting languages ​​- there is often no compilation at all :) - KoVadim
  • one
    @manking, what do you call a module? Compilation unit or "executable"? If "executables", then what would you consider a module for a scripting language? If we talk about the namespace (external links), then dynamically loaded .so (. Dll) is a module? From your question it is not at all obvious what exactly you would like to discuss. - avp
  • four
    If anyone is interested, then for the new standard (which is C++1y ) there is a proposal to include modules in C++ , which, apparently, should speed up the compilation time and make life easier in general. - Costantino Rupert


1 answer 1

Have you thought about encapsulation? :) think. For example, I would not like to see the implementation of printf () in my program. Separate compilation increases the speed every ten, if you have 10 modules and one you have corrected, then only the corrected one is compiled. This architecture is not the remainder of the great-grandfathers inherited; it is an experience and proven method for decades. In the end, and if part of the program will develop someone else? All in one place?

  • In secret. Maybe you are just too lazy to write a Makefile? :)) - cheb