Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was just curious, it's something I think most people are aware of as a technique:

You have some abominable data that simply must be parsed and you can do nothing to simplify the algorithm for doing it, so the best you can do is isolate the complexity of that algorithm to one place rather than having parts of the algorithm strewn all over. Then after isolating it, cementing the boundaries of it with some interface or contract to ensure the complexity in it does not leak out.

Where does this drive to isolate complexities live in the library of design principles? I don't think it is word for word one of the formally documented design principles, though I'm guessing there are one or two that overlap with this very closely.

share|improve this question
up vote 3 down vote accepted

I would consider this a special case of the Single Responsibility Principle.

Essentially, you have a component dedicated to the implementation, execution, and consistency of the specified algorith - rather than distributing bits and pieces of the algorithm across several different components.

This both encapsulates the algorithm and ensures that if it needs to change over time, there's only a single area of the code that is impacted.

share|improve this answer

The principle that satisfies your description (as I understand it) is the Black Box principle - For example, see this link:

share|improve this answer

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.