Skip to content

Instantly share code, notes, and snippets.

@tonyyang-svail
Last active August 3, 2018 00:21
Show Gist options
  • Save tonyyang-svail/b0c2084fb06d191d0a68e46cc83d5289 to your computer and use it in GitHub Desktop.
Save tonyyang-svail/b0c2084fb06d191d0a68e46cc83d5289 to your computer and use it in GitHub Desktop.
Despite the characteristic of a programming language, compiled or scripted,
static typing or dynamic typing, the large scale software project written in
that language is essentailly a tree of files.
When coding in C, and many other compilation languages, the following things
are done separately
- Building System: a practical building system (e.g. Makefile, CMake,
Bazel) does not come with the language itself, one need to install one.
Extra code has to be written.
- Namespace is hard coded in the source code, which may or may not be the
same as the location of the file.
- Implementation (.c) and interface (.h) are seperate. It increases the
number of files in the directory Header files inclusion increases the file
size, which later on slows down the compilation.
- Linkage is seperate after the object files compilation. Even though a
file passed the compilation, it can still fail on linkage. And most of the
case, #include "A" in the source usually implies link to libA in the
building system.
When working on a moderate size project, these complexities can really slow
the progress down.
For example, consider you want to move file A from folder B to folder C. As a
prudent engineer, you need to
- Modify A's building system, namespace, and source:
- Move both the source and the header to folder C
- Modify the namespace from B to C
- Modify the makefile, also check if there is a circular
dependency
- Fix other modules depends on A:
- Modify the header files from B/A.h to C/A.h
- In every use of A, modify B::A to C::A
- Modify the makefile on target that relies on A, also check
if there is a circular dependency
We found a lot of duplications. For example
- Source and Header could be merged
- Namespace and file location could be merged
- Compilation and Linking could be merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment