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.
41 questions
1
vote
1
answer
73
views
Python3 tokenizer abstract baseclass ( Without the permission to be instantiated directly )
I'm a newbie python developer, and fortunately I have been introduced to the principle of abstract base classes and they seemed pretty interesting to tackle while going forward in my Python journey.
I'...
1
vote
1
answer
111
views
Take meal orders from breakfast, lunch and dinner menus
I have an exercise requires me to write a service to management menu.
The requirement like this:
Food menu includes: breakfast menu, lunch menu, dinner menu. The three menu haves list menu item( name, ...
4
votes
2
answers
147
views
Abstract Factory Implementation C#
I'm learning Factory pattern and I've implemented this simple example of an abstract factory. I've followed this video a little bit while writing this small example. Is there anything anti-pattern or ...
1
vote
1
answer
455
views
Helper functions for use with std::variant without an actual object
Sometimes, you want to an type of a particular index in an std::variant, and do something with that type without having an actual object. An example use-case would be de-serialization. What do you ...
3
votes
3
answers
281
views
A refactored payment service, handling several payment schemes
I was asked to refactor a class, to make it adhere to SOLID principles, with testability and readability. I thought I had done a decent job, only my feedback was:
a) Unnecessary introduction of ...
0
votes
0
answers
443
views
Caching wrapper with multi-providers and factory to detect the responsible cache provider related to Type
What I'm trying to do
abstract the caching actual cache provider (memory || distributed || ...).
enable a caching diversity. each cached item type has different ...
3
votes
1
answer
1k
views
Abstract Factory in C++
I have tried my hand at the abstract factory pattern in C++:
...
1
vote
2
answers
1k
views
Using Factory Design Pattern in Rest Controller of Spring
I used factory design pattern to identify the service according to the enum that comes from the api uri as request param. Everything seems okay according to me but cannot be sure if I used it right.
<...
0
votes
1
answer
959
views
The Abstract Factory design pattern as a Database Operations program
File - DatabaseOperations.h
This file contain classes representing database operations for three different types of databases (relational, document based and graph based) like establishing connections,...
0
votes
2
answers
772
views
Factory / Builder Design Pattern in Python
Situation: I have implemented a factory design pattern in Python as below. There are different screens which have different configurations. One can register the screen in the factory and get the ...
0
votes
1
answer
269
views
Best practice for factory pattern in c++?
I'm implementing a simple data reader to get image sequences from either a pre-recorded video file (In my case ROS bag file), or a camera device (In my case Intel Realsense). Basically I intend for ...
3
votes
1
answer
316
views
Abstract Factory Pattern in Python
I have been reading today about the Abstract Factory Pattern, and tried to make the following implementation.
I have seen a lot of implementations in the internet, where they use ...
2
votes
0
answers
266
views
Swift Struct-based Factory Pattern
Edit: I added another configuration vector to CardView, a size attribute, which may be .small or ...
32
votes
5
answers
5k
views
Chess game for my students
I teach programming, and I currently teach my class about inheritance, abstract classes, and mixins.
I wrote this code as an example, and I want to be sure it is as good as possible before I release ...
3
votes
1
answer
861
views
Building an email generator using abstract factory pattern
I'm trying to build a customer email generator in java using the abstract factory pattern. I understand how to use the factory method pattern; however, I'm a bit confused about the abstract factory ...
-3
votes
1
answer
52
views
Some way to create factory pattern for spring application [closed]
I created this code
...
2
votes
0
answers
830
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
...
1
vote
1
answer
163
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 : ...
0
votes
1
answer
2k
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 ...
1
vote
1
answer
77
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
1
answer
816
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 ...
2
votes
0
answers
72
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
1
answer
333
views
Deserializing a customly formatted string
The component receives a serialized message as a string and a serialized schema as a string. The ...
2
votes
1
answer
604
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 ...
4
votes
2
answers
5k
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?
...
5
votes
1
answer
1k
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 ...
1
vote
1
answer
100
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
1
answer
141
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?
...
2
votes
2
answers
975
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 ...
3
votes
1
answer
131
views
Design Pattern - Abstract Factory Pattern Implementation in PHP
Products Class that are like
Table, Chair, etc.
Please review it and give your thoughts and let me know if there are any rooms for improvement.
Products.php
...
1
vote
2
answers
160
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 ...
5
votes
1
answer
1k
views
Object factory from interface types
I have a library that defines a bunch of ISprite interfaces, like IPieceSprite and ...
7
votes
2
answers
582
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).
...
3
votes
1
answer
1k
views
Event Aggregator Pattern Decoupling
I have an Android application that is using an EventBus architecture with publishing and subscribing events. Usually this is ...
2
votes
1
answer
554
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
1
answer
428
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 ...
3
votes
2
answers
15k
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 ...
8
votes
1
answer
11k
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:
...
3
votes
2
answers
984
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.
...
9
votes
3
answers
14k
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
2
answers
771
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 ...