Two-Stage Object Creation pattern separates initializers from the way memory is allocated to objects. This pattern provides the developer with the flexibility to initialize objects based on how they are going to be used. Therefore, different behaviors in classes can be taken advantage of with no extra amount of code. This is specifically useful when using temporary objects, which in this way, can be instantiated and immediately used without any further setup. Finally, when creating a subclass, it will not be necessary to override so many initializer methods.
No comments:
Post a Comment