design-patterns

A more generic visitor pattern

I'm sorry if my question is so long and technical but I think it's so important other people will be interested about it I was looking for a way to separate clearly some softwares internals from their representation in c++ I have a generic parameter class (to be later stored in a container) that can contain any kind of value with the t...

In C#, isn't the observer pattern already implemented using Events?

After reading the Head First Design Patterns book and using a number of other design patterns, I'm trying to understand the Observer pattern. Isn't this already implemented using Events in the .NET Framework? ...

What is a good online resource for css 'design patterns'?

Hi, Can anyone out there recommend a good online resource for CSS 'design patterns'? I know design patterns in a software context usually refer to OO based design patterns, but I mean design patterns in the broader sense of the term: i.e. common, clean solutions to common problems / tasks. An example of such a resource would be this l...

What are some real life examples of Design Patterns used in software

Hi everyone, I'm reading through head first design patterns at the moment and while the book is excellent I also would like to see how these are actually used in the real world. If you know of a good example of design pattern usage (preferably in a OSS program so we can have a look :) then please list it below. ...

Beyond GoF design patterns

Do you frequently use design patterns outside the Gang of Four design patterns book? If so, where did you pick them up from? ...

What design pattern is PEAR DB_DataObject implementing?

DB_DataObject does not appear to be ActiveRecord because you do not necessarily store business logic in the "table" classes. It seems more like Table Data Gateway or Row Data Gateway, but I really cannot tell. What I need is good ORM layer that we can use with DataMapper and a DomainModel. Any ideas? ...

Is there a way to access web.xml properties from a Java Bean?

Is there any way in the Servlet API to access properties specified in web.xml (such as initialization parameters) from within a Bean or Factory class that is not associated at all with the web container? For example, I'm writing a Factory class, and I'd like to include some logic within the Factory to check a hierarchy of files and conf...

How are partial methods used in C# 3.0?

I have read about partial methods in the latest C# language specification, so I understand the principles, but I'm wondering how people are actually using them. Is there a particular design pattern that benefits from partial methods? ...

Python and the Singleton Pattern

What is the best way to implement the singleton pattern in Python? It seems impossible to declare the constructor private or protected as is normally done with the Singleton pattern... ...

Double dispatch in C#?

I have heard/read the term but don't quite understand what it means. When should I use this technique and how would I use it? Can anyone provide a good code sample? ...

What is the best way of adding in regularly used blocks of code when marking up in TextMate?

Caveat: I'm relatively new to coding as well as TextMate, so apologies if there is an obvious answer I'm missing here. I do a lot of HTML/CSS markup, there are certain patterns that I use a lot, for example, forms, navigation menus etc. What I would like is a way to store those patterns and insert them quickly when I need them. Is the...

Database Patterns

Does anyone know of papers/books/etc. that document patterns for databases? For example, one common rule of thumb is that every table should have a primary key and that the key should be devoid of information content. So I was wondering if anyone had written a book or published papers regarding design patterns for designing relational ...

preferred way to implement visitor pattern in dynamic languages?

As an exercise for myself, I was translating a sample program into various languages. Starting in C#, I had a visitor-pattern interface like so: interface Visitor { void Accept(Bedroom x); void Accept(Bathroom x); void Accept(Kitchen x); void Accept(LivingRoom x); } Moving to ruby (or python, ...

IoC Explain and more important when to use it?

I am designing a new system and I want to know IoC and more important when to use it. Does it have to be implemented with interfaces or can be done with classes? Thanks ...

Data Validation Design Patterns

If I have a collection of database tables (in an Access file, for example) and need to validate each table in this collection against a rule set that has both common rules across all tables as well as individual rules specific to one or a subset of tables, can someone recommend a good design pattern to look into? Specifically, I would l...

When should you use the singleton pattern instead of a static class?

Name the design considerations in deciding between use of a singleton versus a static class. In doing this, you're kind of forced to contrast the two, so whatever contrasts you can come up with are also useful in showing your thought process! Also, every interviewer likes to see illustrative examples. :) ...

Why do most system architects insist on first coding to an interface?

I'm not asking this question out of spite, but I really want to know, because I might be missing something. Almost every Java book I read talks about using the interface as a way to share state and behavior between objects that when first "constructed" did not seem to share a relationship. However, whenever I see architects design an app...

Sources of inspiration for navigation breadcrumbs

I'm looking for sources of inspiration and/or design patterns for navigation 'breadcrumbs'. So far I have found the breadcrumb collection on Pattern Tap. Does anyone know of any other sources? ...

Design Pattern for Undo Engine

I'm writing a structural modeling tool for a civil enginering application. I have one huge model class representing the entire building, which include collections of nodes, line elements, loads, etc. which are also custom classes. I have already coded an undo engine which saves a deep-copy of the model class after each modification to ...

What design patterns do you use most often?

As a relative newcomer to the concept of design patterns, what are some of the most frequently used patterns? This will help me focus my studies to patterns that may be relevant to the largest number of issues. ...