design-patterns

Update-highlight-acknowledge UI design pattern

I am working on a safety-critical multi-user system where data shown to the operator can be changed by other operators or external systems. These changes need to be highlighted in the UI and then acknowledged by the operator. Anyone aware of existing UI design pattern that captures this need? ...

Is there a such thing as a routing pattern for websites?

I didn't find any info on searches when I looked this up. I've been doing a lot of research on design patterns but I haven't seen anything as far as routing goes. What I mean is this: back in my php days I would write code on one page and then pass it to the next. That created (though I wasn't aware of it at the time) tightly coupled cod...

Advice on framework design

Hello, i'm currently constructing some kind of mini-framework for a project, and come up with this solution. I have tried many of them, but this seems to me very convinient (code is shortened for simplicity): # Basically it's just a Registry pattern class Repository { private static $objects = array(); public fu...

Is this a known pattern?

I am trying to separate behaviour from data completely in my classes and came up with this simple solution: class ClassAData { public int Property1; public string Property2; public bool Property3; } class ClassA : SomeInterface { public ClassAData Data; //behaviour public int CalculateSomething(int value) {...

.NET Project Architecture

Hi, I have sort of a philosophical question, which also need to consider the performance impact. We are designing a new system with many sub-services that are not related to each other, yet, some may use each other (We are using unity to avoid any decoupling). My main question is: Should we break them into separate DLL's, where each ...

Loading polymorphics objects - need pattern

I need some pretty approach to load polymorhic object I have base class and several derived classes that base is not aware of. The only thing base class knows is Type enum wich defines which actual class it is. class Order { OrderType Type; bool Load(string filename) { // load Type } } class LimitOrder : Order { // some data...

Eager Loading with Entity Framework and Asp .net mvc (From a rails background)

I have a few tables that reference the same table. For example: Person has an address. Business has an address. When using the models I would like to do this in the controller: person.Address.Zip business.Address.Zip I'm coming from a rails background where I can just declare a relationship and have all the above functionality. Forc...

Building game logic with events

Hi! I'm making a game engine in C++. It is supposed to read all its game-level logic from XML files, so I'm in need of a simple, but rock solid way of creating and handling events. So far all i have done is to use an Action class. It's practically equivalent to throwing callbacks around. An example could be an object (a map), that can ch...

How should I separate entities methods ?

Good people of SO, Today I have some serious concerns on my business layer design. It is based on Entity POCO objects and I want to add logic to these entities BUT, there are 2 types of logic: Pure C# logic Persistence logic (LinqToEntities in my case) My question is simple: How should I separate these two kinds ? First, I was thi...

Open Session In View Pattern

Hi everyone, I'm asking this question given my chosen development frameworks of JPA (Hibernate implementation of), Spring, and <insert MVC framework here - Struts 1, Struts 2, Spring MVC, Stripes...>. I've been thinking a bit about relationships in my entity layer - for example I have an order entity that has many order lines. I've set...

What exactly is "interface based programming"?

Hey guys, I often hear/read about interfaced based programming but I am not exactly clear on what that really means. Is interfaced based programming an actual stand alone topic that actually has books written about it? If so, can anyone recommend any good ones? I came across interface based programming as I was reading about how good...

Is this method of checking a "gift code" secure?

I have a backend that generates gift codes, each with a certain number of uses. Give these to a blogger or whatever, and their readership can redeem the code for a promotional item. I'm working on the best way to check a codes validity without having collisions/dupes, or anything like that. I need to 1) validate the code 2) collect ship...

MVP, design question

Hi, I working on a MVP designed application and have some design questions. When writing code in the presenter-layer how should the comunication go between different presenter/viwes? Lets say I have a WindowPresenter with its WindowView and I want to set the window title on a window from another window. I have a title/set:er on the wind...

Difference between a factory, provider and a service?

What is the difference between the terms factory, provider and service? Just getting into nhibernate and its repository pattern (POCO classes, etc). ...

Any design pattern that will be helpful in implementing asynchronous communication using sockets?

Here is a brief description of what I want to accomplish. I am developing a peer to peer application using sockets. I want all my communication to be asynchronous. When ever a peer will ask another peer for something, it will send him the request tagged with a unique id. He will also store this information that what should he do with he...

What design pattern fits the bill in this scenario?

I'm writing an application to receive SMS messages via an HTTP gateway. The main parameters I'll be processing are the sender's phone number and the message itself. However, depending on the keyword within the message, I'll need to execute different logic / return a different response. To start with, I used a simple if/else which turned ...

How to store several states in one variable?

Hi, My object Item has several binary states which can be combined bool CanBeSold; bool CanBeBought; bool CanBeExchanged; I need to store current combination of values into one variable. The reason is that I need to store this value in DB. In C++ I would create a bit-mask where one state occupies some bit. Is it good practice in .NE...

Is there a difference between double dispatch and visitor pattern?

Title says it all. If it helps, the languages in question are java and c++. ...

Observer Design Pattern

In the Observer design pattern, the subject notifies all observers by calling the update() operation of each observer. One way of doing this is void notify() { for (observer: observers) { observer.update(this); } } But the problem here is each observer is updated in a sequence and update operation for an observer might no...

What is a Domain Model

I have read the wikipedia definition of a domain model. I still don't get it. I have been reading alot of posts for NHibernate and almost in every post I read I see the term Domain Model. What exactly is it and does any one have an example of a domain model. ...