Is the dependency inversion principle an instance of orthogonalization? Given the class dependency X -> Y a common solution is to introduce interface Z so that the dependencies become X -> Z <- Y. In the first case a change in Y might cause a change in X. After introduction of Z a change in X will not cause Y to change, and a change in Y will not cause X to change. In this sense X and Y are orthogonal. Does this sound correct?

What I'm interested in is what appears to be a higher scale version of this problem. Imagine a complex system. Component P runs a policy that has various effects on the system. The policy can be swapped out or modified. Component M is a monitor whose job is to observe effects of various policies running in the system and compute for each policy a score on the interval [0,1] where 0 is bad and 1 is good. Component M can't fully monitor the system, so the environment is partially-observable. However, assume the score is accurate enough.

Basically P causes various effects and M attempts to maintain a rating computed from the set of effects caused by P.

Here is the interesting part. What if I want to 'trick' M into maintaining the rating at a constant? The rating of P is not something P owns. It is a perception. The idea is to introduce component Z that has an intuitive idea of how M computes its ratings. Z is not a policy so M is not monitoring it. Z can also engage in behavior that is restricted within policies. Every action by P triggers Z to strategically generate effects in the system. The idea is that all the effects together will trick M into keeping the score constant. P can generate 'bad' effects and Z will cover up for them strategically. M will think P is doing just fine. This might not work perfectly because the environment is partially-observable, the algorithm of M is not exactly known, Z may not know what effects will cover up for P, and many other reasons.

The goal is that actions by P do not effect the rating decisions of M. The introduction of the component Z is vaguely similar to the introduction of interface Z in the first example. The idea is that Z is an attempt to orthogonalize P and M. It might not work perfectly, but it's the attempt to do so that I'm labeling as orthogonalization.

Would it be proper to say Z attempts to orthogonalize P and M? Are P and M orthogonal actually?

The initial dependency is something like P <-> M. P depends on M for its perception, and M depends on P to compute an accurate score. (perhaps P also depends on itself for its perception)

The ideal dependency is P -> Z <- M. P depends on a clever Z for its perception. M depends on Z for its rating. Effectively, P triggers Z and Z controls the decision of M.

However, perhaps the initial dependencies cant be fully removed. In that case a strength can be attached to the dependencies. For its perception P is weakly dependent on M and highly dependent on Z. For its decision M is weakly dependent on P and highly dependent on Z. In this case they are nearly orthogonal?

Now imagine I not only want to keep the score computed by M for P at a constant, but occasionally the score needs to be adjusted up or down slightly. Z will do what is necessary to cause this. Would the word orthogonal still be proper?

Overall, what I'm looking for is a word or phrase that best fits this situation where the effects of P on decisions of M are controlled. (where decisions of M are decided elsewhere and causally transferred into its decision making process)

Some ideas I have are: Policy-Monitor {Orthogonalization, Dependency Inversion, Dependency Separation, Decision Inversion, Decision Control, Inversion of Control}.

Thanks for any help. Also, any links to relevant discussion would be nice.

Edit for clarification: This is abstract for me because right now its only a thought experiment that might lead to something interesting.

M not only monitors direct effects of P but all possible n-th order effects originating from P. Z is introduced to attempt to indirectly control the decisions of M by causing effects such that M attributes them to n-th order effects of P. Z secretly knows how M makes decisions, so its effect can be specially designed to make M compute the target score.

The important part is that it's about perception. M has a perception of P and owns it. P might not like the perception. P can react to M and change its policy details to try to get a better score, but the idea is that P does not want to react to M.

Z is an attempt to allow P to ignore M. The purpose of Z is to indirectly control the perception of P. It works something like this: M is monitoring P, Z creates side effects whose origin can be traced to P, M attributes the effects of Z to P, M updates the score of its perception of P. The point of Z is that its secretly has the same decision process as M without anyone knowing, so it has its own idea of what M's score for P is and can 'control' the score for P indirectly. M effectively just uses the score that Z tricks it into computing. Because Z knows how M works it never has to interact with M, it only needs to know what P is doing and generate proper effects to get the proper score (I suppose that means Z is dependent on P. The other possibility is that Z never interacts with P but instead gets the perception of P from M, so Z would be dependent on M. Or..... The dependencies are getting complicated, and it seems to parallel DIP less than I thought. I'll have to delve more into this.)

