design-patterns

How to implement the activity stream in a social network

I'm developing my own social network, and I haven't found on the web examples of implementation the stream of users' actions... For example, how to filter actions for each users? How to store the action events? Which data model and object model can I use for the actions stream and for the actions itselves? ...

MVP - How many presenters

What is common practice, one presenter for View view and one for Edit view, or should it be all in one presenter. ...

Pattern for synching object lists among computers (in C++)?

I've got an app that has about 10 types of objects. There will be potentially a few thousand object instances of each type. These lists of objects need to stay synchronized between apps running on different machines. If an object is added, changed or deleted, that needs to propagate to the other machines. This will be a star topology --...

How to Implement MVP in Console Application ?

I have following code in Program.cs in console application class Program : IView { private static ViewPresenter _presenter; static void Main(string[] args) { _presenter = new ViewPresenter(this); } } but I cant pass this to presenter, as Main method is static. Now how could I make this work ? ...

Is there a standard interface in .NET containing a single EventHandler

Is there a .NET framework interface like this? public interface IEvent { event EventHandler Event; } I can of course write my own, but I'll reuse it if it already exists. Could perhaps have a Fire/Raise method on it too. ...

Sharing the model in MVP Winforms App

I'm working on building up an MVP application (C# Winforms). My initial version is at http://stackoverflow.com/questions/1422343/ ... Now I'm increasing the complexity. I've broken out the code to handle two separate text fields into two view/presenter pairs. It's a trivial example, but it's to work out the details of multiple presenters...

Controller/mini-kernel design pattern in C++

I've looked around for a simple design object in C++ to work from, i understand most of the code involved but i'm rather new to the language so a 'base' to work from would help. Concept is basicly a 'task' class as a base for a jobs to run in a loop. BaseTask class > AudioTask class Controller loop > stores a std list of pointers to t...

Implement Object-Instance-Model to PropertyGrid

Hello, I am building a GUI application that will be the front-end for an XML configuration file. The XML structure defines a set of object instances. That is, type names, and property values that should be instantiated in the consuming application (windows service). So there are three layers: ConfigurationObject <--> ComponentObjects...

Singleton Design Pattern: Pitfalls

Currently I have been very interested in this "design pattern". I am not sure though if there are downfalls using this strict global state implementation. So, when do you think not to practice singleton in an application? ...

C# Factory Pattern

I am building a search application that has indexed several different data sources. When a query is performed against the search engine index, each search result specifies which data source it came from. I have built a factory pattern that I used to display a different template for each type of search result, but I've realized that thi...

J2EE Session Management Between Web & EJB Tier

Hi all, I have a J2ee application consisting of 1 web module and 1 EJB module. Inside my EJB module I have a stateful session bean containing my business logic. What I would like is: When a user logs in to my web application and creates a new session in the web tier I want that user to be assigned an instance of my session bean. At t...

drag & drop and mouse design patterns?

Are there any well-studied design patterns related to drag & drop and mouse gestures? Consider a canvas containing objects in a parent-child hierarchy with a certain layout. Some objects can be dragged and dropped onto other objects using the mouse. In addition, objects can be resized and moved with the mouse. Different hot-spots on obj...

Refactoring abstract Java class with many child classes

I'm looking for ideas on the best way to refactor this scenario (better design, minimal effort). Starting from the following example abstract class (actual has many more fields, methods and abstract methods) : abstract class Car { private int manufactureYear; // ... many more fields that are hard to clone public Car(int ma...

What are common Windows service design patterns?

Where can I find good information on common design patterns that might be employed when building a new Windows service? *Update: I'm asking if there are common designs that are used when constructing a service. For example: I have seen a single task get executed on a timer (this seems very common when constructing a service). I've...

User Stats: "interative calculation" or bulk calculation + caching

I have a project that calculates a number of 'statistics' about a users performance and then shows it to them. All these statistics ultimately come from a large table of 'interactions' that record the users interaction with the site. At the moment, all these statistics are calculated by looking at this data. We make extensive use of p...

[Pattern]Keep transaction in a queue

Hi everybody, For the moment, when an exception occur, I show a message error to the user. But I want, in this case, keep the transaction in a queue to retry again later. Do you know if a pattern to resolve my problem exist ??? thanks, Tkanos ...

.NET Projects: Where do I put .resx files?

Hello! Where do I put .resx files? Sometimes I see these files under Properties folder. Is there any design guideline about it? Thank you! ...

Singleton Pattern in .Net is not possible?

Hi Guys I have a very interesting situation , i have figured out that Singleton pattern is not all possible with .net framework (Any version) look at this code below namespace SingletonPattern { class Singleton { private static readonly Singleton instance = new Singleton(); private static int mcount = 0; private ...

"GetOrCreate" - does that idiom have an established name?

Ok, consider this common idiom that most of us have used many times (I assume): class FooBarDictionary { private Dictionary<String, FooBar> fooBars; ... FooBar GetOrCreate(String key) { FooBar fooBar; if (!fooBars.TryGetValue(key, out fooBar)) { fooBar = new FooBar(); fo...

Overridden function pointer problem at template base class C++

hi, I implemented a template base class for observer pattern, template<class T> class ActionListener { public: ActionListener(void); virtual ~ActionListener(void); void registerListener(T* listener); void unregisterListener(T* listener); template<typename Signal> void emit(Signal signal); templa...