design-patterns

Should I use dynamic cast in the subject observer pattern with templates

By referring to article Implementing a Subject/Observer pattern with templates template <class T> class Observer { public: Observer() {} virtual ~Observer() {} virtual void update(T *subject)= 0; }; template <class T> class Subject { public: Subject() {} virtual ~Subject() {} void atta...

Design patterns skill test?

Do you know web site or book for Design patterns skill test? ...

Aggregate Root question

Hi all, in one of my project I have a Garage class. This class contains many collections, like Addresses, BankAccounts, Memberships, etc. All these collection classes have a validity. Meaning that an address can be valid in a period of time specified by a user. New addresses or bank accounts can be added, but the validity period is no...

Disadvantage of object composition over class inheritance

Most design patten books say we should "Favor object composition over class inheritance." But can anyone give me an example that inheritance is better than object composition. ...

In Rails, what are some good View-specific design patterns that make handling many states easier?

The anti-pattern that I want to kill is: - if !current_user # do something - if !member # do something else - if admin # blah blah blah - else # Bored now. I suspect the answer has something to do with view helpers and partials, but I'm wondering what some of the best practices and design patterns are. Thanks! ...

Data/Database Design Patterns?

I would like to study more on the subject of complete data design patterns. Specifically, the different mixes of technologies to store, process, cache, and retrieve data. In other words, look at how many components are used in large systems like facebook. To my knowledge, we have RBMS and NoSQL flavors of database categories. However, m...

How to decide among Quality attributes when designing a software architecture

I am starting to develop the architecture for software product in a university project. I have gone through the various quality attribute types and am wondering how one selects between them as they are all necessary for good software. I already know which design pattern to use but still need to work these quality attributes into the de...

Data attribute table vs many small tables

I am working for a client that currently has a DataAttributes table with columns Name, Type, Value, and ParentID. This table is used to store virtually everything such as US states, anatomical items, combo box selections, and system settings. I would seriously like to get rid of this table and break each section into its own table. Are ...

Dictionary based switch-like statement with actions

Hi, I'm relatively new to Python and would like to know if I'm reinventing a wheel or do things in a non-pythonic way - read wrong. I'm rewriting some parser originally written in Lua. There is one function which accepts a field name from imported table and its value, does some actions on value and stores it in target dictionary under ...

POCO's - Are they associated with a specific Design Pattern (or patterns)?

Just wondering if the use of POCO's is associated with a particular design pattern. ...

Model View Controller Design pattern Code Example

I was studying the Model-View-Controller design pattern and i understand the concept behind the pattern theorotically, but I wanted to get a peek at how one would actually put it to practice. Wikipedia mentions Wt - Web toolkit, CppCMS and some other standard implementations which use the pattern however I have not been familiar with the...

Explaining why dual purpose classes are bad

I have a class in a system that lists its purpose as "This can either be seconds-from midnight. Or a time with a date." I have tried to explian how bad this is but I cant get my point accross. Do anyone have any ideas on how to tackle this. http://code-slim-jim.blogspot.com/2010/10/object-anti-patterns.html ...

How Utility functions can be shared across various classes ?

Hi, I had a class Display with 2 utility functions getDate and getTime like below. class Display { public: void getDate(char *pDate); //Utility functions for converting to custom format void getTime(char *pTime); }; Later, In other class called Retriever also, i needed the same Utility functions getDate and getTime. I do not want ...

SOA/WCF dissecting the system & service boundaries

I'm building a system which will have a few channels feeding different clients (MonoDroid, MonoTouch, Asp.Net Mvc, REST API) I'm trying to adopt an SOA archetecture and also trying to adopt the persistence by reachability pattern (http://www.udidahan.com/2009/06/29/dont-create-aggregate-roots/) My question relates to the design of the...

Why people use message/event buses in their code?

I think that you have heard of message/event buses, it's the single place when all events in the system flow. Similar architectures are found in computer's motherboards and LAN networks. It's a good approach for motherboards and networks as it reduces the number of wires, but is it good for software development? We don't have such restri...

Efficient Java observer design for distributing sensor data (~40Hz)

Hi:I want to design a structure for letting sensor data ( 3 float values at around ~40Hz) be accessible through something like an Observable. But by using the java Observable/Observer class a high overhead will affect the performance. What are the known approaches to keep it efficient and make it structured as well? ...

Design patterns criticism sources

I was reading Design patterns page on Wikipedia. And more particullary "Criticism" section. Could you point me to some articles or books about shortcomings of design patterns? ...

C# factory question

Consider the factory method below which takes some meta data and creates a column of the relevant type. Its all good until I encounter a column which relies on some additional data (ColumnType.DropDownList). This needs some additional data (a list of values) for display purposes. I dont want to provide this data at a meta data level ...

Design Patterns and Scala

I'm writing this question to maintain a register of design patterns associated with Scala, standards patterns or only from this language. Associated questions: Scala Catalog of functional Design Patterns Thanks to all who contribute ...

Customer has 8 or 9 products which are 80% similar. Which design pattern is this?

Am familiar with the Head First book (in fact, thought it was brilliant), though sometimes it left me a bit confused with regard to patterns overlapping somewhat. But not really tried before to sit down and match a pattern from theory with a real world requirement. Well, we now have a requirement for which I think we should be thinking ...