factory-pattern Questions

6

Solved

I have been reading about Factory pattern a lot lately. I am trying to figure out the best way to implement it. In the book C # Agile Principles patterns and practice the recommendation is to creat...
Hazardous asked 31/8, 2011 at 11:28

2

Solved

Since Python is a duck-typed language is writing factory classes meaningless in Python? http://en.wikipedia.org/wiki/Factory_method_pattern
Fredela asked 18/7, 2011 at 19:29

4

I have 2 cases wheter a method can be considered a Factory Design Pattern, this example is in C#, altought, can apply to other programming languages: enum NinjaTypes { Generic, Katanna, StarThr...
Silures asked 30/6, 2011 at 23:45

4

Solved

I've written myself a nice simple little domain model, with an object graph that looks like this: -- Customer -- Name : Name -- Account : CustomerAccount -- HomeAddress : PostalAddress -- Invo...
Hartmann asked 2/6, 2011 at 15:31

1

Solved

I'm trying to design a good entity creation system with an abstract factory (as per http://www.dofactory.com/Patterns/PatternAbstract.aspx) but I'm struggling when it comes to instance specific par...
Paradies asked 5/6, 2011 at 5:16

3

Solved

I don't believe I am implementing the factory pattern correctly because the Application class' createDocument method accepts any class type, not just subclasses of Document. In other words, is the...
Achromaticity asked 31/5, 2011 at 18:15

8

Solved

Is it really impossible to hide some classes in a jar file? I wanted not to allow direct instantiation of the classes to keep it more flexible. Only the factory (or a facade) should be visible of ...
Triolet asked 21/1, 2011 at 14:5

2

Solved

I'll attempt to shorten this code example: public interface IThing { //... Stuff } public class Thing1 : IThing { } public class Thing2 : IThing { } public interface IThingView<out T> ...
Fellner asked 26/5, 2011 at 17:38

2

Solved

I have always felt uncomfortable when dealing with classes that needed to instantiate a lot of objects since I've been using Dependency Injection principles. For instance, let's say I have a class...
Ced asked 24/5, 2011 at 11:59

1

Solved

I'm riffing from the information here: Metaclass not being called in subclasses My problem is that I'm unable to create an instance of an object using this class registry. If I use "regular" const...
Legalism asked 9/5, 2011 at 18:17

1

Solved

I have a situation where I would like to dynamically create an object through a factory object, but the object needs to be created through the spring context, to allow autowiring of dependencies. I...
Pentode asked 13/4, 2011 at 21:8

2

Solved

I'm trying to design a set of factory classes for our system, where some objects created by the factory also need to be initialized before they can be used properly. Example: $foobar = new Foobar...
Tisbe asked 30/3, 2011 at 13:24

3

Solved

It is a factory method if it returns an instance of a class but is it a factory method if it returns multiple (an array of) instances?
Urushiol asked 19/2, 2011 at 9:28

5

Solved

I am relatively new to "design patterns" as they are referred to in a formal sense. I've not been a professional for very long, so I'm pretty new to this. We've got a pure virtual interface base c...
Aoristic asked 14/2, 2011 at 12:46

7

Solved

I am trying to find a easy to extend way to create objects at runtime based on a static String class attribute, called NAME. How can I improve this code, which uses a simple if construct? public ...
Rosaceous asked 9/2, 2011 at 15:30

6

Solved

Does the C# factory pattern require an upcast? I want God in class library G to create an Adam in class library A without making G dependant on A. God produces Adams for consumption by Eve in clas...
Antisyphilitic asked 2/2, 2011 at 8:41

2

Solved

I am trying to create a function that is passed a parameter x and returns a new class C. C should be a subclass of a fixed base class A, with only one addition: a certain class attribute is added a...
Astrea asked 1/2, 2011 at 2:28

4

Solved

in C# you have to declare everything in a class so an example factory pattern could look like: namespace MySpace { public class CFactory { public static CFactory Current() { static CFactory si...
Unsettle asked 28/1, 2011 at 16:35

2

Solved

I have a Data Access Layer library that I would like to make "portable". The reason I like it to be portable is because I want to work with SQL Azure & Azure File Storage (eg, data + pdf report...

1

Which is a better approach, create child entities first, then pass to the aggregate root to add them, or have the aggregate root create them? For example: Order.AddOrderLine(new OrderLine(product,...
Wendt asked 24/1, 2011 at 19:50

6

Using php 5.2, I'm trying to use a factory to return a service to the controller. My request uri would be of the format www.mydomain.com/service/method/param1/param2/etc. My controller would then c...
Tobacconist asked 7/1, 2011 at 16:4

1

Solved

I'm trying to implement a Generic Repository. This is what I've got so far ... public interface IRepositoryFactory { IRepository<T> RepositoryOf<T>() where T : class; } public class ...

3

I have a very simple factory which takes an Enum as one of its parameters to determine the type of object that should be created, and a other parameter that's common to all the objects being create...
Pomerania asked 6/12, 2010 at 20:49

3

Solved

I'm trying to create an abstract factory template for multiple abstract factories in C++ and came up with this. #define _CRTDBG_MAP_ALLOC #include <crtdbg.h> #include <map> #include &l...
Transcendentalism asked 5/12, 2010 at 5:18

3

I'm trying to succinctly describe when to use a factory, for both myself and my team. I ran across the following related questions, which helped somewhat: When to use factory patterns? (useful ...

© 2022 - 2024 — McMap. All rights reserved.