Abstract factory design pattern c

broken image
broken image

We can see that here, an instance of a TRex is just new-ed up in the body of the code, so this class will always make a TRex noise. So, if we start with this SingleDinosaurNoiseProducer class which makes a dinosaur noise: public class SingleDinosaurNoiseProducer : IDinosaurNoiseProducer The two that I am going to focus on in this blog are the factory method and abstract factory design patterns. they are an attempt to stamp out the use of the 'new' keyword, which couples classes together, and violates the Open-Closed principle. So I thought I'd write a (heavily dinosaur based) blog series, running through the main design patterns used in C#, starting (where I think makes the most sense) with the creational design patterns!Ĭreational design patterns are those which abstract away the creation of new objects.

broken image

This means that code which uses these patterns is often more extensible, robust and testable. A large part of my reading (& Pluralsight course-ing) has been based around design patterns, and how the application of these patterns can help bring your code in line with the SOLID principles. I've been focusing lately on code quality, refactoring and architecture. By Carmel Eve Software Engineer I 16th May 2019

broken image