Software design patterns are concepts that are commonly used in code that has been abstracted away from the code itself, into tested proven development paradigms. These ideas can't be directly translated to code, it is more of a description or template on how to write the code. Design patterns are commonly created to help mitigate the risk of subtle bugs that can be created in the code from not handling a situation properly.
One such design pattern is Factory Methods. Factory methods are definition (class) level methods that create instances of the class they are defined in. They let subclasses override the function and provide new implementations of the type returned by the Factory Method. It can also be used to manage a pool of objects, as well as specific initializations that cannot be done in a constructor.
No comments:
Post a Comment