Questions tagged [abstract-factory]

The tag has no usage guidance.

0
votes
0answers
10 views

Is it good or common practice to have base fragments when developing android mobile application?

I'm creating a mobile app for a software design unit that I'm taking. Since I had multiple activities with similar layouts for the fragments(all implements recycler view) I created an abstract base ...
3
votes
4answers
222 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
116 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
286 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 ...
2
votes
0answers
64 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
381 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 ...
1
vote
1answer
893 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
223 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
418 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
815 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
186 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
111 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
672 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
140 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
443 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# ...
2
votes
3answers
990 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
233 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
245 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: ...