design-patterns

Select / Insert version of an Upsert: is there a design pattern for high concurrency?

I want to do the SELECT / INSERT version of an UPSERT. Below is a template of the existing code: // CREATE TABLE Table (RowID INT NOT NULL IDENTITY(1,1), RowValue VARCHAR(50)) IF NOT EXISTS (SELECT * FROM Table WHERE RowValue = @VALUE) BEGIN INSERT Table VALUES (@Value) SELECT @id = SCOPEIDENTITY() END ELSE SELECT @id = RowID ...

Design Patterns, A New Criterion for Comparing Languages?

I've been reading through Code Complete, and I just got to the part about Design Patterns. I thought I'd see what questions were popular and tagged design-patterns. I was reading this question, and I agree with what seems to be the consensus there, that Design Patterns exist to address the limits of a paradigm (Functional, Object-Oriente...

WCF Client Design Pattern - Builder or Builder & Abstract Factory?

Below is the description of the flow: Overall Flow: Web page(aspx Client) -> Communicator DLL(Instantiate Proxy)->WCF Service Web Page Client Role: -> Instantiate class of Communicator DLL to pass the inputs to the operation -> Gets the output from the client and do further processing -> Does not have any clue of service operations or ...

Several C++ classes need to use the same static method with a different implementation.

I need several C++ classes to have a static method "register", however the implementation of register varies between those classes. It should be static because my idea is to "register" all those classes with Lua (only once of course). Obviously I can't declare an interface with a static pure virtual function. What do you guys sugges...

Web Service Architecture - multi tenancy design pattern (maybe)

Hi All I having a slight design problem : I have to create a Web Service (asmx or wcf) that retrieves customer data from multiple database servers, each one is exactly the same except they will contain data for different States (1 DB server per state, big states can have multiples etc). This will be used by a call center, for example, ...

Object factory implementation

I`m want to create an object factory in C#. I want my objects to be created only via this object factory, how to achieve this? I know how to make a simple object factory, like satic class with public methods that are creating and initializing my objects. But I need to make sure people can only create object instances via object factory, ...

Unobtrisuvely ask user for details

Hi, I am trying to figure out the best way to acompish "unobtrusive" forms for a user (within a web app). The purpose: keep user on the site by not asking to fill unnecessary form in. Ask for the details as only when such are needed. The requrements are: User should provide additional details only when it is required (email to recei...

What is the difference between design and architectural patterns

Hi, What is the difference between design patterns and architectural patter? How they are different? What are different types of Architectural patterns? ...

Applicable design patterns

I must develop a simple web application to produce reports. I have a single table "contract" and i must return very simple aggregated values : number of documents produced in a time range, average number of pages for documents and so on . The table gets filled by a batch application, users will have roles that will allow them to see only...

In which layer should i put my repository?

Scenario Data Access Layer EF's generated .edmx and classes Used only to access the SQL Database and pass the data forward to the business layer Business Layer Business entities : contain all validation logic, marked with the [DataContract] attribute so that they can be passed as parameters to my web service Problem I wan...

Differences between MVC and MVP Patterns

Possible Duplicate: What are MVP and MVC and what is the difference? Can somebody explain me the difference between two design patterns for a web application in .net. I am very clear on MVC Pattern and whenever i think of MVP i always feel its is same as MVC. Please clearly explain the difference between a controller and prese...

Multi-agent system in C++ code design

Hi everyone, I have a simulation written in C++ in which I need to maintain a variable number of agents, and I am having trouble deciding how to implement it well. Every agent looks something similar to: class Agent{ public: Vector2f pos; float health; float data[DATASIZE]; vector<Rule> rules; } I need to maintain a v...

Asynchronous Observer Pattern.

Hi guys, I wanted to find out other ways to do Asynchronous Observer Pattern without using Message Queue. Ideas and examples are mostly welcomed. :-) (Think of this as a brainstorming session). PS Language preference is up to you. ...

Pattern for C-style static variables in Java?

What is the best way to create a C-style static variable in Java (local to a method)? I have a method in which I need to calculate a variable only once, and do not need to recalculate it for the lifetime of the object. I understand that I could create a final field, but this variable may not be required in all cases and would only be r...

What's the best design to follow for this API in this case?

I'm building an API that post a given message to different platforms (Twitter, FaceBook...). The problem is that for each platform I may change the wrapper that allow me to post the message. For example, in C# I can post a message on twitter using the yedda API or the CsharpTwitt API, for FaceBook I'll use others APIs... Hence, I have ...

Multi version of the an application

Hi, I am newbie here. I have an existing application (C#/Win forms). I need to add functionality to the application such that is can launch another instance of its own and make some of the controls in the form disabled. It may be very easy to implement this using simple inheritance or may be some if else loop , but this application has...

Covariance and Contravariance

Possible Duplicates: Covariance and contravariance real world example still confused about covariance and contravariance & in/out Can you give me a description or example of both covariance and contravaiance, and why they now decided to add it to .NET 4? ...

MVVM Light and Undo / Redo?

I am probably mixing up some responsibilities (and maybe even terminology) here, but I can't quite wrap my head around this. Is there any relationship between the Command Pattern and the Commands found in MVVM Light (and therefore aswell in WPF)? I would really love to implement some kind of undo / redo mechanism but can't quite figure ...

New Design Patterns

is there any new design patterns available other than the patterns covered by GoF book and Head First Design Patterns? Have any one of you used your own design patterns in your projects? Please let me know. if possible give some UML Diagrams. Thanks in advance. ...

Pattern for creating a graph of Test objects?

I have to write Unit Tests for a method which requires a complex object Graph. Currently I am writing a Create method for each Test as shown below. 1. private static Entity Create_ObjectGraph_For_Test1() 2. private static Entity Create_ObjectGraph_For_Test2() ...... And So on The create method has about 10 Steps and they might vary by...