Category Archives: 11/13

Blog 9: Decorator Design Pattern Response

In today’s blog I’m going to talk about a blog that was written by Brian Ambielli who is a Senior Software Engineer and he wrote a blog talking about a topic that I have to do a project for called the Decorator Design Pattern. There are many design patterns for programmers, some that I learned this year were strategy, singleton and factory patterns which we used for our first two projects in the class. Anyways, Brian goes in depth about what the Decorator pattern is about and how it is used.

The Decorator Pattern allows you to give your objects new responsibilities at run time without making any code changes to their underlying classes. This pattern allows the user to extend objects with added functionality at run time and also gives the developers the power to compose objects that are purpose driven for current demands of their users. Brian says that Decorators can be thought of as wrappers around the object they are decorating, the object being decorated in these cases is the SuperType, then the decorated object can be passed and used in a program in place of the original wrapped object. Then he shows a diagram exampling what the Decorator pattern looks like and after explains what each of the parts of the diagram do to make it a Decorator Pattern which is really nice if you don’t understand it by looking at it. Then Brian provides a example with a Pizza shop talking about its toppings and different crusts and all the variables that are considered with a pizza, he then puts another diagram up showing how the decorator pattern would look with this example. Lastly, Brian provides some negatives of the Decorator Pattern and why it can be a pain to use sometimes.

This blog by Brian was very helpful, not only helpful because I didn’t know what the Decorator class was before this blog but that it is also the same topic I’m doing my project on for my college class, so now I have something to look at and use for my tutorial that I have to write for this class. Brian providing examples will also help me with this project as it helps me understand it better and makes it easier for me to make my own so I can get a good grade on the project. Besides this being helpful for my school work, Brian provided a lot of detail in his blog that could be helpful to anyone trying to learn about the Decorator patterns, him providing examples and telling people how the Decorator class exactly works and may help people decide to use this for their programs in the future. Brian didn’t just do the decorator patterns, Brian has blogs on all different types of patterns. The blog also providing what the negatives of this patterns are helpful for people like me who want to see what could go wrong with using this design pattern in future cases. Thank you for reading my blog post on the blog by Brian for the Decorator pattern, if you want to check out any of Brian’s blogs on any other patterns, I’ll leave a link at the bottom.

Source: http://www.bambielli.com/posts/2017-04-02-decorator/

From the blog CS@Worcester – Benderson's Blog by bendersonsblog and used with permission of the author. All other rights reserved by the author.