![]() ![]() In real life, you are going to be concerned that your vehicle has all the options you selected, which is indicated by the printed details page. ![]() Both samples produce the same result, but the sample on the left has more code, and many more details. At the end of your order, you expect a summary of the details you chose. You can add power windows, power locks, heating, air conditioning, leather seats, and maybe even a sun roof. In this day and age, just about every vehicle manufacturer allows you to go online and customize a vehicle for purchase. The sample models a real life situation where you might build and purchase a vehicle online. Below is a demonstration of two methods the left uses only abstract classes, while the right uses abstract classes in addition to the abstract factory pattern. ![]() While instantiating simple types can be done with minimal code, some types may require complex instantiation that involves one or more dependencies, or a significant number of lines of code, or both. The pattern extends those benefits by allowing you to abstract away how those types are instantiated. Using the design pattern extends upon the already existing benefits of abstract classes, which allow you to work with a family of objects in their abstract form, disregarding their specific concrete types. Namespace danderson.io.DesignPatterns.AbstractFactory ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |