design-patterns

Is there a MVC pattern for C# in WPF

Howdy, Is there a pattern where in WPF, I can build a simple UI form from an XML like definition file pulled from a database? It would allow the user to enter data into this form, and submit it back. The data would be sent back in an XML structure that would closely/exactly mimic the UI definition. The definition should includ...

How to prevent memory leaks while cancelling an operation in a worker thread C++?

Currently i am working on a desktop application which consists mathematical analysiss.I am using qt for GUI and project written in c++. When user starts an analysis, i open a worker thread and start a progress bar.Everything is ok up to now, problem starts when user cancels operation.Operation is complex, i am using several functions and...

Best design pattern for complex silverlight games

What patterns do you think are best for silverlight games? Some main areas of focus are game performance, maximum number of objects reasonably updated in real time, ease of development and testing. ...

Is referencing an implementing base type in an interface a code smell?

I'm faced with a design decision that doesn't smell to me, but gives me pause. Take a look at the following code sample: public interface IGenerator { ///<summary> /// Combines two generators; performs magic as well /// </summary> BaseGenerator Combine(BaseGenerator next); ///<summary> /// Does what a generator does. ///...

MVP and UserControls and invocation

I'm having some fun trying to get my head around some MVP stuf, as it pertains to User Controls. I'm using .NET WinForms (or something close to it) and Supervising Controller pattern (well, I think I am :). The User Control is itself part of an MVP application (its the View and has an associated Presenter etc). The Presenter is always ...

Double dispatch/multimethods in C++

I have a question on C++ double dispatch. In the code below, I want the results from the second set to match the results from the first set. I don't know the actual type (unless I try dynamic_cast) but I do know that the object inherited from the BaseClass type. What is the most efficient (performance-wise) way to accomplish this? Aft...

explanation needed for exceptions/classes.

Consider the following snippet: using System; using System.Collections.Generic; using System.Linq; using System.Net; namespace ForumLogins { public class VBULLETIN { HttpWebRequest request; public void ForumLogins(string url) { request = (HttpWebRequest)WebRequest.Create(url); } ...

Domain Driven Design question

Hi, I would like to ask for a reccomended solution for this: We have a list of Competitions. Each competition has defined fee that a participatior has to pay We have Participators I have to know has a Participator that is on a Competition paid the fee or not. I am thinking about 2 solutions and the thing is it has to be the most a...

Zend_Framework- Where to Place $_GET and $_POST (HTTP Request) handling?

I recently read this post which led to a series of other posts that all seem to suggest the same idea: Models do everything, the View should be able to communicate directly with the model and vice versa all while the Controller stays out of the way. However, all of the examples shown are fairly simplistic and none really show an example ...

Table Module vs. Domain Model

I asked about Choosing a method to store user profiles the other day and received an interesting response from David Thomas Garcia suggesting I use the Table Module design pattern. It looks like this is probably the direction I want to take. Everything I've turned up with Google seems to be fairly high level discussion, so if anyone coul...

Should one be strict on design pattern implementation?

I'm currently reading, "Design Patterns:Elements of Reusable Object-Oriented Software" by Erich Gamma and others. I decided to do some small projects to see the actual result of applying design patterns to the software I write. How strict should I be on implementing them? I have seen some examples on the internet that implement the inte...

Where do you like to catch exceptions and why?

Where do you like to catch exceptions and why? I'm interested in seeing where people find it useful to put their try/catch blocks in the hope that some general patterns might emerge. I'll post my two example answers in C++ but any language is fine. One location and reason per answer please. Thanks. ...

undo/redo with cascading deletions

I'm trying to implement an undo/redo feature into my application, using the Command Pattern. I'm facing a problem. To illustrate it, let's imagine you can create with my application 2D profiles (as many as you want). From these 2D profiles, you can then create a 3D part with different attributes (name, colour, scale, etc.). +---------...

What is the right pattern for using JQuery Ajax and ASP.Net Mvc?

I'm very new to both the Mvc framework as well as JavaScript and JQuery. I'm trying to understand the right way to structure Ajax calls. Let's say I have a "Vote Up" button similar to what you see on StackOverflow. When the user clicks it I need to update the vote count in the database and return the new value to the UI. Currently I am ...

Implementing a tree in c# managing parent-child

I am implementing a tree think of it as a folder structure so I have a class that looks like: public class Folder { //Various Props like Name etc. public IList<Folder> Children{get;} public Folder Parent {get;} } Now what I want is to be able to walk up and down the tree so given a root I can find a leaf, and given a leaf ...

Repository Pattern - MVC storefront

Have been looking at the MVC storefront and see that IQueryable is returned from the repository classes. Wondering if you are not using LINQ does it makes sense to return that object? In the case of LINQ in makes sense because of deferred execution, so adding filtering in the service layer makes sense, but if you don't use LINQ you wou...

where should I save a complex MVC application UI state?

I've been having a look at several MVC frameworks (like rails, merb, cakephp, codeignitier, and similars...) All the samples I've seen are basically plain and simple CRUD pages, carrying all the infr needed in the querystring and the posted field values. I've got a couple of apps made with some sort of framework built with classic asp....

How will I know when to create an interface?

I'm at a point in my development learning where I feel like I must learn more about interfaces. I frequently read about them but it just seems like I cannot grasp them. I've read examples like: Animal base class, with IAnimal interface for things like 'Walk', 'Run', 'GetLegs', etc - but I've never been working on something and felt lik...

Is there any pattern or refactoring trick to split Enum and DBDictionary data duplicate

We have a smelly code in our project. A lot of values which used in biz logic have 2 places where they stored: we have dictionary tables (used in FK relations) in DB where we stored values e.x. MessageDirectionInfo: 0|Unknown 1|In 2|Out and we have Enum with exactly same data: MessageDirectionEnum{Unknown=0,In=1,Out=2} And all over ...

Introducing an IoC Container to Legacy Code

I'm writing a new .NET library for internal use at my company that will use IoC through Dependency Injection. Naturally, this library will be much easier to use if we use an IoC Container to resolve instances. However, the code that will be making calls into this library does NOT currently use Dependency Injection of any sort, and refa...