Classifications of design standards

Asked

Viewed 284 times

2

My college professor passed the following classification of design standards:

  • Creations: Abstract Factory; Builder; Factory Method; Prototype and Singleton.
  • Behavior: Bridge; Command; Flyweigth; Iterator; Observer; State; Strategy and Template Method.
  • Structural: Adapter; Chair of Responsability; Composite; Decorator; Facade; Interpreter; Mediator; Memento; Proxy and Visitor.

On the internet I found the following about the Gof patterns:

  • Authoring: Abstract Factory; Builder; Factory Method; Prototype and Singleton.
  • Behavioral: Chain of Responsibility; Command; Interpreter; Iterator; Mediator; Memento; Observer; State; Strategy; Template Method and Visitor.
  • Structural: Adapter; Bridge; Composite; Decorator; Façade; Flyweight and Proxy.

What is the correct one? If you look, some patterns that the teacher has passed are in one rating, and on the Internet are in another. My question is which of the two is correct.

  • You can remove your doubt (which I did not understand): https://answall.com/q/96452/64969

  • If you observe, some patterns that the teacher passed are in one classification, and on the internet are in another, my question is to know which of the two is correct

  • They may both be right. I think both are right, inclusive. (I will comment here only on the format of the question, comment on your doubt will require another comment as I am already exhausting the character limit). I could only observe that you put the internet find in counterpoint due to your comment, try to edit your question to make it better structured. On a good question formatting, my tip is: use plain text; letters, punctuation, hyphen, digits when talking numbers, quotes, $ to talk in quantities...

  • The thing is, I’m new to Patterns design and I was watching the Visitor, and the teacher’s slides said it was structural and the Internet says it’s behavioral, it’s scrambling my mind

  • ... Use paragraphs normally; for the paragraph to take effect, you need to leave a blank line between two text blocks. Each block of text is considered a paragraph. If you need to quote small part of code (not your case, just future tip), use the tick: "`". If you need to itemize or enumerate things (this already refers to what you want), use the Markdown notation for this: start a new block of text, use "-" (for item) or "1." (for enumeration) at the beginning of the line, give a space, place the item

  • About his doubt, this can be seen from another point of view. This view focuses on knowledge itself. If someone tells you that parallel lines always touch each other, is that person wrong? Not necessarily. If it is in the context of flat geometry, it could be speaking poetically of "meeting in infinity", but in spherical geometry all lines are parallel to each other and in every pair of lines they are in two diametrically opposite points; in hyperbolic geometry however this statement is totally false, nor its poetic version would be acceptable...

  • ... So, just as there are several geometries with several different characteristics, you have several theories on the same subject. Sometimes two theorists can be mutually exclusive, but the topic addressed is the same. Perhaps these differences are due to a simple interpretation of a guideline, perhaps because his teacher considered the truth "A" but Gof considered it "B"... but both even though contradictory views may be right

  • I just saw your comment now, I was finishing writing my "brief" comments and editing your question... Speaking of "editing your question", you had put indents and not strokes, you know the work that gave me to put trace in everything? I’m using a cell phone for this, so don’t even say it was just put on the "Notepad" and run a replace... Finally, my previous comments respond to what you wrote: different theorists on the same theory can contradict each other and both can be right. Try to find out what your teacher’s theorist was and what criteria he used there

  • 1

    Your teacher’s examples had some typos, such as "FlyWeigth" instead of "Flyweight" and also "Chair of Responstobility" instead of "Chain of Responsi". I left them the way they were, but I didn’t mention it in the answer because that’s not the purpose of the question.

Show 4 more comments

1 answer

4


The patterns in which there is divergence regarding the classification in your question are Bridge, Chain of Responsibility, Flyweight, Interpreter, Mediator, Memento and Visitor.

Let’s start with the easy ones:

  • Chain of Responsibility is intended to encapsulate sequences of behaviours. This pattern allows them to hang these behaviors on each other and still keep them isolated from each other, such as the links of a chain. How the focus is encapsulating behaviours, this is a behavioral pattern.

  • The idea of Flyweight is to reuse and share class states to reduce memory and processing consumption. That is, it is an optimization that should not have an impact on the behavior of objects. Therefore, this is a pattern structural.

  • The goal of Interpreter is to define how an expression can be interpreted. That is, to define what the demeanor of an expression. Therefore, this is a pattern behavioral.

  • Memento is a pattern that aims to provide demeanor to save and restore a saved copy without violating the encapsulation. Since the focus is to provide a behavior to an object, this is a pattern behavioral.

  • Visitor is a standard that aims to provide a type of polymorphism called double Dispatch, where the demeanor to be performed depends not only on the instance over which a method is called, but also on the type of parameter used in the call. As the focus here is the desired polymorphic behavior, this is a pattern behavioral.

Now the hard ones:

  • Bridge aims to provide two or more levels of implementation flexibility in a class hierarchy. I will take as an example that reply from Soen, but give a little change in the example to make it a little more real:

    Imagine you’re modeling geometric shapes that can have textures. With this, you can have an interface to a geometric shape with an implementation of circles, a rectangle and a triangle. However, to create an implementation of a striped triangle, a triangle with a gradient, a triangle with a single color, a rectangle with a stripe, a rectangle with a gradient, etc. would be an exaggeration. The solution is you define an interface to the texture and say that a geometric shape has a texture.

    The problem to be solved is to provide multiple hierarchies of behaviours distinct to a class, but the problem that this pattern seeks to solve is not how to give these behaviors to the class but how to organize it all. For this reason, this is a standard structural.

  • The Mediator aims to encapsulate the demeanor of two objects that should not be known directly (which is a question structural). The reason he’s being considered behavioral is because his idea is to encapsulate behaviours.

That is, the classification that you found on the internet is the correct one.

  • That is, the two references have their mistakes?

  • @Jeffersonquesado No. What he found on the internet is correct.

  • Strange, so I read something different from what was actually in the text, I will try to read with redoubled attention

  • 1

    @Jeffersonquesado I edited the question to make sure what I was reading, because the patterns were presented in different orders and it confused me a little, in order to delay the development of my answer in a few minutes. Still, I’m gonna reread it one more time to make sure there wasn’t any confusion.

  • the confusion was mine. The edition was great. I reviewed it and is in agreement with the previous status of the publication. And I believe that the previous state (my edition) was consistent with the original.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.