Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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 paris
  • Client 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.

share|improve this answer
add comment

There is no reason why your document information service can't be designed so that the pieces of information stored in it stay within their respective bounded contexts. In fact I imagine this would be a natural consequence of how you might plan to design the system, if it isn't designed this way already.

If your system has logins or groups, and documents are kept in the login/group in which they are created, then this will achieve the above goal.

I am comparing your document information system to a company wiki. A wiki can be used by an entire >1000 employ organisation and it might contain pages that are terribly important to one person but complete gibberish to another, and yet everything's okay because the respective business units generally have their own mostly discrete set of pages on the wiki that other business units ignore or aren't even aware of.

Yes you may have to extend your application to cover a wider and more general audience, but this is the goal/nightmare of any real application. Think of any database system - its goal is to solve the data storage problems of everyone everywhere. It's debatable how well they do it, but they can't be failing because everybody is using them.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.