When is it worth NOT using a Factory?
I’m employing TDD quite a bit these days and really enjoying myself – everything seems to flow better and be naturally better constructed and organized. However, while writing a bit of IO code, utilizing System.IO.Stream
s, and I was wondering – when is it ever worth not using a factory? Because in Stream
s case, it certainly seems better to not use a factory.
When is it worth NOT using a Factory?
I’m employing TDD quite a bit these days and really enjoying myself – everything seems to flow better and be naturally better constructed and organized. However, while writing a bit of IO code, utilizing System.IO.Stream
s, and I was wondering – when is it ever worth not using a factory? Because in Stream
s case, it certainly seems better to not use a factory.
Does this factory method pattern example violate open-close?
In Head-First Design Patterns, they use a pizza shop example to demonstrate the factory method pattern.
Does this factory method pattern example violate open-close?
In Head-First Design Patterns, they use a pizza shop example to demonstrate the factory method pattern.
Why static members can’t be abstract and don’t implement polymorphism? [duplicate]
This question already has answers here: Why overriding a static method does not result in polymorphism in Java (3 answers) Closed 9 years ago. I’m a Java/C#/PHP developer, through my OOP programming experience I find myself asking the same question: Why static members can’t be abstract and don’t implement polymorphism especially in situations involving factory […]
How can one presenter be used for multiple views in MVP
I am using MVP for creating an android application, which takes data from server and sets to activity.
Why is entangling injectable with class that uses it a bad practice?
I have had this argument for a while, because I have noticed some people prefer “readable” code over properly structured one. So in the example I am showing, basically I have this Mapper
class in which different Mappable
instances are injected and the Mapper uses the instances to know how to map some data. The question here is, why is it a bad practice to do so. I suspect that the problems are: the method is static, the factory is in the wrong class, making the Mapper hard coupled to the Map
classes.
Client vs Creator in Factory Method and Abstract Factory patterns
This page descibes one important difference between Factory Method
and Abstract Factory
:
Event action abstraction and trigger control
I am thinking of abstracting Event action in order to make further alteration/implementation/maintenance easy since the project I am currently working on has volatile requirement. So I thought of the following concept.
I created an implementation of IEventAction which ex. handles closing of planning in my application, I made IEventAction extends IEventAction so I can manage all EventAction using a generic collection; and using a factory, I will get the appropriate event by passing the keypress key to the factory to resolve the correct event as shown in the code below.
Event action abstraction and trigger control
I am thinking of abstracting Event action in order to make further alteration/implementation/maintenance easy since the project I am currently working on has volatile requirement. So I thought of the following concept.
I created an implementation of IEventAction which ex. handles closing of planning in my application, I made IEventAction extends IEventAction so I can manage all EventAction using a generic collection; and using a factory, I will get the appropriate event by passing the keypress key to the factory to resolve the correct event as shown in the code below.