How do you structure larger projects?

gpl
2019-05-08T23:00:25Z

I'll be writing a relatively large piece of scientific code for the first time, and before I begin I would at least like to outline how the project will be structured so that I don't run into headaches later on. The problem is, I don't have much experience structuring large projects. Up until now most of the code I have written as been in the form of python scripts that I string together to form an ad-hoc pipeline for analysis, or else C++ programs that are relatively self contained. My current project is much larger in scope. It will consist of four main 'modules' (I'm not sure if this is the correct term, apologies if not) each of which consist of a handful of .cpp and .h files. The schematic I have in mind for how it should look is something like:

src
 ├──Module1 (Initializer)
 │         ├ file1.cpp
 │         ├ file1.h
 │         │...
 │         └ Makefile
 ├───Module2 (solver)
 │          ├ file1.cpp
 │          ├ file1.h
 │          │...
 │          └ Makefile
 ├───Module3 (Distribute)
 │          ├ file1.cpp
 │          └Makefile
 └ Makefile

Basically, I build each self-contained 'module', and use the object files produced there to build my main program. Is there anything I should keep in mind here, or is this basically how such a project should be structured?

I imagine the particularly structure will be dependent on my project, but I am more interested in general principles to keep in mind.

Comments URL: https://tildes.net/~comp/d70/how_do_you_structure_larger_projects

Votes: 14

Comments: 5