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

learn more… | top users | synonyms (1)

1
vote
2answers
841 views

Use of the Visitor pattern and possible over engineering

I am developing a small application in .NET and am thinking of using XML to save the object model. My first thought was to separate the model and the generation of XML by using the Visitor pattern. ...
19
votes
2answers
7k views

Alternative patterns for web development? (non-MVC)

Recently I've been reading some blog posts regarding MVC and how it doesn't fit the web. I've learned about alternative patterns like the RMR Architecture. I'm curious what other patterns people are ...
59
votes
10answers
5k views

Non-OOP Design Patterns? [closed]

I have only heard the term "design pattern" being used for object oriented code, and the GoF patterns include only OOP design patterns, but design patterns are elegant solutions for commonly occuring ...
5
votes
4answers
1k views

What is a good pattern for combined caching and reinitialization?

I have a situation where I have three requirements: Lazy initialization - don't create the collection until asked for it Caching - keep the collection in memory on the object Reinitialization - be ...
3
votes
1answer
1k views

Is it common/correct using MVVM to expect multiple views and corresponding view-models for a particular model?

Consider a somewhat contrived model that goes something like: class Player { public int Health; public int Ammo; public Weapon CurrentWeapon; public PhysicalState State { ...
7
votes
4answers
1k views

Avoid having an initialization method

I have this existing code where they have a class and an initialization method in that class. It is expected that once the object of the class is created, they need to call initialize on it. Reason ...
3
votes
1answer
1k views

Better to inject IoC container or use a Service Locator pattern? [duplicate]

I have an IoC container (If you want a specific one to look at, it's very similar to Unity) and I'm working on how I want to integrate it into my application. My overall goal for this exercise is to ...
3
votes
4answers
1k views

Is this a pattern? Should it be?

The following is more of a statement than a question - it describes something that may be a pattern. The question is: is this a known pattern? Or, if it's not, should it be? I've had a situation ...
0
votes
2answers
217 views

Delegate pattern : Who has the responsability to create return Object?

I've a question about the Delegate Pattern : If I want to delegate the parsing of a xml file, for instance, that I want to be converted into a Key-value Dictionary. Let's take this classical ...
3
votes
2answers
516 views

“Don't cross the streams” Database access objects independant of the Data tier in an N-Tier architecture?

I'm adding functionality to our website which performs long-running processes asynchronously using MSMQ. Doing this ansynch, however means we need to notify users when their requests are completed. ...
1
vote
3answers
290 views

How do you organize a large data layer in a project?

I have a data layer that strictly interacts with the database and returns the result into a model. I have an asynchronous connection with the DB so sometimes I have to chain results where I have to ...
4
votes
3answers
895 views

Usage of Repository Pattern

I'm using the Repository pattern in my application right now. It is a console-based batch processing tool. Essentially I need the repository to be able to randomly access the data. The trouble I am ...
27
votes
11answers
2k views

Well designed / high-quality open source software [closed]

I'm taking a software design class where I should choose an open source software to analyze from the Software Design point of view. It has to be a big project: not less then 100,000 lines of code. I ...
4
votes
4answers
2k views

How to figure out real life examples of design patterns?

Hi I am learning design patterns from a book . How to figure out the actual production code where it is implemented . For example , if I am learning strategy pattern , it might be implemented ...
0
votes
1answer
715 views

Building a table (DataGridView) while keeping decoupled from Model

I'll try to keep this simple. Small C# app, dialog based, one has a DataGridView. I've got an UpdateTable function in the form that accepts a DataSet and passes it to the DataGridView.DataSource. ...
10
votes
9answers
2k views

How should you explain Design Patterns to people outside of Software World

I want to explain design patterns to my niece, but always struggle in doing so. It is largely due to my lack of clear understanding of design patterns. How do you suggest explaining patterns like ...
3
votes
2answers
2k views

user security pattern recommendation/best practice

I'm looking for good reference on patterns that apply to user security and ACLs for multi-user network applications. I'm re-writing a fairly large application from scratch. Now I'm looking at the ...
8
votes
2answers
573 views

Which GOF design patterns are already implemented as first-class language features in C#?

(This question was closed on Stack Overflow due to being "too broad" and "not a real question" so maybe it's more appropriate here?) Inspired by this question. We know events are a language-level ...
18
votes
2answers
5k views

Should I read “Head First Design Patterns” as my first design pattern book? [closed]

I'm planning to read a book to gain some good knowledge of design patterns, why we use them, how to apply them and how to choose the best design for my software. So I have two books on my desk right ...
1
vote
1answer
321 views

Model-view-presenters and user-interactions involving separate dialogs

I have a UI form written using model-view-presenter that has, among other things, a listbox containing a number of different domain objects. The form also contains an add/update button which pulls up ...
16
votes
3answers
3k views

How to store prices that have effective dates?

I have a list of products. Each of them is offered by N providers. Each providers quotes us a price for a specific date. That price is effective until that provider decides to set a new price. In ...
20
votes
4answers
14k views

Model-View-Presenter implementation thoughts

I'm trying to get a good grasp of how to implement good decoupling between a UI and the model, but I'm having trouble figuring out exactly where to divide the lines. I've been looking at ...
4
votes
1answer
295 views

Will Design Patterns Help me in this case?

recently I have been given a task of finding the combinations of the given word. For example, say The given word is like then possible answers are liek,lkie and so on. This has to be implemented in ...
9
votes
1answer
571 views

When is a glue or management class doing too much?

I'm prone to building centralized classes that manage the other classes in my designs. It doesn't store everything itself, but most data requests would go to the "manager" first. While looking at an ...
7
votes
3answers
1k views

Duplication in parallel inheritance hierarchies

Using an OO language with static typing (like Java), what are good ways to represent the following model invariant without large amounts of duplication. I have two (actually multiple) flavours of the ...
11
votes
5answers
2k views

Modified Strategy Design Pattern

I've started looking into Design Patterns recently, and one thing I'm coding would suit the Strategy pattern perfectly, except for one small difference. Essentially, some (but not all) of my ...
3
votes
2answers
2k views

Anemic Domain Model, Business Logic and DataMapper (PHP)

I've implemented a rudimentary ORM layer based on DataMapper (I don't want to use a full blown ORM like Propel/Doctrine - for anything beyond simple fetch/save ops I prefer to access the data directly ...
2
votes
7answers
1k views

Architectural patterns for interaction beyond MVC? [closed]

We all know the venerable Model-View-Controller pattern used to design interaction [mostly] with human users. It is the de-facto standard in OOP environment. What are some other architectural ...
4
votes
3answers
383 views

MVP Pattern Philsophical Question - Security Checking in UI

I have a philosophical question about the MVP pattern: I have a component that checks whether a user has access to a certain privilege. This privilege turns on or off certain UI features. For ...
1
vote
4answers
3k views

When designing an application around Model-View-Controller (MVC), what is in your toolbox?

There are a lot of great explanations for what the Model-View-Controller design pattern is, but I am having trouble finding good resources showing how to use it in practice. So, when you are starting ...
10
votes
1answer
4k views

Software architecture for authentication/access-control of REST web service

I am setting up a new RESTful web service and I need to provide a role-based access control model. I need to create an architecture that will allow users to provide their username and password to get ...
3
votes
3answers
646 views

How to make an app more intuitive? [closed]

In the industry, there are few standard checklists on how to make a web application more : Scalable Easy to understand/maintain Perform better Robust etc. etc. Are there any standard checklists ...
1
vote
8answers
326 views

Identifying which pattern fits better

I'm developing a software to program a device. I have some commands like Reset, Read_Version, Read_memory, Write_memory, Erase_memory. Reset and Read_Version are fixed. They don't need parameters. ...
3
votes
4answers
2k views

How to learn the practical uses of design patterns

I use OOP programming with inheritance, but I've not yet used interfaces.I want to learn how to use design patterns, but I'm finding them very difficult to learn. Is there is any way to learn design ...
1
vote
5answers
549 views

Ways of handling asynchronous receive calls

I am implementing a primitive message-passing system. Currently, I am designing a receive function for async calls. Can I implement such a async receive function without using callback functions?
4
votes
2answers
862 views

What are the best patterns/designs for stateful API development?

I am about to implement a API for my TCP/IP server written in Java. Right now I have a temporary method that takes a String, executes a command based on the String and returns a String basically like ...
41
votes
15answers
20k views

When should I use—and not use—design patterns? [duplicate]

In a previous question of mine on Stack Overflow, FredOverflow mentioned in the comments: Note that patterns do not magically improve the quality of your code. and Any measure of quality ...
16
votes
10answers
2k views

GoF Design Patterns - which ones do you actually use? [closed]

I'm trying to educate my colleagues in the area of design patterns. Some of the original Gang of Four patterns are a little esoteric, so I'm wondering if there is a sub-group of "essential" patterns ...
22
votes
12answers
5k views

What design patterns are the worst or most narrowly defined? [closed]

For every programming project, managers with past programming experience try to shine when they recommend some design patterns for your project. I like design patterns when they make sense or if you ...
7
votes
4answers
933 views

Modular Architecture for Processing Pipeline

I am trying to design the architecture of a system that I will be implementing in C++, and I was wondering if people could think of a good approach, or critique the approach that I have designed so ...
13
votes
3answers
6k views

How do I set up MVP for a Winforms solution?

I have used MVP and MVC in the past, and I prefer MVP as it controls the flow of execution so much better in my opinion. I have created my infrastructure (datastore/repository classes) and use them ...
1
vote
5answers
297 views

Does this have a name? DRY overloading?

public int foo(int x) { int defaultValue = 0; return foo(x, defaultValue); } public int foo(int x, int y) { return x + y; }
6
votes
1answer
1k views

How best to design Access Control Layer in n-tier architecture application

This is a typical architecture scenario for a 3-tier design: UI-tier Has Graphical User Interface components Middle-tier Has business logic including the following layers: Data Access Layer ...
12
votes
3answers
3k views

Recommended order for learning design patterns? [closed]

I can't help but notice the amount of design patterns that are out there. Does anyone have suggestions on an order I should learn them in? Or should I pick and choose them at random? The only one I ...
2
votes
3answers
750 views

Design Patterns in Delphi [closed]

Delphi has a few problems implementing some design patterns because some features it lacks, like multiple inheritance and no pure abstract classes. Are there any good resources or ...
11
votes
5answers
1k views

Do you leverage the benefits of the open-closed principle?

The open-closed principle (OCP) states that an object should be open for extension but closed for modification. I believe I understand it and use it in conjunction with SRP to create classes that do ...
8
votes
6answers
1k views

Better Understand the 'Strategy' Design Pattern

I have been interested in design patterns for a while and started reading "Head First Design Patterns". I started with the first pattern called the 'Strategy' pattern. I went through the problem ...
9
votes
6answers
406 views

Giving a presentation on “code style and design patterns” [closed]

My company (small, about 40 people across 3 offices) occasionally does "developer workshops" online where one of the devs hosts a presentation about some tech topic. It's not necessarily about our ...
323
votes
13answers
95k views

So Singletons are bad, then what?

There has been a lot of discussion lately about the problems with using (and overusing) Singletons. I've been one of those people earlier in my career too. I can see what the problem is now, and yet, ...
2
votes
6answers
914 views

Is “call and return” a pattern or an antipattern?

Imagine to have this code: class Foo: def __init__(self, active): self.active = active def doAction(self): if not self.active: return # do something f=Foo(false) f.doAction() ...