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

learn more… | top users | synonyms (1)

5
votes
2answers
354 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 ...
9
votes
4answers
445 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 ...
29
votes
1answer
6k views

What is the difference between the factory pattern and abstract factory?

Having finally begun seriously trying to learn some basic patterns (very late in the career, but that's a different story), I'm trying to get my head around the differences between the Factory Pattern ...
6
votes
1answer
3k 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 ...
16
votes
3answers
1k views

Newbie question about Decorator design pattern

I was reading a programming article and it mentioned the Decorator pattern. I've been programming for awhile but without any kind of formal education or training, but I'm trying to learn about the ...
2
votes
5answers
469 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 ...
6
votes
6answers
4k views

When you use inheritance to reuse code, do you find it too tricky that it swallows the benifits of reuse?

I've been coding for about 8 years, however I still find inheritance is too flexible and sometimes it makes you totally confused with the code you have written. One simplest example would be: ...
6
votes
3answers
2k views

How can I practice design patterns and refactoring in a deliberate way?

I was reading the book Refactoring to patterns and was wondering how I can get chance to practice the skills, because without deliberate practice on new ways to refactor and use patterns, my skills ...
4
votes
8answers
2k views

What do you consider to be the essential design patterns? And do you use them? [closed]

It seems to me that programmers have an increasingly uphill task of staying up-to-date. In my efforts to improve my programming ability, I am in search of the essential design patterns that are ...
4
votes
3answers
620 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 ...
14
votes
2answers
3k views

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

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. ...
21
votes
7answers
9k views

Why avoid Java Inheritance “Extends”

Good day! Jame Gosling said “You should avoid implementation inheritance whenever possible.” and instead, use interface inheritance. But why? How can we avoid inheriting the structure of an object ...
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 ...
17
votes
5answers
2k views

Why is MVC more popular than PAC?

I just stumbled upon a question at SO about PAC and got interested in the pattern. I'm wondering why it's not as widely used as MVC? What is the MVC benefits compared to PAC?
32
votes
4answers
6k views

The importance of Design Patterns with Javascript, NodeJs et al

With Javascript appearing to be the ubiquitous programming language of the web over the next few years, new frameworks popping up every five minutes and event driven programming taking a lead both ...
10
votes
3answers
13k views

What are DRY, KISS, SOLID, etc. classified as?

Is something like DRY a design pattern, a methodology, or something in between? They do not have specific implementations that could neccessarily be demonstrated(even if you can easily demonstrate a ...
1
vote
1answer
502 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 ...
3
votes
2answers
602 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 ...
7
votes
1answer
366 views

Does current evidence support the adoption of Contextual over Canonical Data Models?

The "canonical" idea is pervasive in software; patterns like Canonical Model, Canonical Schema, Canonical Data Model and so on, seem to come up again and again in development. Like many developers, ...
17
votes
8answers
763 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 ...
6
votes
6answers
607 views

When to write Abstract code and when to be more specific?

I'm working on a small tool as a toy project to show the difference between two directories, showing which files/directories were added, removed, modified, etc. I was trying to represent these ...
68
votes
10answers
7k views

Are design patterns really essential nowadays?

I was reading "Coders at Work" and have faced the fact that some of the professionals interviewed in the book are not so enthusiastic about design patterns. I think that there are 2 main reasons for ...
5
votes
3answers
330 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 ...
8
votes
3answers
709 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 ...
16
votes
2answers
5k views

What are the drawbacks to the ActiveRecord pattern?

I'm curious what are the drawbacks to using the ActiveRecord pattern for data access/business objects. The only one I can think of off the top of my head is that it violates the Single Responsibility ...
12
votes
4answers
2k views

What is pattern based programming?

Can somebody explain the obsession with patterns and anti-patterns in programming? I ask because I have absolutely no idea what any of the patterns mean. When faced with a programming task I think ...
9
votes
4answers
1k views

How does thinking on design patterns and OOP practices change in dynamic and weakly-typed languages?

There is a fairly helpful question already along these lines ("Non-OOP Design Patterns?"), but I am more curious about a transitional point of view for someone just getting started with dynamic and ...
4
votes
3answers
572 views

How to show someone of the power of model-view-controller design pattern?

I've been working with a friend on a project that we've taken over, and I've realized that we have a big problem implementing the model-view-controller design pattern due to the way that the project ...
1
vote
2answers
803 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. ...
18
votes
2answers
6k 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 ...
58
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 ...
11
votes
7answers
524 views

Introducing design concepts/patterns/principles to co-workers

I've read Joel's article about getting things done when you're a "grunt", several times in fact, but I've never been able to do any of the things it mentions. I work as part of a small development ...
5
votes
4answers
987 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 { ...
6
votes
3answers
941 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
208 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
469 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
288 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
823 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
647 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
1k 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
545 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
4k 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
307 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 ...