design-patterns

What is the point of the finally block?

Syntax aside, what is the difference between try { } catch() { } finally { x = 3; } and try { } catch() { } x = 3; edit: in .NET 2.0? ...

What is the design pattern for processing command line arguments

If you are writing a program that is executable from the command line, you often want to offer the user several options or flags, along with possibly more than one argument. I have stumbled my way through this many times, but is there some sort of design pattern for looping through args and spinning off the appropriate functions? Consid...

Using Microsoft's Application Blocks

I haven't done a lot of .NET programming, but I have examined a few of the application blocks published by Microsoft's Patterns and Practices group. I was wondering how these are typically used: Linked directly into applications Source added into applications and built with them, perhaps with some customizations Sample code used as re...

What are bad programming practices in C?

I would just like a few things that you guys see as bad programing practices in pure C, so I can watch out for those. ...

What are the most commonly used anti-patterns?

I'm just wondering what are some of the classic mistakes we all make. I think before working on writing good code, you must learn to recognize bad code... especially when it's YOUR code! ...

lock keyword in C#

I understand the main function of the lock key word from MSDN lock Statement (C# Reference) The lock keyword marks a statement block as a critical section by obtaining the mutual-exclusion lock for a given object, executing a statement, and then releasing the lock. When should the lock be used? For instance it mak...

Any recommendation for a good enough Winforms GUI design?

I am developing a mid-size application with VB2008. To better test my application I am following a MVP/Supervising Controller approach. My question is: What are your recommendations to separate responsibilites? So far I've come up with a winform with an instance of a controller and with an instance of my class. The controls are updated ...

Best design for entities with multiple values

Say you have an entity like a vehicle that you are capturing detailed information about. The car you want to capture is painted red, black and white. The front tires are Bridgestone 275/35-18 and the rear tires are 325/30-19. And sometimes you can have just two tires (yes this would be considered a motorcycle which is a type of vehicle) ...

Design problem regarding type slicing with many different subclasses.

A basic problem I run into quite often, but ever found a clean solution to, is one where you want to code behaviour for interaction between different objects of a common base class or interface. To make it a bit concrete, I'll throw in an example; Bob has been coding on a strategy game which supports "cool geographical effects". These r...

Factory Pattern. When to use factory methods?

Hi, When is it a good idea to use factory methods within an object instead of a Factory class? Regards, -jj. ...

Efficient way to implement singleton pattern in Java

Efficient way to implement singleton pattern in Java? ...

Enterprise Design Patterns for .NET

I was told that this book is a standard when it comes to enterprise design patterns (sort of like the GoF book). Is there a book that covers exactly what this book does only with .NET? ...

Dataflow Programming - Patterns and Frameworks

I just came across the proposed Boost::Dataflow library. It seems like an interesting approach and I was wondering if there are other such alternative frameworks for C++, and if there are any related design patterns. I have not ruled out Boost::Dataflow, I am just looking into any available alternatives so I can understand the domain an...

Do you know any examples of a PAC design pattern?

Can anyone point to any websites or web applications that are using the Presentation-Abstraction-Control design pattern rather than MVC? Desktop applications are easy to find like this (e.g.; GIMP) but I'm looking for something on the web. ...

Custom events in C++?

Is it possible to create custom events in C++? For example, say I have the variable X, and the variable Y. Whenever X changes, I would like to execute a function that sets Y equal to 3X. Is there a way to create such a trigger/event? (triggers are common in some databases) ...

Clean implementation of the strategy pattern in Perl

How do I write a clean implementation of the strategy pattern in Perl? I want to do it in a way that leverages Perl's features. ...

design patterns or best practices for shell scripts

Does anyone know of any resources that talk about best practices or design patterns for shell scripts (sh, bash etc...)? ...

Reporting with db4o

I've used db4o with much success on many projects in the past. Over time it seems to have evolved greatly, and with modern trends like LINQ on everyone's tongue it has peaked my interest again, especially now that I know that it is starting to support transparent activation and persistence which intrigue me quite a bit, but a friend pose...

PubSub lib for c#

Is there a c# library which provides similar functionality to the Python PubSub library? I think it's kind of an Observer Pattern which allows me to subscribe for messages of a given topic instead of using events. ...

Dynamic contact information data/desing pattern: Is this in any way feasible?

I'm currently working on a web business application that has many entities (people,organizations) with lots of contact information ie. multiple postal addresses, email addresses, phone numbers etc. At the moment the database schema is such that persons table has postal address columns, phone number columns as does organizations table. ...