A design pattern is a general reusable solution to a commonly occurring problem in software design.

learn more… | top users | synonyms (1)

2
votes
1answer
997 views

Making Modular, Reusable and Loosely Coupled MVC Components

I am building MVC3 application and need some general guidelines on how to manage complex client side interaction between my components. Here is my definition of one component in general way: ...
6
votes
2answers
497 views

Given the presentation model pattern, is the view, presentation model, or model responsible for adding child views to an existing view at runtime?

I am building a Flex 4 based application using the presentation model design pattern. This application will have several different components to it as shown in the image below. The MainView and ...
2
votes
2answers
1k views

Dual Inspection / Four Eyes Principle

I have the requirement to implement some kind of dual inspection or four-eyes principle as a feature of my software, meaning that every change of an object done by user A has to be checked by user B. ...
4
votes
3answers
409 views

Create many similar classes, or just one

The goal is to create an application that has objects that can represent some operations (add, subtract, etc). All of those objects will have common functions and members, and thus will either ...
6
votes
3answers
317 views

When module calling gets ugly

Has this ever happened to you? You've got a suite of well designed, single-responsibility modules, covered by unit tests. In any higher-level function you code, you are (95% of the code) simply ...
1
vote
3answers
1k views

What design pattern do you use to support graceful fallback on old platforms?

Let's say I need to add a drop shadow behind a box. Some old platforms do not support drop shadows, so I have to fake it by putting an image behind the box. Here's the pseudo code of how I'm currently ...
1
vote
5answers
593 views

Can observer pattern be represented by cars and traffic lights?

I wanted to verify with all of you, if I have a correct Observer Pattern analogy. The scenario is as follows: Consider, at a junction, there is a traffic signal, having red, yellow and green lights ...
4
votes
7answers
1k views

Design patterns: moving object references around an application

I'm new to Programmers and I am looking to increase my knowledge of programming. Recently, a user on Stack Overflow told me using singletons is a bad idea, that they encourage tight coupling and that ...
12
votes
3answers
3k views

What is the pattern name for using method chaining to build an object? [closed]

I frequently use a pattern where I using method chaining to setup an object, similar to a Builder or Prototype pattern, but not creating new objects with each method call, instead modifying the ...
13
votes
4answers
16k views

On MVC can several views have the same controller or one view must have one unique controller?

I'm having some questions while designing a architecture for a project around MVC. (It's a C++/Marmalade SDK project, I'm not using any particular MVC framework, I'm making one.) On several articles ...
4
votes
2answers
1k views

Who should register input listeners: the controller or the view? (MVC)

I'm using an (C++) SDK (Marmalade) and building a project around the MVC pattern. On my app, user input listeners may be registered on certain UI elements/widgets/etc providing a proper callback ...
9
votes
1answer
1k views

Peter Norvig's paper cited by Brendan Eich

I'm reading Coders at Work and Brendan Eich cites a paper by Norvig, from when he was at Harlequin, "about how design patterns are really just flaws in your programming language." Can anyone provide ...
0
votes
1answer
319 views

iOS object instance accessible from three separate classes, or load 3 nib files with one class?

I've got three nib files in my project, each of which is driven by its own class (.h and .m files). Each nib has a stylized design with a full screen background image and a few overlay images acting ...
-2
votes
2answers
227 views

I have to run certain number of statements (which are executing .exe) in a loop

