How Do You Deal With Common Infrastructure Code For Multiple Projects?
Here’s the situation: a couple of months ago we started developing according to a new architecture. Obviously, you need infrastructure code for this. For the first project, we just put the infrastructure code into the project’s solution and everything was easy. We could make changes as we needed them, and it enabled us to ‘grow’ the infrastructure into what we really needed. Then came the second project. I was reluctant to extract the infrastructure code in a separate reusable assembly because i felt it would lead to less flexibility to make changes. So i copied the infrastructure classes into the new project. Obviously, some changes were made in the classes of the second project, which weren’t ported to the classes of the first project. Add another project or two, and you can see the problem
So now we’re trying to figure out how best to move forward. I’ve got 3 options in mind:
- Infrastructure code as a separate project, binary ‘framework’ dependency per ‘client’ project
- Infrastructure code as a separate project, ‘framework’ dependency (in source form) per project (as in: copying the code of a specific version of the ‘framework’ into the project’s own repository)
- Each project just contains the infrastructure code in their own project and there is no specific ‘framework’
The way i see it, each approach has its pro’s and con’s:
- Infrastructure code as a separate project, binary ‘framework’ dependency per ‘client’ project
- Pro’s
- The code only has to be maintained in one place
- Everybody can benefit from changes
- Con’s
- Can make debugging harder because you can’t step into the framework code
- Requires a lot of discipline for versioning and distributing updates to ‘client’ projects
- The infrastructure code has to have a lot of extensibility points so each application can add extra functionality
- Infrastructure code as a separate project, ‘framework’ dependency (in source form) per project (as in: copying the code of a specific version of the ‘framework’ into the project’s own repository)
- Pro’s
- Does not have the debugging issue
- Code only has to be maintained in one place (in theory)
- Everybody can benefit from changes
- Con’s
- The infrastructure code has to have a lot of extensibility points so each application can add extra functionality
- If people change the infrastructure code in their project, all changes should be sent upstream to the ‘real’ infrastructure repository, or extension points need to be provided in the original infrastructure code so upgrades of the infrastructure library still offer the same possibilities for the specific project
- Still requires versioning discipline, although it probably wouldn’t need to be as strict as with Option 1
- Each project just contains the infrastructure code in their own project and there is no specific ‘framework’
- Pro’s
- Highly flexible… each project can freely make changes to make the infrastructure behave exactly as it needs to for the project
- Con’s
- Leads to multiple ‘versions’ of many of the classes… when a new project starts, which versions of each class should be used?
- Starting a new project contains boring set-up work which is basically just copy/pasting existing classes from previous projects
The reason i’m posting this, is because i’d love to get your feedback on this… what other pros/cons can you think of for each approach? Which approach would you recommend? Is there another approach we haven’t thought of?


