Questions tagged [abstract-factory]

The abstract factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes.

Filter by
Sorted by
Tagged with
8
votes
1answer
10k views

Abstract Factory Pattern C# Example

I am working through more tutorials on Design Patterns and came across the Abstract Factory Pattern. I extended it out a bit (the example that is) and want your opinion: ...
7
votes
2answers
571 views

Java - Something similar to Abstract Factory?

I have many repositories stored in a map. User chooses some of them and then a downloading begins. Repository may be one of 4 types (see code below). ...
7
votes
3answers
11k views

Raising error if method not overridden by sub-class

Background I have a base (only 2 classes inherit from it, and only from it) abstract (meaning I don't want it to be used directly) class that implements some common functionality. Some of it depends ...
7
votes
2answers
762 views

Factory for mathematics Q&A

I'm having a hard time creating a design (due to my lack of experience). I need a little of help to create the Model. It's a mathematics system. I've created an ...
5
votes
1answer
584 views

Object factory from interface types

I have a library that defines a bunch of ISprite interfaces, like IPieceSprite and ...
5
votes
1answer
917 views

Initializing characters in a visual novel game

I am making a visual novel game and I was wondering is there a better way of setting character attributes and initializing than the way that I have done down below. As you can see I did an abstract ...
3
votes
2answers
950 views

Abstract factory pattern implemented in Java

I need a code review on my Abstract Factory pattern written in Java. Find the two enums AnimalType.java and DietType.java below. ...
3
votes
1answer
829 views

Event Aggregator Pattern Decoupling

I have an Android application that is using an EventBus architecture with publishing and subscribing events. Usually this is ...
3
votes
2answers
14k views

Implementing DAO Factory

I'm trying to do three different type of DAOs with 4 subtypes of each. I have RAM, SQL and Serial with each one have four subtypes. Is a singleton necessary with my implementation within the factory ...
3
votes
2answers
2k views

Abstract factory using generics

I am learning design patterns and I have implemented the abstract factory using generics C#.NET. Is this implementation correct or not? Or is there any SOLID principle violation? ...
2
votes
2answers
797 views

Implementation of Abstract Factory pattern with different vendors for product

I am studying about design principles and design patterns. I have implemented an Abstract factory pattern as per my understanding. The scenario I have considered is as follows : There is an ...
2
votes
1answer
498 views

Abstract Factory Design Pattern

I have tried to implement the abstract factory design pattern. This is a complicated pattern. Can you review? My understanding of the pattern is: the objects to be constructed have two or more member ...
2
votes
1answer
510 views

Game engine ObjectFactory class

I've developed as part of a game engine a template class for a factory which manages objects of one specific type. The factory handles initialization, destruction, and accessing previously created ...
2
votes
1answer
387 views

Car store implementation using abstract factory

I'm studying design patterns and I made this car store implementation. Although I'm confident that the idea is right, I'm not confident that the implementation is good. I would like you to check it ...
2
votes
0answers
51 views

PDcurses clock using abstract factory design

I am currently learning how to use PDcurses and decided to make a clock with it. **NOTE: this Watch that uses the abstract factory design pattern is not the same as this question!!. This question is a ...
1
vote
2answers
137 views

Derived methods with Poker classes

I have an interface with two functions. This interface is being inherited by an abstract class which implements just one of those functions. The other one is left to be implemented by the derived ...
1
vote
1answer
119 views

Combat game - character factory

I decided to improve my OOP design knowledge and learn python at the same time so I started to write a simple program which will be a fight "simulator". For now, there are only 2 character types : ...
1
vote
1answer
279 views

Deserializing a customly formatted string

The component receives a serialized message as a string and a serialized schema as a string. The ...
1
vote
1answer
87 views

Abstract Factory Pattern in Java

I reproduced my version of Abstract Factory Pattern in Java. I know it's redundant but can I get critical comments about my code. Is it really the classic implementation of the pattern or not? ...
1
vote
0answers
25 views

Factory module to convert DOM / ORM data structures

The following code is part of a real estate data processing API. It is being invoked by several modules of a software that translates real estate data in-between different formats (ORM models, DOMs, ...
1
vote
0answers
221 views

Abstract Factory Design Pattern implementation in C++ using Qt Creator

I am trying to make all the creational design patterns and I'm having some trouble with the abstract factory method. I normally program in Python, however, I had heard C++ was good for really having ...
1
vote
1answer
125 views

Factory pattern for image or shape marker [closed]

I'm making a photo marker application and need to make a factory pattern for marker. I think it is not very flexible and overall not good. Would you check my code and suggest what could be improved? ...
0
votes
1answer
722 views

Mocking objects using abstract factory

For some time I am trying to make a mocking library for C# that mocks objects with just 1 line of code. I am using abstract factory pattern to know what is the object's type so that I can work with ...
0
votes
1answer
51 views

Abstract Factory Design Java

I am new to Design Pattern implementation and would like to strongly solidify my knowledge to become as good of a programmer as I can. Is this a proper implementation of the Abstract Factory design? ...
0
votes
1answer
411 views

Mock customer DAO using abstract factory pattern in React

I wanted to implement abstract factory method in typescript with react for sharepoint framework webpart. So I tried to translate ideas from this Java tutorial. I don't have method implementations ...
0
votes
0answers
218 views

Auto-registering CRTP Factory

I'm trying to write a policy based auto-registering class using the Curiously Recurring Template Pattern. I decided as design choice to not using registering macro. Factory Class ...
-2
votes
1answer
39 views