I have to run certain number of statements (which are executing .exe) in a loop. ForEach(object obj in ListOfVersions) { Step 1: call Exe1 Args=obj.somevalues Log Step 1 completed ...
9
votes
4answers
4k views

Design Patterns / Strategies For Custom Fields & Data Types

Are there any common strategies or design patterns for designing applications that have either the ability to add custom fields to data objects, or for creating your own custom definition of objects. ...
7
votes
3answers
3k views

Ajax race conditions

Is there a pattern or standard way to handle Ajax race conditions? Take the following example. You have two tables. Clicking a row on table 1 removes the data from DB and then updates table 2 (which ...
3
votes
3answers
877 views

New Silverlight app. MVVM. RIA Services vs CSLA

Another 2 days of reading and watching demos and here we go. For my enterprise LoB Silverlight app I'm going to use: Prism for UI aspects and modularity. MVVM pattern (using Prism) ??? to bring ...
13
votes
2answers
3k views

Best overview to modern C++ paradigms? [closed]

I used to write C++ extensively between 8 and 10 years ago. I have since moved on to C# for professional reasons. However, from time to time I see statements like "If you're still manually ...
12
votes
5answers
858 views

Is overloading an example of the Open/closed principle?

Wikipedia says "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification" The word functions caught my eyes, and I now wonder if we can ...
23
votes
9answers
8k views

Alternatives to the singleton pattern

I have read different opinions about the singleton pattern. Some maintain that it should be avoided at all costs and others that it can be be useful in certain situations. One situation in which I ...
5
votes
1answer
600 views

Need advice for approach for a web-based app that loads excel worksheet but exposes only the charts

I'm looking for suggestions on the Visual Studio approach to take for a web application that is in the conceptual stage. My environment has a lot of tools: Windows Server 2008 R2 Standard 64bit ...
3
votes
2answers
287 views

How would I do a “Server over capacity” message with Django?

This probably isnt' a Django specific question, but I'm wondering how those "Server over capacity" messages are displayed. Some examples: Twitter's fail whale Tumblr's Over capacity slash page ...
2
votes
1answer
811 views

Best practice for combining a Java Applet/ Android interface?

I'm working on an online game, which I am seriously considering writing a Java Applet for it. The game is not overly complex on the features. I'm considering at some point having at least 3 versions ...
2
votes
3answers
3k views

Any Course/Lecture videos on Design Patterns

I am planning to read some design patterns and I took the book on "design patterns in C++' by gang of four. However, I am not really some one who reads book and prefers reading slides/watching course ...
4
votes
5answers
2k views

Pattern for select case on object type (of interface)

I have read that doing a select case is often a code smell. There are cases however where an interface cannot solve my problem. For instance, I have a set of date filter objects (last 7 days, last ...
8
votes
4answers
1k views

Design pattern for handling a response

Most of the time when I'm writing some code that handles the response for a certain function call I get the following code structure: example: This is a function that will handle the authentication ...
7
votes
1answer
1k views

Open/Closed principle and reopening Ruby Classes

In OOP there is the Open/Closed principle that states that "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification". Taking in ...
0
votes
1answer
835 views

Model View Presenter for WebForms and Winforms

I have a windows forms project using the Model View Presenter pattern and would like to build a web forms project on top of the same MVP structure. The windows forms project knows nothing of ASP.Net ...
9
votes
5answers
1k views

When to stop inheritance?

Once upon time ago I asked a question on Stack Overflow about inheritance. I have said I design chess engine in OOP fashion. So I inherit all my pieces from Piece abstract class but inheritance still ...
1
vote
1answer
552 views

MVC, Java Design Pratices, and Flaws of java.util.Observable and java.util.Observer

I am planning learning Model-View-Controller (MVC) development using Java. While reading I came across a post which mentions java.util.Observer and java.util.Observable for MVC development. As I ...
2
votes
1answer
391 views

How to manage contextual objects without IoC container (session or passing around objects)?

I'm using asp.net (c#). I have a factory that uses a dictionary of keys that are mapped to objects types. I originally used a static variable to track the dictionary but realized it would be shared ...
6
votes
2answers
252 views

Adapter Pattern to expose different aspects of an object — Is this a correct use?

Quite frequently, I use an Adapter-like design to expose different aspects of data objects. For example, in a 3D modelling application I use an object hierarchy to represent the 3d models in the ...
5
votes
2answers
858 views

Development Patterns for dealing with Data Import / Export

I have a ASP.NET web based application that allows the end user to export data to a flat file format. (essentially taking a point-in-time backup of their work) At a later date they can re-upload ...
3
votes
1answer
213 views

Exposing warnings\errors from data objects (that are also list returned)

I'm exposing Data objects via service oriented assembly (which on future usages might become a WCF service). The data object is tree designed, as well as formed from allot of properties.Moreover, ...
-1
votes
1answer
285 views

How do I maintain states [closed]

I have a winforms application with a display window that can show 3d geometry. I have another control on which I have a series of options to turn on/off different items in my display window. However ...
4
votes
1answer
609 views

Dapper and object validation/business rules enforcement

This isn't really Dapper-specific, actually, as it relates to any XML-serializeable object.. but it came up when I was storing an object using Dapper. Anyways, say I have a user class. Normally, I'd ...
6
votes
4answers
826 views

Command-Query-Separation and multithreading safe interfaces

I like the command query separation pattern (from OOSC / Eiffel - basically you either return a value or you change the state of the class - but not both). This makes reasoning about the class easier ...
2
votes
1answer
281 views

Composite-like pattern and SRP violation

Recently I've noticed myself implementing pattern similar to the one described below. Starting with interface: public interface IUserProvider { User GetUser(UserData data); } GetUser method's ...
8
votes
2answers
280 views

Low coupling processing big quantities of data

Usually I achieve low coupling by creating classes that exchange lists, sets, and maps between them. Now I am developing a Java batch application and I can't put all the data inside a data structure ...
16
votes
6answers
2k views

Strategies for avoiding SQL in your Controllers… or how many methods should I have in my Models?

So a situation I run into reasonably often is one where my models start to either: Grow into monsters with tons and tons of methods OR Allow you to pass pieces of SQL to them, so that they are ...
4
votes
8answers
9k views

What is a “wrapper” program?

Where I work, employees use a third-party desktop program for their clients. This program saves data to a flat file. My colleague wants to write a Java program that uploads that flat file to a remote ...
4
votes
2answers
882 views

Which is a better design pattern for a database wrapper: Save as you go or Save when you're done?

I know this is probably a bad way to ask this question. I was unable to find another question that addressed this. The full question is this: We're producing a wrapper for a database and have two ...
7
votes
4answers
1k views

Should injecting dependencies be done in the ctor or per method?

Consider: public class CtorInjectionExample { public CtorInjectionExample(ISomeRepository SomeRepositoryIn, IOtherRepository OtherRepositoryIn) { this._someRepository = ...
3
votes
4answers
227 views

How to “translate” interdependent object states in code?

I have the following problem. My UI interace contains several buttons, labels, and other visual information. I am able to describe every possible workflow scenario that should be be allowed on that ...
2
votes
1answer
2k views

Subscribe/Publish Model in Web-based Application (c#) - Best Practices for Event Handlers

I was recently exposed to a desktop application that uses an publish/subscribe model to handle commands, events, etc. I can't seem to find any good examples of using this in a web application, so I ...
1
vote
1answer
409 views

Request / Reply , how should one initiate the actual sending of the transmission?

I'm working on Language level interfaces to web API's. These libraries are of course built around existing HTTP Request/Reply interfaces. I see myself as having a few options submit method on the ...
12
votes
3answers
7k views

Why would a programmer want to separate implementation from interface?

The bridge design pattern separates implementation from the interface of a program. Why is this advantageous?
3
votes
2answers
449 views

Application design question regarding saving files

I am working on an application in C# and I am having some extreme difficulty solving this design issue. Basically the application allows users to create cook books. A user can click "new book" and ...
1
vote
2answers
202 views

Main class passes dbConn obj to all its services, I need to change the dbConn for one of its services. - suggestion for design pattern

There is this main class and there are several services ( which uses db connection to retrieve data ) These services are initialized in the main class db properties are obtained from the property ...
2
votes
1answer
344 views

Are there design patterns or generalised approaches for particle simulations?

I'm working on a project (for college) in C++. The goal is to write a program that can more or less simulate a beam of particles flying trough the LHC synchrotron. Not wanting to rush into things, ...