factory-method Questions
5
Solved
Java 9 offers Map.of() feature to easily create a map with fixed values.
Problem: I want to create a map that preserves order of insertion like LinkedHashMap. Is that possible with that factory? A...
Stalder asked 10/9, 2018 at 9:17
9
I was reading design patterns from a website
There I read about Factory, Factory method and Abstract factory but they are so confusing, am not clear on the definition. According to definitions
Fac...
Iolaiolande asked 23/10, 2012 at 11:16
17
When is it a good idea to use factory methods within an object instead of a Factory class?
Depart asked 16/9, 2008 at 6:38
4
Solved
Here's my code. When compiling I get the error
invalid declarator before ‘geometry’
at line 16 and line 48, I am not sure what I am doing wrong. Please advise.
#include <iostream>
#inc...
Baer asked 11/12, 2019 at 12:7
21
Solved
I know there are many posts out there about the differences between these two patterns, but there are a few things that I cannot find.
From what I have been reading, I see that the factory method ...
Dacia asked 21/4, 2011 at 4:41
3
I just can't seem to wrap my brain around this situation in Autofac:
My business logic needs an object of type IFinal.
The implementing class Final has several dependencies that are not known by ...
Disincentive asked 1/4, 2018 at 5:50
3
Solved
I understand that a factory method is a class method that utilises the self keyword and instantiates an object of it's own class. I don't understand how this is useful or how it can extend the func...
Furrier asked 21/5, 2016 at 14:54
2
Solved
In my factory method I use Switch statement to create concrete objects. This results in very high cyclomatic complexity. Here is a sample code:
private static UnitDescriptor createUnitDescriptor(s...
Cindy asked 23/8, 2013 at 8:35
8
Solved
According to the book:
The essence of the Factory Pattern is to "Define an interface for
creating an object, but let the subclasses decide which class to
instantiate. The Factory method lets a...
Bobbysoxer asked 19/9, 2011 at 8:19
11
Solved
There's this one thing in C++ which has been making me feel uncomfortable for quite a long time, because I honestly don't know how to do it, even though it sounds simple:
How do I implement Factor...
Kulturkampf asked 25/2, 2011 at 17:52
27
Solved
What is the difference between the Builder design pattern and the Factory design pattern?
Which one is more advantageous and why ?
How do I represent my findings as a graph if I want to t...
Revocation asked 16/4, 2009 at 19:39
2
Solved
I want to build some kind of FactoryFactory: Basically a generic function that returns a factory function. Writing the function itself is simple, but I can't figure out how to do the TypeScript typ...
Mall asked 10/8, 2020 at 13:17
2
Solved
GOF talks about frameworks for "Factory method" pattern. Frameworks need objects but implementation of objects depends upon application hence an abstract method to create the object is created. Als...
Autoplasty asked 1/4, 2019 at 18:38
2
Solved
Preface - I have looked at similar posts to this one on SO, but the answers did not seem applicable.
I have an abstract class with the following method (simplified):
playAnimation() {
let anima...
Greyson asked 16/8, 2018 at 23:59
1
Solved
I had a controller with 4 very similar methods, calling an API on a remote server to perform different actions on different types of users. What changed between these API calls are just the endpoin...
Conferva asked 10/1, 2019 at 17:50
3
Solved
Simple factory:
Factory method:
hey everyone. I am looking for the difference between simple factory and factory method.. I know the structural difference(images above), but I cant understand ...
Criticize asked 19/11, 2018 at 10:4
10
Solved
Note: Questions are at the end of the post.
I have read the other stackoverflow threads regarding Abstract Factory vs Factory Method. I understand the intent of each pattern. However, I am not cle...
Salute asked 17/11, 2010 at 22:25
14
Solved
What's a "static factory" method?
Gel asked 30/5, 2009 at 4:46
1
I am trying to create a subclass of URLSession in Swift (reason does not matter, but has to do with testing). I need it to work with a delegate and a specific URLSessionConfiguration, which is a re...
Apprehensive asked 8/1, 2018 at 21:42
2
Solved
Before writing the question I read the following references:
Factory Method Vs Abstract Factory
Abstract Factory vs Factory Method (scope)
Abstract Factory, Factory Method, Builder
Factory, Abstr...
Lakin asked 23/9, 2017 at 21:17
5
Solved
I've implemented a Vehicle service that is responsible for servicing vehicles such as cars and trucks:
public interface IVehicleService
{
void ServiceVehicle(Vehicle vehicle);
}
public class Ca...
Polyhymnia asked 30/10, 2017 at 17:12
3
Solved
From GOF book:
Class patterns deal with relationships between classes and their subclasses. These relationships are established through inheritance,
so they are static-fixed at compile-time. Ob...
Araminta asked 4/9, 2017 at 16:48
19
Solved
Factory and Abstract Factory are both creational patterns.
What is the difference in case of intent and application between these two Patterns?
Goodyear asked 16/6, 2009 at 14:14
5
I'm new to OOP and learning design patterns so I wrote some simple code to try out a Factory Method, and all seems well, except when I want to add another sub-type. Here's the code so far:
public ...
Sign asked 20/1, 2017 at 16:26
2
Solved
Why LocalDate, LocalTime, Stream, etc. objects use a factory method of() instead of a constructor?
I found an explanation of why a factory methods should be used instead of new here. This answer g...
Kaikaia asked 17/7, 2016 at 18:3
1 Next >
© 2022 - 2024 — McMap. All rights reserved.