2. Structural design patterns are used to make it easier on the developer by identifying how the classes and objects relate together to form larger types of structures. These types of design patterns have been used and tested thousands and thousands of times. There are seven types of structural design patterns, each one focuses on inherited classes and how they are composed from one another. Imagine if you had to get from point A to point B in a certain amount of time, this would be the amount of time that you would have to create a program. Do you take the interstate and get their quicker? Or do you take the local roads with traffic congestion and lights and arrive at a later time? Knowing that the interstate would get you there quicker would be like using existing design patterns to complete the job. If you decide to take the local roads with traffic would be like creating the design patterns from scratch. Each one may give you the finished product but the existing design patterns that have been tested over and over again will get you there much quicker with greater accuracy. The more practice you have with any type of programming language will enable you to learn the common problems and then find the best solutions. So a Jr. Developer may not need to know all the ins and outs but they will need to know when and how to use design patterns to their advantage.
For this week I am choosing the Flyweight Pattern for my assignment. Out of the seven design patterns, the idea of reusing already existing objects intrigued me the most. One of the main advantages of flyweight patterns are reducing the amount of objects and the amount of memory that is needed to store them.
Here are some questions that I found about Flyweight Patterns in Chapter 6, see if you can provide an answer.
- What are the three stages that are applied when using the flyweight pattern?
- When is the best time to use the flyweight pattern?
- Are flyweight patterns applied by deconstructing the existing class?