I'm trying to figure out the origin of the view handler design pattern in software engineering. Many of the design patterns in software engineering were inspired by things which pre-date computers, and I was wondering if anybody had any insights on the origin of this particular pattern.
...
I have not done any large game development projects, only messed around with little toy projects. However, I never found an intuitive answer to a specific design question. Namely, how are different types/states of UI modeled in games? E.g. how is a menu represented? How is it different from a "game world" state (let's use an FPS as an ex...
Is it bad policy to have lots of "work" classes(such as Strategy classes), that only do one thing?
Let's assume I want to make a Monster class. Instead of just defining everything I want about the monster in one class, I will try to identify what are its main features, so I can define them in interfaces. That will allow to:
Seal the c...
I was reading up on singleton class design in C# on this great resource and decided to go with alternative 4:
public sealed class Singleton1
{
static readonly Singleton1 _instance = new Singleton1();
static Singleton1()
{
}
Singleton1()
{
}
public static Singleton1 Instance
{
get
{
...
I've been reading about MVC design for a while now and it seems officially the View calls objects and methods in the Model, builds and outputs a view.
I think this is mainly wrong.
The Controller should act and retrieve/update objects inside the Model, select an appropriate View and pass the information to it so it may display. Only cr...
Hi,
Is there any best practice when working with AST:s?
I have a parsed expression AST. ConstantExpression, BinaryExpression etc.
I want to populate a GUI-dialog with information from the AST, and it's here where I get kinda confused because my code gets pretty messy.
Example:
expression = "Var1 > 10 AND Var2 < 20"
I want to popula...
I have attempted to make my first 3 tier application. In the process I have run into one problem I am yet to find an optimal solution for.
Basically all my objects use an IFillable interface which forces the implementation of a sub as follows
Public Sub Fill(ByVal Datareader As Data.IDataReader) Implements IFillable.Fill
This sub the...
Let's say we have the following piece of code:
public class Event { }
public class SportEvent1 : Event { }
public class SportEvent2 : Event { }
public class MedicalEvent1 : Event { }
public class MedicalEvent2 : Event { }
public interface IEventFactory
{
bool AcceptsInputString(string inputString);
Event CreateEvent(string in...
I'm using Rhino Mocks to try to verify that when I call a certain method, that the method in turn will properly group items and then call another method.
Something like this:
//Arrange
var bucketsOfFun = new BucketGame();
var balls = new List<IBall>
{
new Ball { Color = Color.Red },
...
I need to explain to a not-very-technical manager the MVC (model-view-controller) concept and ran into trouble. The problem is that the explanation needs to be on a "your grandma will get it" level - e.g. even the fairly straightforward explanation offered on MVC Wiki page didn't work, at least with my commentary.
Does anyone have a re...
Using Fluent Interface design here
if i call something like
dog.Train("Running").Train("Eating").Do("Running").Do("Eating");
what is the name of this pattern ? is it chain-of-responsibility or there any specific design pattern name associated with it?
...
Hi folks:
Can you provide practices about leveraging Factory (method) pattern?
And the benefit you got greatly.
Thanks.
...
i have something that requires a matrix of values, similar to pokemon:
i have a class object for each of the types, is there a pattern or a good way to implement this, as a middle layer or in the classes?
...
I have a class which has a list of child items. Is there a design pattern I can copy that I can apply to these classes so that I can access the parent instance from the child, and it enforces rules such as not being able to add the child to multiple parents, etc?
...
Currently, I am dealing with multiple layers of composition in my application. We read data from database for ProductLocations and put them into a Solver object. In another query we read multiple SalesActivities connected to product locations which needs to be placed in an object deep within the correct ProductLocation object. I end up ...
I have a couple of base/interface classes each of which has several derived classes. I have a need to store metadata on each derived class that has a lot of overlap, but different values.
I also have a Factory class for creating instances of the derived classes that's implemented as a singleton and has a few macros. For example, you'd:
...
There was an article here:
http://msdn.microsoft.com/en-us/library/Ee817667%28pandp.10%29.aspx
The first part of tut implemented this pattern with abstract classes. The second part shows an example with Interface class. But nothing in this article discusses why this pattern would rather use abstract or interface.
So what explanation (a...
I have a Win32 C++ program that validates user input and updates the UI with status information and options. Currently it is written like this:
void ShowError() {
SetIcon(kError);
SetMessageString("There was an error");
HideButton(kButton1);
HideButton(kButton2);
ShowButton(kButton3);
}
void ShowSuccess() {
Set...
I have seen this often in code, but when I speak of it I don't know the name for such 'pattern'
I have a method with 2 arguments that calls an overloaded method that has 3 arguments and intentionally sets the 3rd one to empty string.
public void DoWork(string name, string phoneNumber)
{
DoWork(name, phoneNumber, string.Empty)
}
pr...
Ok i have a problem, sorry if i cant explaint it clear but the code speaks for its self.
i have a class which generates objects from a given class name;
Say we say the class is Modules:
public function name($name)
{
$this->includeModule($name);
try
{
$module = new ReflectionClass($name);
$instance = $module->i...