I'm planning a new project that I'll develop in C++. I need a good solution structure, for a quick project overview. My project is a tcp based server. This server is able to save files and text from client into a database or on the filesystem. The server can also send files and data from the database back to the client. My structure should look like:
Solution
- main.cpp
- DataAccess
--- Header
--- Source
- Business
--- Header
--- Source
- CrossCutting
--- Header
--- Source
- Server
--- Header
--- Source
--------------------------------
- External Dependencies
- Tests (Unit and Integration)
- Documentation
That's my idea. Here a little introduction for this folder structure:
DataAccess: Here is the connection between logic and data (database, io)
Business: Here is all the logic. Only the business has access to the data access layer
Server: This is my server layer. Client request will be processed there. Only the server layer has access to the business layer.
CrossCutting: This layer is a little bit specieal. Here are functions, classes, entites, etc., which will be needed in several layers.
I think the other folders should be clear. If not, let me know them. What do you think about this solution structure? Is this a good start or should I need rework?
What do you think about this solution structure? Is this a good start or should I need rework?
It's a good start; it could use some rework :)
This is fine if you are thinking of a single project. Ideally you should split this into multiple projects (as separate lib/dll projects) and have a main project that contains your main.cpp and launches the application/server/service.
Advantages of splitting into multiple projects:
I would consider the following changes:
root // project root, source control root, etc
I would also define some common property pages near the solution file, where I would specify common build and temporary build directories, then inherit these property pages accross the projects; This would centralize build artifacts and binaries, and ease the editing of common settings.
Note: I am currently working on a relatively large project (~180 projects in the solution), using this structure.