Firstly, I am following the convention that a bounded context is synonymous to a department, or possibly one department has 1 to many bounded contexts.We have a client consultancy department that has a Documentation Service. Documents are stored in the Document Store Service (which is where all documents in the company are stored - it is a utility service), and the Documentation Service stores information about that document (a business service). As it was designed for the client consultancy, it is information relevant to them. Now health and safety need somewhere to store information about a document. This is different information to client consultancy, but I have been instructed to extend the existing service to account for this extra information. I feel this service is now crossing a bounded context. My worry is that all departments will eventually store there information in here and the service will become bloated, trying to be all things to all departments. Each document record will only store a subset of the information because it will only belong to one department.It will get worse when different departments want to store the same information but refer to it in a diferent ways, or when two departments want to store different information that they refer to in the same way. In my understanding, this is exactly the reason for bounded contexts.I feel each department should have it's own business service for information about a document, but use the same utility service to actually store the document.What would be the correct approach?
Should business services cross bounded contexts?
architecture;enterprise architecture;soa;services
You probably have just identified the need for a function that is not specific to any one department, but rather forms kind of a basic infrastructure. Consider forming a bounded context Basic Infrastructure, and assign the Documentation service there. This way, there are clear boundaries and dependencies between the different context. The basic Documentation service can still be consumed by any department, without messing up your design. Consider specific implementations on top of the more generic Documentation service to deal with functions specific to a department (or rather: business function). Those specific implementations would then belong to the respective bounded context. E.g.Basic Infrastructure: GenericDocumentationService(document, attributes) - where document is the document to be stored, attributes is a list of key/value parisClient Consultancy: ConsultancyDocumentationService(document, client)Health and Safety: HealthSafetyDocumentationService(document, risk, mitigation)The client and health&safety implementations would e.g. validate and process their specific arguments, then use the generic service to finally store the document.NB: In general, business organizational structure such as departments do not make for good boundaries. Rationale: organizational structures tend to change over time and such changes are likely to invalidate previously identified boundaries. Instead it is advisable to identify the core business functions and group those into logically cohesive blocks. 