tagged [factory]
Authlogic: logging-in twice on the same test
Authlogic: logging-in twice on the same test Is there any way to logout and login another user when testing with Authlogic? The following test case just fails ``` class MessagesControllerTest 'sender'...
- Modified
- 6 Feb at 15:58
Returning mock objects from factory girl
Returning mock objects from factory girl I am using Mocha and Factory_girl in a JRuby rails application. When I call the factory I would like to return the objects with some mocking already done. Here...
- Modified
- 11 Jan at 22:28
Factory Pattern without a Switch or If/Then
Factory Pattern without a Switch or If/Then I'm looking for a simple example of how to implement a factory class, but the use of a Switch or an If-Then statement. All the examples I can find use one. ...
- Modified
- 11 Oct at 19:22
Return one of two possible objects of different types sharing a method
Return one of two possible objects of different types sharing a method I have 2 classes: And ``` public class Qu
- Modified
- 3 Oct at 14:15
Is there a custom service factory on ServiceStack, something analogous to custom controller factory of ASP.NET MVC?
Is there a custom service factory on ServiceStack, something analogous to custom controller factory of ASP.NET MVC? I wanted to have a control on service creation so I can make necessary adjustments t...
- Modified
- 10 Jul at 13:41
How to pass a type to a method - Type argument vs generics
How to pass a type to a method - Type argument vs generics I have a method of an object which is something like a factory. You give it a type, it creates an instance and does a few other things. An el...
- Modified
- 31 Jul at 12:6
What methods should go in my DDD factory class?
What methods should go in my DDD factory class? I am struggling to understand what my factory class should do in my DDD project. Yes a factory should be used for creating objects, but what exactly sho...
- Modified
- 4 Mar at 15:6
Saving Data with the Factory Pattern?
Saving Data with the Factory Pattern? I've been becoming more familiar with the Factory Pattern (along with Strategy Pattern) and what a great benefit the pattern can have. However, I've been struggli...
- Modified
- 27 Oct at 17:7
How to keep a class from being instantiated outside of a Factory
How to keep a class from being instantiated outside of a Factory I have a Factory. I do not want to allow classes that this factory produces to be instantiated outside of the factory. If I make them a...
Factory method with DI and IoC
Factory method with DI and IoC 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...
- Modified
- 13 Feb at 12:29
Generics & Reflection - GenericArguments[0] violates the constraint of type
Generics & Reflection - GenericArguments[0] violates the constraint of type I've been pulling my hair out for awhile on this one, essentially I'm trying to implement a generic repository factory, whic...
- Modified
- 14 Sep at 11:6
Factory pattern in C#: How to ensure an object instance can only be created by a factory class?
Factory pattern in C#: How to ensure an object instance can only be created by a factory class? Recently I've been thinking about securing some of my code. I'm curious how one could make sure an objec...
- Modified
- 6 May at 16:39
Refactoring Java factory method
Refactoring Java factory method There's something very unsatisfactory about this code: ``` /* Given a command string in which the first 8 characters are the command name padded on the right with white...
Ninject Factory Extension Bind Multiple Concrete Types To One Interface
Ninject Factory Extension Bind Multiple Concrete Types To One Interface ## Introduction: I'm using the [Ninject Factory Extension](https://github.com/ninject/ninject.extensions.factory/wiki) to inject...
- Modified
- 22 Jan at 03:24
A Factory Pattern that will satisfy the Open/Closed Principle?
A Factory Pattern that will satisfy the Open/Closed Principle? I have the following concrete `Animal` products: `Dog` and `Cat`. I am using a [parameterized Factory method](http://www.datensarg.de/200...
- Modified
- 24 Oct at 13:36
Flyweight and Factory problem with IDisposable
Flyweight and Factory problem with IDisposable I seem to be mentally stuck in a Flyweight pattern dilemma. First, let's say I have a disposable type `DisposableFiddle` and a factory `FiddleFactory`: `...
- Modified
- 25 Feb at 17:34
Static factory method vs public constructor
Static factory method vs public constructor Here's the code for what I'm currently working on. First, the base class, which is an account class that holds information about the account and has some me...
- Modified
- 6 Mar at 11:35
Abstract Factory Design Pattern
Abstract Factory Design Pattern I'm working on an internal project for my company, and part of the project is to be able to parse various "Tasks" from an XML file into a collection of tasks to be ran ...
- Modified
- 16 Sep at 14:37
C# Generic Interface and Factory Pattern
C# Generic Interface and Factory Pattern I am trying to create a Generic interface where the parameter type of one of the methods is defined by the generic I've changed the question slightly after rea...
- Modified
- 8 Sep at 10:36
Working with Abstract Factory that is injected through DI container
Working with Abstract Factory that is injected through DI container I`m confused about Dependency Injection implementation in one concrete example. Let's say we have a SomeClass class that has a depen...
- Modified
- 25 Mar at 09:19
Should a constructor parse input?
Should a constructor parse input? Often, I find that I must instantiate a bunch of objects, but I find it easier to supply the parameters for this instantiation as a human-readable text file, which I ...
Using a Strategy and Factory Pattern with Dependency Injection
Using a Strategy and Factory Pattern with Dependency Injection I am working on a side project to better understand Inversion of Control and Dependency Injection and different design patterns. I am won...
- Modified
- 22 Feb at 21:21
Silencing Factory Girl logging
Silencing Factory Girl logging Just to clear the air, I am not some cruel factory master trying to silence working ladies. I am having a very annoying problem where when using Thoughtbot's factory gir...
- Modified
- 20 Nov at 17:37
Constructing an object graph from a flat DTO using visitor pattern
Constructing an object graph from a flat DTO using visitor pattern I've written myself a nice simple little domain model, with an object graph that looks like this: ``` -- Customer -- Name : Name ...
- Modified
- 14 Feb at 00:2
How to choose between Factory method pattern and Abstract factory pattern
How to choose between Factory method pattern and Abstract factory pattern I know similar questions were asked before. I've been reading a lot about this during the last couple of days and I think I ca...
- Modified
- 18 Apr at 18:29