Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Structural Design Pattern and Behavioral Design Pattern? [closed]

I was reading on the design patterns basics and came across the two basic definition of Structural Patterns and Behavioral Pattern which is like:

Structural Design Patterns:Generally deal with relationships between entities, making it easier for these entities to work together.

Behavioral Design Patterns:Used in communications between entities and make it easier and more flexible for these entities to communicate.

reading it, I cannot differentiate between them, can someone guide me how they are different, by giving some simplest example?

like image 992
OM The Eternity Avatar asked Nov 20 '12 12:11

OM The Eternity


People also ask

What is a structural design pattern?

In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships among entities. Examples of Structural Patterns include: Adapter pattern: 'adapts' one interface for a class into one that a client expects.

Which is the behavioral design pattern?

In software engineering, behavioral design patterns are design patterns that identify common communication patterns among objects. By doing so, these patterns increase flexibility in carrying out communication.

What are different structural patterns?

Types of structural design patternsAdapting an interface into another according to client expectation. Separating abstraction (interface) from implementation. Allowing clients to operate on hierarchy of objects. Adding functionality to an object dynamically.


1 Answers

Best way to explain would be to take two examples from two categories.

Composite from Structural patterns defines a tree like structure, so focuses on the relationship. One to many and has a type of relationships so that whole and part can be treated alike.

Observer pattern on the other hand from Behavioral design patterns focus on communication. How do we let the interested parties know any changes to the object. Sort of publisher to subscriber. Does not define a strict structure, but forces on implementing methods, i.e. channels of communications.

Hope it's useful.

like image 82
xelber Avatar answered Sep 29 '22 18:09

xelber