factory-pattern Questions
5
Solved
Consider the following simple factory example:
public class MyFactory : IMyFactory
{
public MyObject CreateObject()
{
return new MyObject();
}
}
In this example, MyObject implements the IDis...
Quarta asked 18/12, 2014 at 6:16
1
Solved
I am using ASP.NET Core, I know that such Logging mechanism is already provided by the framework, but using this to illustrate my problem.
I am using kind of Factory pattern to build the Logger cl...
Gadhelic asked 9/11, 2016 at 18:10
3
Solved
I have 1 interface:
public interface ISummary
{
int EventId {get; set;}
}
And many concrete classes that implement this interface:
public class EmployeeSummary : ISummary
{
public int EventId...
Sankaran asked 21/9, 2016 at 15:31
0
Suppose I write some plotting program. This program depends on a module that can draw graphics primitives. But that graphics module could be anything that supports the used operations. It could be ...
Darondarooge asked 30/7, 2016 at 7:34
3
This is related to creating and destroying objects from the book 'Effective Java' by Joshua Bloch
Item 1: Consider static factory methods instead of constructors
This method translates a boolean ...
Garrulous asked 25/7, 2016 at 7:16
2
Solved
I have this wcf method
Profile GetProfileInfo(string profileType, string profileName)
and a business rule:
if profileType is "A" read from database.
if profileType is "B" read from xml file.
...
Eternity asked 30/1, 2010 at 17:26
1
I am trying to figure out how to write a generic factory in XE2. Lets say I have this:
type
TObjectTypes = (otLogger, otEmail);
type
TLoggerTypes = (lFile, lConsole, lDatabase);
type
TEmailTy...
Adp asked 20/3, 2016 at 7:16
4
I have a factory method which returns implementation of an interface. The thing is - implementations have different constructor parameters.
My question is - how to pass parameters through factory ...
Arliearliene asked 11/1, 2016 at 16:26
1
Solved
I am reading Hodges book "More Coding in Delphi", section on Factory Pattern.
Trying to learn stuff. Broke down my code into small unit.
I use ReportMemoryLeaksOnShutDown := True; and fallowing cod...
Grafting asked 9/1, 2016 at 13:33
5
Solved
Maybe this is a simple question, because I'm still new to C++. I would like to use some kind of factory to encapsulate the logging in my application. The idea is that only the factory knews which c...
Refluent asked 21/12, 2015 at 13:59
2
Solved
Imagine I have a big CLI application with many different commands (think, for example image-magick).
I wanted to organize this application into modules and etc. So, there would be a master click....
Trefoil asked 14/4, 2015 at 15:30
4
Solved
I'm looking for a simple example of how to implement a factory class, but without the use of a Switch or an If-Then statement. All the examples I can find use one. For example, how could one modify...
Fania asked 23/11, 2015 at 18:40
2
Solved
I'm trying to create a bot for Telegram messenger while trying to learn OOP. I'm really lost on how to approach the problem. I have a Message entity, with all the getters and setters, this I think ...
Forfend asked 16/11, 2015 at 15:43
4
Solved
I have implemented a factory in my project and it was recently suggested that I use attributes on my classes so the factory can determine which class to instantiate and pass back. I am new to the w...
Wristwatch asked 8/12, 2010 at 12:47
6
Solved
I am familiar with these patterns but still don't know how to handle following situation:
public class CarFactory
{
public CarFactory(Dep1,Dep2,Dep3,Dep4,Dep5,Dep6)
{
}
public ICar CreateCar(...
Samos asked 11/8, 2015 at 19:31
2
Solved
In my application a few layers.
In this topic will focus on Domain and Infrastructure layers.
I have repository interface ClientRepositoryInterface in Domain layer.
And I have implementation of th...
Wulfe asked 21/7, 2015 at 0:14
3
Solved
This pattern uses an abstract factory, and then an implementation of the factory.
I am sure there is a standard naming convention for these two classes, but I don't know what it is.
For example:
...
Spreader asked 7/7, 2015 at 8:5
3
Solved
I have a factory object ChallengeManager to generate instances of a Challenge object for a game I'm building. There are many challenges. The constructors for each Challenge class derivation are dif...
Decibel asked 27/4, 2015 at 23:5
1
I understand that one of the main advantages of the Factory Method over Simple Factory is that it doesn't violate the Open-Closed SOLID Principle. That is, the former doesn't require modifying the ...
Bloem asked 17/2, 2015 at 17:52
1
Solved
I have an abstract class
template <class T> struct A { /* virtual methods */ };
and several concrete derived classes with various constructors
// The constructor of B takes 1 input
templa...
Cahoon asked 31/1, 2015 at 21:8
2
Solved
After ~10 months of procedural PHP, I'm now trying to wrap my head around basic OOP principles and design patterns. This is a hobby, and I haven't nearly as much time as I'd like to pursue it, so p...
Demineralize asked 18/1, 2011 at 1:58
1
I have used the standard factory pattern method before to create instances of classes (implementing a specific interface) using a Factory class, which has a "create" method, that returns the right ...
Chilopod asked 10/1, 2015 at 0:47
5
Solved
I just read Factory Method. I understand that it provides a way to delegate the instantiation to sub-classes. But I couldn't understand the possible uses in a real-world scenario.
Can anyone give ...
Scrivener asked 5/3, 2010 at 10:51
4
I have read the factory design pattern recently, in that he had mentioned one of the problem in normal approach is
*Need to use the new keyword in client classes.
So by using factory we have ach...
Overtop asked 22/12, 2014 at 7:24
1
Solved
Should a factory be responsible for finding models as well as creating them?
for example:
If i had a product model, should its factory have methods such as:
$product = $productFactory->findBy...
Cutthroat asked 7/12, 2014 at 23:30
© 2022 - 2024 — McMap. All rights reserved.