Also, no one knows that Z is working on behalf of P. A casual observer would believe M is monitoring P and in control of perception. But really there is a hidden Z that is controlling M's perception of P through tricky manipulations.

The claim of orthogonalization between P and M is because P no longer has to worry about M's perception and can forget M even exists, and M's perception of P is no longer affected by the behavior of P. Z purely determines M's perception of P.

I will try to come up with a diagram and a concrete example because it is not easy to reason about.

Regardless of the particular details, the big goal here is to remove (behavioral?) dependencies between P and M by influencing M's decision context and come up with a phrase that describes it.

  • 2
    This question is IMHO a little bit hard to read because it is very abstract, a more concrete example of what P and M might look like would make it easier to understand. Also, your defintion of orthogonality sounds strange to me. I would call two components "orthogonal" when they don't influence each other. When I understand your case correctly, introducing a component "Z" does exactly the opposite - it makes P reacting to the output of M. Can you please clarify this? – Doc Brown Jan 21 at 6:44
  • 1
    Sorry, I was under the impression you had a real system in mind, holding back details for reasons of confidentiality But since it seems to be a purely speculative "thought experiment ", I am now convinced this is the kind of question which cannot be answered sensibly because it lacks way-too-much realistic context. – Doc Brown Jan 22 at 6:21
  • Well, to be honest there is a real system where Z is an experimental component. I just have to come up with a different example to be concrete because the real thing is way too complex and as you said "confidential". – vergilvsyn Jan 22 at 6:35

Dependency inversion.

No, DI is not an instance of "orthogonalization" that you're describing. DI has no business in knowing what components do or what are their functional/semantical relations. The scope of DI is clearly defined: once component receives reference to it's dependency, DI's job is done.


When using some term as an analogy, it must retain most relevant properties, in this case:

  1. Orthogonalized features must be uncorrelated. That is, "movement" along one feature must not cause "movement" along another feature.

  2. Orthogonalized features may be used to fully project contents of the original subspace without a loss of the details.

Following this definition, one example I can give is taking two components and refactoring common behavior (such as logging to same log file) into another facility. This way, original functionality is fully retained, and no component encapsulates same effect (a file write).

In other words, (in the domain of software design) orthogonalization is just a synonym for separation of concerns.


In the first example, the interface Z add nothing useful to the system in regards to the dependency management. Changes in the implementations of X and Y must already be uncorrelated. On other hand, changes in Y's interface (the parts that X actually uses) must propagate to X, that's only natural considering dependency relation; introducing Z can not prevent that.

Now, your definition of interface may disagree with mainstream OOP languages. If that's the case, you may be looking for a facade. But then again, if Z is added for sake of hiding dependency between X and Y, then there is no value added, that's just moving the problem from the left pocket to the right pocket, while introducing more code and complexity.

Opposing controller.

In the second example, Z is not used to separate behaviors. Rather, Z is countering or complementing P's behavior. I would call Z an "adversarial controller" or an "{effect name} governor", but only because there is clear intent of countering some other feature. Overall I don't think introducing new term here is more useful than just naming features descriptively.

So what it is?

The two examples of "orthogonalization" that you provided seem unrelated to me, and grouping them together only makes things more confusing. My answer remains inconclusive.

Note the way you describe relationships between Z, P and M — with effects and observations — aligns well with the control theory. Perhaps it's domain will provide better framework for your goals.


M cannot "know" P and that is the point. M can only observe the behavior of P which it must regard as a black box. Its "perceptions" are the only thing that it is allowed to know and to react to.

  • Correct. The edit has some more details. The idea is that M owns it's perception of P but P (or whoever controls P) may not like the score. Z is introduced to manipulate M's perception. P can ignore M. P believes its score is dependent on it's perception of P, but the reality is that M's perception is controlled by Z, so P's behavior has no effect on M's decision. – vergilvsyn Jan 22 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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