What is the difference between a GRASP information expert and GRASP cohesion?

Both concepts are very similar, it is difficult to say what they are.

Please provide an example of how you might differentiate between them.

+3


source to share


2 answers


All GRASP concepts are related, so you should consider them all together:



You don't have to learn these concepts without coding practice, write code / refactor - and you get it.

+3


source


GRASP Design Patterns, as rightly stated here ( Is the GRASP Information Expert and MVC's Modell the same? ) Are design principles and support you in evaluating your design decisions and implementation.

"Cohesion" in GRASP is a design evaluation scheme along with "linkage". As such, you should use them to analyze your design to find out how coherent and loosely related it is, which directly increases reusability and extensibility.

On the other hand, the Information Expert can help you determine which class should be responsible for a particular responsibility. It tells you to assign a specific responsibility to the class that has the most information about it . |

So in the simple case for shopping in the cart, you have to give A ShoppingItem to calculate the ItemPrice () based on the quantity and unit price, and ShoppingCart to calculate the TotalPrice ().



This becomes a deciding factor and notes that most GOF design patterns actually support this GRASP concept.

The most important thing. If you've applied the Information Expert template to your design, it should provide you with a high degree of consistency in terms of judging your design. The way Information Expert and Cohesion will go hand in hand like all other GRASP templates.

Resources: http://www.cs.bgu.ac.il/~oosd051/uploads/stuff/ApplyingUMLandPatterns.pdf

0


source







All Articles