Information Expert

Problem definition

Information Expert is a principle used to determine where to delegate responsibilities. These responsibilities include methods, computed fields and so on. Using the principle of Information Expert a general approach to assigning responsibilities is to look at a given responsibility, determine the information needed to fulfil it, and then determine where that information is stored. Information Expert will lead to placing the responsibility on the class with the most information required to fulfil it.

Analysis

Information Expert is a basic principle of delegating responsibilities in object oriented development. Main idea is very simple and intuitive – objects do only those operations which are connected with contained by them informations. Result of using this principle are solutions in which objects do those operations which in real world normally do somebody on representing by them real objects. This pattern is also analogy to the real world – it’s quite natural that responsibilities are delegated to the peoples who have appropriate knowledge.

Contraindication

In some situations the solution resulting from Information Expert principle is not the best one because of problems with coupling and cohesion. What is more, we have to be careful about not breaking layer separation principle. What object should write class A to the database? The most of information contains class A itself so Information Expert says us that the class A should be responsible for writing itself to database. But this new responsibilities would decrease cohesion and break layer separation rule.

Advantages

The rule of encapsulation is fulfilled – the objects do operations on the basis of contained informations. This usually will follow to the decreasing the number of connections between objects and decreasing of coupling. What is more, different behaviours of the sstem are assigned to the diffrent classes. Thanks to that we usually get objects with higher cohesion.

Connected Patterns

Follow

Get every new post delivered to your Inbox.