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

learn more… | top users | synonyms (1)

5
votes
3answers
1k views

Design Anti-Patterns - C# - Do you call this a God object?

I am writing Portfolio module for my web site and it has 3 components. Gallery Category, Gallery, & Gallery Images. I am doing all the request handling, (creating, reading, updating, other), for ...
10
votes
9answers
2k views

Design Patterns: Should I learn them? [closed]

So it's kinda weird asking two questions back-to-back, but they aren't very related and I didn't want to combine them, but I'm not spamming questions, I promise! Anyway, I'm a recent college grad, ...
6
votes
1answer
4k views

Permissions/right model/pattern for .NET application

I need to implement flexible AND simple (if such thing exist) and at the same time utilize built-on means if possible So far I have MembershipProvider and RoleProviders implemented. This is cool but ...
4
votes
4answers
558 views

Should strategy objects have state?

I have an application object that needs to validate some data. The particular validation algorithm isn't known until runtime, so I pass a validation object to it, using the strategy pattern. The ...
5
votes
2answers
406 views

Iterative alternative to decorators?

So decorators wrap a base class recursively, right? And have a single super class object which is at the "core" class. Couldn't you just add an ArryList/LinkedList of decorations in the "core" class ...
14
votes
2answers
3k views

What are the main practices and design patterns every .NET guy should know? [closed]

In my brief time as a professional programmer I've seen lots of applications written by programmers who's entire education appears to have been reading the first couple of chapters in a .NET 2.0 book. ...
9
votes
4answers
545 views

What “code smells” are there that are a symptom that an event listener model is required?

What are the symptoms in a code base that indicate that an event-listener approach is required? It seems to me that when there are classes that need to be called by multiple, not defined at ...
6
votes
1answer
4k views

Python programming patterns and practices? [closed]

What are the best python programming patterns and practices you are using every day? I don't mean only design patterns (there are lot of OO design patterns that can be used in python), I mean pure ...
2
votes
5answers
496 views

Anti patterns - Worth spending time or not

I have read this question and after a very long time it's clear I still don't understand anti-patterns. perhaps, it raised a new level of curosity to know why should I read Anti design pattern if they ...
3
votes
2answers
2k views

Data Access Layer, Business Class or Repository?

I've been having a debate within my team on what constitutes a Data Access Layer vs Data Functions vs Business Layers. My thoughts is all database access is done in a data access layer with ...
3
votes
2answers
613 views

Delegate pattern for retrieving data v.s. using simple setters

I am considering using the Delegate Pattern to get some data necessary for an operation. There are a few different pieces of data that the algorithm needs to run, but they all have default values that ...
4
votes
3answers
720 views

Architectural Patterns for a Game

So I've got a solution that contains a few big projects, which I'm trying to break down into smaller projects with more isolated responsibilities. This is a game I'm tinkering with -- I'm mainly a LOB ...
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 ...
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 ...
5
votes
3answers
335 views

What design would you propose to log reporting data so that the capture of, say, an additional form field can implemented easier?

Why is there an emphasis to log reporting information through an application to a separate database? I have seen designs where a logging manager is available to every business layer class whether it ...
1
vote
1answer
618 views

Delegate Pattern : Delegate or Delegator?

I've a simple question about the terminology used in the Delegate pattern; Let's say I create an object that will be responsible to download something from the Net and when it is finished, will call ...
17
votes
8answers
832 views

How do “You Ain't Gonna Need it” and “Now is better than never” play together?

I often find myself embracing "now is better than never" when I'm advancing the DRYness of a design. Typically, I find that I need to cultivate an understanding of the One Authoritative Location for ...
8
votes
3answers
783 views

Using CSS classes as decorators - a good pattern?

I've been building a web-app with a fairly complex GUI - many small elements alongside eachother and within other elements that need various behaviours (dragging, clicking, but context-sensitive). My ...
18
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 ...
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 { ...
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 ...
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 ...
0
votes
2answers
214 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 ...
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 ...
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 ...
1
vote
3answers
289 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 ...
3
votes
2answers
510 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. ...
4
votes
3answers
885 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 ...
0
votes
1answer
705 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 ...
1
vote
1answer
320 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 ...
8
votes
2answers
569 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 ...
9
votes
1answer
567 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 ...
3
votes
3answers
643 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
325 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
546 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
851 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 ...
1
vote
5answers
296 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 ...
7
votes
3answers
2k views

Design pattern for window management in a Java Swing app

I've just started creating my very first little Java Swing app. When the program opens, it brings up a single, simple window with a label and a couple buttons. Clicking one of those buttons is ...
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 ...
9
votes
6answers
405 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 ...
22
votes
6answers
3k views

How much business logic should be allowed to exist in the controller layer?

Sometimes we have some business logic represented in the controller code of our applications. This is usually logic that differentiates what methods to call from the model and/or what arguments to ...
5
votes
4answers
4k views

Why GRASP patterns are less known than GOF ones?

Design patterns help developers to improve the quality of their design, but only GOF patterns are very known, and paterns like GRASP that gives a good concepts like Information Expert,low coupling and ...
2
votes
2answers
784 views

Multithreaded UI desktop application issues

I am involved into development a rich UI project: desktop windows application. Application uses asynchronous invocations and in its turn it should be ready to process external messages (events). The ...
5
votes
1answer
224 views

Need to re-build an application - how?

For our main system, we have a small monitor application that sits outside our network and periodically tries to log in to verify the system still works. We have a problem with the monitor though in ...
6
votes
2answers
689 views

How to program for constraints/rules

First the background, during interviews in the past, many times I have been asked to design some or other variation of card game as programming puzzle, and I have tried to design it in OO way, but I ...