design-patterns

Delphi: Good pattern/strategy for view <-> model synchronization

There's a lot of talk about model-view-controller, model-view-viewmodel, model-view-presenter and so on these days. What do you see as the best pattern for use with delphi and non-data aware components? How do you usually implement it? ...

Why for most of the Application MVC design pattern is opted for compared as other design patterns ?

Hi, My question is regarding design patterns, why most of the Web Applications currently employs Model-View-Controller Design Patterns as compared to other Design Patterns ? Thanks. ...

Dynamically created scope guards

I've read the article about scope guards (Generic: Change the Way You Write Exception-Safe Code — Forever) in DDJ and I understand their common use. However, the common use is to instantiate a particular stack guard on the stack for a particular operation, e.g.: { FILE* topSecret = fopen("cia.txt"); ON_BLOCK_EXIT(std::fclose, t...

ASP.NET MVC - Entities having in-built logic vs Business Services

Hi, My current architecture is based around my entities being simple containers for data with little or no logic within them. Any business decisions are made by Service classes which take entities as arguments and then return data back. However, I'm finding that this approach is becoming a little unwieldy as our systems grow in size. ...

Design Pattern rich code base ?

Am new to design patterns, could you recommend a open code base (preferably in java) that has design patterns used explicitly and elegantly. Reading up GOF has left me confused am looking for a project that used a few patterns that interacted with each other. thanks. ...

C# inheritance design-pattern question

Hi, I am storing data with different formats and lengths. I have a class hierarchy to represent this: abstract class BaseDataFormat{ abstract void InitalizeFromBytes(byte [] ); } class DataFormat1 : BaseDataFormat{...} // data stored in 3 bytes class DataFormat2 : BaseDataFormat{...} /// data stored in 4 bytes When I am readin...

Factory Creation Methods Always Static?

It's common place for factory classes to be static, and factory methods to be static also. Did the GOF in the Design Patterns book ever stipulate that factories and their methods MUST be static in order to meet the strict definition of the pattern? Is having factories+/methods static just a consequence of the pattern? state data is not...

Design Problem - Using a 'variation' on State Pattern - C++

Overview: I am trying to improve the design of a program that I am using state pattern for. I will post a brief description of the problem, an image of the class diagram/description of the current design, followed by header code for the relevant classes. Problem: I'm using a variation of the State Pattern for a program. In this ...

singletonclasses

how to create singleton classes for multiple uses and how to connect to jsp with that singleton class ...

Storing values of any type as type initially supplied in templated factory method in C++?

This is a slightly different question to this one ([http://stackoverflow.com/questions/1566445/accessing-a-method-from-a-templated-derived-class-without-using-virtual-functions%5D%5B1%5D) which I asked recently. I would like to create an instance of an object using a templated factory method, then from then on only be able to set and ge...

how to design system so users can generate their own objects using dlls

I have a server which takes some messages x and outputs some messages Y. Currently the x to y mapping is fixed. So x1 will always generate y1 with corresponding fields. But now I want to be able to make it configurable such that the users can put their own dll which will generate x1 to y2, y3, or however they want. In case if they don'...

Design to distribute work when generating task oriented input for legacy dos application?

I'm attempting to automate a really old dos application. I've decided the best way to do this is via input redirection. The legacy app (menu driven) has many tasks within tasks with branching logic. In order to easily understand and reuse the input for these tasks, I'd like to break them into bit size pieces. Since I'll need to start a f...

Are design patterns really language weaknesses?

Should today's patterns be seen as defects or missing features in Java and C++? Subroutine was a design pattern for machine language in the 50s and 60s. Object-Oriented Class was a design pattern for C in the 70s. Visitors, Abstract Factories, Decorators, and Façades are design patterns for Java and C++ today. What will tomorrow's l...

Purpose of Dispose calling Dispose(IsDisposing) pattern in C#?

Here is code from MSDN. I don't understand why the work isn't just done in the regular Dispose() method here. What is the purpose of having the Dispose(bool) method? Who would ever call Dispose(false) here? public void Dispose() { Dispose(true); // Use SupressFinalize in case a subclass // of this type implements a fina...

Is the Composite Pattern SOLID?

the leaf in the composite implements the Component that has the Add Remove and GetChild methods that he is never going to use (violation of the Interface segregation) so is the usage of composite pattern SOLID ? link to composite http://www.dofactory.com/Patterns/PatternComposite.aspx ...

I'm going to write 'Unit of Work', please help me find out all gimmicks

Hi everybody, I'm going to write my own DAL in C#. I decided to use 'Unit of Work' pattern (next mentioned as uow) with request as a scope and Identity map stored in HttpContext.Items. I have right now question about implementing of CRUD methods. How/where are they implemented? Are they implemented in every single business class (as in...

How to avoid excessive parameter passing?

Dear Stackoverflow'ers, I am developing a medium size program in python spread across 5 modules. The program accepts command line arguments using OptionParser in the main module e.g. main.py. These options are later used to determine how methods in other modules behave (e.g. a.py, b.py). As I extend the ability for the user to customise...

A very basic question about the way GUI integrated with the Logic classes

hi, assume i have a huge input form, which of course representing classes. i need this input to be loaded into the class's instances. this input obviously contains (some very complicated validation) checks, obviously the logic layer contains those input validation already. the question is what am i doing with gui. should i just, in a v...

.Net Design pattern for storing and retrieving sensitive per user data

Are there any reference patterns for .Net server applications relating to storing and retrieving sensitive per user information such as 3rd party credentials? My preliminary design thoughts are along the lines of: Generate a self signed X509 certificate with appropriately strong private key, Export the certificate and key and store th...

Infrastructure: models as an external to an application to avoid stored procedures

My thoughts: I absolutely despise stored procedures for various reasons: cost, scalability, and compatibility. Cost: I can get 2-3 good light weight web application servers for the cost of one good MySQL server. Scalability: Sure I can cache query results, but when using stored procedures I lose the opportunity for a much finer ...