design-patterns

Design considerations for temporarily transforming a player into an animal in a role playing game

I am working on a role playing game for fun and to practice design patterns. I would like players to be able to transform themselves into different animals. For example, a Druid might be able to shape shift into a cheetah. Right now I'm planning on using the decorator pattern to do this but my question is - how do I make it so that when ...

Multiple Threads

I post a lot here regarding multithreading, and the great stackoverflow community have helped me alot in understand multithreading. All the examples I have seen online only deal with one thread. My application is a scraper for an insurance company (family company ... all free of charge). Anyway, the user is able to select how many thre...

Design pattern for ongoing survey anayisis

I'm doing an ongoing survey, every quarter. We get people to sign up (where they give extensive demographic info). Then we get them to answer six short questions with 5 possible values much worse, worse, same, better, much better. Of course over time we will not get the same participants,, some will drop out and some new ones will si...

Using a singleton to store global application parameters

Hi, i'm developing a simple simulation with OpenGL and this simulation has some global constants that are changed by the user during the simulation execution. I would like to know if the Singleton design pattern is the best way to work as a temporary, execution time, "configuration repository" ...

Realising Class Diagram for the problem

I need to develop a certain sw module which outputs the data in the following format Main object and related object and Quantity i.e Desktop Computer ---- CPU 1x ---- Mouse 1x ---- KB 1x ---- Monitor 1x ---- Speakers 2x ...

Observer design pattern in C++

Is the observer design pattern already defined in STL (Like the java.util.Observer and java.util.Observable in Java) ? ...

Strategy to implement tree traversing algorithm in parallel?

I have implemented an iterative algorithm, where each iteration involves a pre-order tree traversal (sometimes called downwards accumulation) followed by a post-order tree traversal (upwards accumulation). Each visit to each node involves calculating and storing information to be used for the next visit (either in the subsequent post-or...

Scope of Connection Object for a Website using Connection Pooling (Local or Instance)

For a web application with connection polling enabled, is it better to work with a locally scoped connection object or instance scoped connection object. I know there is probably not a big performance improvement between the two (because of the pooling) but would you say that one follows a better pattern than the other. Thanks ;) public...

How to allow derived class to call methods on other derived class? OO-design

Say I have something like -- this is just an example mind you. class Car { void accelerate(); void stop(); } class Person { void drive(Car car); } class Toyota : public Car { void accelerateUncontrollably(); } class ToyotaDriver : public Person { void drive(Car car) { // How to accelerateUncontrollably without...

Class design help needed

I need to develop a certain sw module which outputs the data in the following format Main object and related object and Quantity i.e Desktop Computer ---- CPU 1x ---- Mouse 1x ---- KB 1x ---- Monitor 1x ---- Speakers 2x This shall mean that for a Desktop Computer object, there shall be 1 CPU,1 Mouse,1 Keyboard,1 Monitor,2 speakers ...

How to implement Administrator rights in Java Application?

I am developing a Data Modeling Software that is implemented in Java. This application converts the textual data (stored in a database) to graphical form so that users can interpret the data in a more efficient form. Now, this application will be accessed by 3 kinds of persons: 1. Managers (who can fill the database with data and they c...

Extract rules that disable a control.

Background Weekly we will get some users calling out for help why thy can't do X on form Y. Because of complex business rules, we often have to revert looking in the code ourselves to know why that particular action is not available at that time. Are there any proven strategies to deal with this? How does one collect all the informa...

.NET application design with multiple line-of-business databases

Core company data is held and managed in physically separate, third-party, line-of-business applications: Finance, Transport Management. Customers are created in the Finance app (SQL Server), delivery information is held in the Transport Management app (Oracle). Communication between the two is point-to-point. We need to build a new app...

Try, Catch Problem

I've noticed this problem happening a lot in most things I do, so I'm thinking there must be a design pattern for this. Basically if an exception is thrown, attempt to solve the problem and retry. If I place it in the try, all it will do is catch the exception, but I want to retry whatever it was doing and if it fails again, retry again...

Automatic generation of immutable class and matching builder class

What tools/libraries exist that will take a struct and automatically generate an immutable wrapper and also a "builder" class for incrementally building new instances? Example input: struct Foo { public int apples; public int oranges; public Foo Clone() {return (Foo) base.MemberwiseClone();} } Example output: public clas...

Design Pattern for Data Processing? (MVC alternative)

As a PHP/Web Developer, I'm a huge fan of MVC (Model-View-Controller). I love building an app on a solid foundation which definitely separates business logic, presentation logic, and flow of control. However, I do a lot of work as well on server-side-only apps, which merely process data and log the process and any relevant results (such...

Difference between the Composite Pattern and Decorator Pattern?

What is the difference between the Composite Pattern and Decorator Pattern? ...

Where to look up design pattern of symfony ?

The official website seems only provided some tutorial on how to use: http://www.symfony-project.org But I want to know why the directories should be setup like this ...

Benefits of using FormViewModel in Controllers vs. Partial Model Class in Models

Hello everybody, I am having a difficult time understanding two design approaches in terms of long time extensibility in my current ASP.NET MVC application. The ORM that I use for providing data is Linq2SQL. Which is just amazing to work with, BTW! Now I am having some trouble with the design of my model classes for my views. Currentl...

Pluggable Error Handling Strategy

Hi, I have service object (Service A), that has some specific repetitive asynchronous task . This service object also has a supervising object (Service B). I want to handle most of the errors concerning the specific task in Service A and only inform Service B if it needs to take any additional measures (e.g. when Service A does not kno...