Questions tagged [abstract-factory]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
45 views

Designing a proof mechanism

DataModel contains a Proof that contains all the information of its integrity along with the method with which the Proof should be verified. In this case I designed a JWS type of proof that can be ...
0
votes
2answers
101 views

Is my analogy of an Abstract Factory valid?

After working through several tutorials and reading various responses on this site, I believe the Abstract Factory pattern would work well for a current project. I am seeking the opinions of those ...
0
votes
2answers
168 views

Overkill to apply abstract factory pattern for a single object creation?

I need to vary the object creation at (*). public class Parser { // Problem code public List<FileOption> methodA() { // Does something ... fileOptions....
2
votes
1answer
288 views

Cross-cutting concerns and dependency injection

I've got a web application with an architecture somewhat like a front-controller MVC design. I get HTTP requests, route them, run them through a filter layer, dispatch them to my domain classes which ...
1
vote
1answer
57 views

General question on Pairing of Abstract Factory with Bridge

I am trying to get myself familiarized with the design patterns and I am reading through this line on the relationships between different patterns. I cannot get my head around this one though, You ...
3
votes
4answers
263 views

Factories and static methods

So almost every post I read about oop by purists, they keep stressing about how using static methods is anti pattern and breaks the testability of the code. On the other hand every time I look for ...
1
vote
1answer
79 views

Can this simple Bank example be considered as a valid Abstract Factory?

For teaching purposes, I'm trying to replicate in a more faithful way from this conceptual UML (from wikipedia): In a "so-so" real world example, in my case, families of Loans and Insurances: So, ...
3
votes
2answers
242 views

Abstract Factory: Can Client Class have an aggregation with the Factory?

After searching for some Abstract Factory examples using modern programming languages, I have some dillemas about the sensu lato of conceptual UML schema of Abstract, more specificly about the Client (...
4
votes
8answers
3k views

What's the benefits to use an abstract factory when using interfaces is already suffice?

I get the idea of the factory pattern, but I feel that it is really not necessary to use this pattern. For example, below is some code I saw (C#) that use factory method: public interface IAnimal { ...
4
votes
4answers
246 views

How to get a decoupled design without injecting repositories inside entities

I am facing the following situation: I have to develop a system that has to calculate the price of a car so i need to calculate the prices of all the Pieces that make up the car and then total them. ...
0
votes
1answer
137 views

What does related or dependent mean here?

In Elements of Reusable Object Oriented software by Erich Gamma and friends, the intent for Abstract Factory Pattern says: Provide an interface for creating families of related or dependent objects ...
3
votes
2answers
441 views

What is abstract about the Abstract Factory?

I've been always wondering why the Abstract Factory Pattern is actually called abstract? I don't understand what is abstract about it? It somehow does not fit in the image of abstract classes that I ...
4
votes
0answers
173 views

Best design pattern/approach for a Factory which needs multiple types of input

I want to develop a Factory of INotifications. public interface INotification { string Text { get; } string UserId { get; } NotificationType NotificationType { get; } } The problem is, ...
2
votes
3answers
440 views

Abstract Factory configuration differences

is a simple abstract factory. I know abstract factory is for selecting a product family. But my question is, can we still use this pattern if ConcreteFactory1 needs to createProductC() but ...
2
votes
1answer
2k views

How to avoid the static_cast/dynamic_cast in `Abstract Factory` design pattern?

We are using Abstract Factory design pattern in our project, as the project became complex, most of the time the concrete class functionality need to separate to multiple class. As the following code ...
0
votes
1answer
296 views

Convenience vs Decoupling/Composition

Let's say I have a small CD burning library written in Python, with a CD class and a Burner interface + implementation classes: # Module cd.py class CD: def __init__(self): self.folders = [] ...
1
vote
1answer
520 views

Abstract factory design pattern

I need help with an abstract factory pattern design.I have and calculation engine which calculates for different channels like captive, captiveTemplate or Headquarter and in the future different ...
0
votes
4answers
1k views

In which way does the factory pattern decouple classes dependency?

I understand that the main code uses the factory to return an abstract pointer of the object desired, but it doesn't change the heritability of classes. Can you explain in which context does the ...
1
vote
1answer
222 views

C# - How can I ensure a member is invoked without needing to call it and rely on the { get; }

I'm using reflection as a way of implementing a factory pattern: Type type = GetProviderType(vendor); ConstructorInfo constructorInfo = type.GetConstructor(new Type[] { typeof(...
2
votes
1answer
123 views

How to keep IDs in sync when using Factory?

abstract class Product { public abstract Product createProduct(); ... } class OneProduct extends Product { ... static { ProductFactory.instance().registerProduct("ID1", new OneProduct(...
2
votes
2answers
810 views

Can a single Factory be used to create similar in purpose, but different in focus objects?

I am concerned about whether or not I am using FactoryMethod correctly. Background: I am refactoring legacy code and I have identified a pattern: there is a God Object that is created in memory,...
0
votes
1answer
233 views

Abstract Factories Nesting and DI - Is this acceptable?

I am still trying to get some experience with DI. Let me illustrate my situation and you can give me advice on whether I am using DI and Abstract Factory correctly. I need to create IModels at ...
3
votes
1answer
766 views

Merits of DI, Abstract Factory implementation review

I'm writing a brand new system and trying to stay true to the SOLID principles, specifically Interfacing and Dependency Injection. We are sticking closely to the Microsoft stack so we are using C# ...
3
votes
3answers
1k views

Pattern to use (if any) to co-ordinate loosely coupled classes with strong interdependencies

I have a collection of cooperative classes whose behaviors are interdependent upon one another. But I wish to keep them loosely coupled, so I've created appropriate interfaces. I want to determine an ...
1
vote
1answer
259 views

Making more than one instance of factory that is supposed to be singleton

However, there are some classes that should have only one instance. Sometimes they are factories, which you can use to create the other objects in the system. If more than one factory exist, ...
3
votes
2answers
307 views

Is there a Factory Pattern distinct from Abstract Factory and Factory Method?

During a recent phone screen I was asked to describe the "Factory Pattern". I asked if the screener meant "Factory Method" or "Abstract Factory". He said, "No, just the Factory Pattern". I don't know ...
3
votes
1answer
2k views

Should Uncle Bob's example be refactored to an AbstractFactory or a SimpleFactory?

In the book "Clean Code" Robert Martin makes a statement regarding the following code: public Money calculatePay(Employee e) throws InvalidEmployeeType { switch (e.type) { case COMMISSIONED: ...