design-patterns

Why and Where do we use down casting?

Are there any cases where we do down casting of objects? If we do, why? I have observed a way of hiding implementation using the below code. Is this the correct way to do? Is there any better way to achieve the same. class A{ public: A(); virtual ~A(); //exposed virtual functions }; class AImpl : public A{ p...

What do you mean by thin-client application?

What do you mean by thin-client application? ...

When to use extends and when to use interface?

We can extend a class but we cannot implement a class. We can implement an interface, but cannot extend an interface. In what cases should we be using extends? ...

A design problem

What I have? I have below requirements: Search the database and return TreeNode objects to build a tree view Search the database and return a generic list to construct a diagram. Extensibility should be there to do search and return different type of objects Database is huge and performance should be considered with high priority Wh...

When to use Factory method pattern?

When to use Factory method pattern? Please provide me some specific idea when to use it in project? and how it is a better way over new keyword? ...

Data Access Layer or having object with CRUD methods?

I used to have a Data Access Layer that take the object by parameter and handle with abstraction the type of persistence required. At my new job, the architect is thinking to implement CRUD operation (load..save..delete..update) into all model object. Those method would have an object by parameter that will handle the saving of the objec...

Ways to circumvent a bad database schema?

Our team has been asked to write a Web interface to an existing SQL Server backend that has its roots in Access. One of the requirements/constraints is that we must limit changes to the SQL backend. We can create views and stored procedures but we have been asked to leave the tables/columns as-is. The SQL backend is less than ideal....

Which Presentation Pattern would you choose to design a jsf-based app ?

Pros and cons of : Supervising Controller / Passive View / Presentation Model ... ...

What makes MVVM uniquely suited to WPF?

The Model-View-ViewModel is very popular with WPF and Silverlight. I've been using this for my most recent projects, and am a very large fan. I understand that it's a refinement of MVP. However, I am wondering exactly what unique characteristics of WPF (and Silverlight) allow MVVM to work, and prevent (or at least make difficult) this...

Having several data access logical components vs having just one

Hi, Say DB has three tables: Customer, Order and Products. DAL layer could use just one class ( aka one data access logical component ) to perform CRUD operations on all three tables, or it could use three different classes (aka three different logical components): 1) Customer Data Access Logic Component 2) Order Data Access Logic C...

MVC pattern in JAVA

What are the advantages and disadvantages in MVC patterns when it's using in Java? ...

Object design pattern problem in Python

Hello, I have the following design decision to make - running into it for the second time, so I hope I'm not the only one... I have various Command classes that represent some actions. Each Command class (there are many, say SleepCommand, RunCommand, MeasureCommand) has different parameters with default values and so on, but in the end...

What is the simplest way to do background tasks in Windows.Forms?

Background tasks being stuff that involves network I/O, disk I/O, or other long-running tasks that may or may not take place over a network. It will often intermix with code that updates the GUI, which needs to be running on another thread, the GUI thread. Simple meaning that when opening a Form.cs file, the source code is as easy or e...

Example of a school website (college and highschool) which is functional and accessible

I'm looking for good example of school websites that I can get some inspiration it could be Highschool or College. I'm planning to build a template or platform of a school website; And I want to provide a good solution for a school which don't have website yet. I want to get some Ideas how school website pages being structured and what...

How to renew a weird Applications without making the same errors?

My new project is to renew Software that a customer had used for years. Like we all know...things grew over the years. So i looked at the old app. get all Infos about it and wrote a lot of user stories down. After cleaning it up i recognized that i made (in the end) a mistake that leads to the same problem that the customer has now. It...

When NOT to use MVC in a Web Application?

I was working on sketching out some ideas for a new project, and realized that I was having some difficulty getting things to fit into an MVC framework (In the case, CodeIgniter) In a way I liked. While I believed this can be overcome by working with the design some more and figuring out a better layout, It got me to thinking: could MVC...

Don’t know enough to know if this design is a great idea or an incredibly dumb one …

Using C#, asp.net 3.5, SqlServer 2005, Trying to incorporate some inversion of control together with 3-tier architecture into my current assignment. Don’t know enough to know if this is a great idea or an incredibly dumb one: I have created a User Interface Layer, a Business Layer, and a Data Layer. The UI collects 4 values, News a...

Design Pattern for passing a translation object around? For PHP

I'm updating an php web application that is becoming multilingual, based on the Zend MVC framework, and I'm trying to figure out the best approach to passing the translation object to different classes/layers. Most of my translation is done at the View level, but there are a few cases where I need to return status messages from custom l...

Tell me what is stupid about my Entity Validation (and how to improve it)

I have an IEntity interface that implements an interface, IValidatable public interface IValidatable { bool IsValid { get; } bool IsValidForPersistence { get; } // Rules applied at UI time (please enter your name, etc) IEnumerable<RuleViolation> GetRuleViolations(); // Rules to be applied only at persistence time ...

Which design pattern looked the most horrendous upon first glance, but ended up being the most beautiful once implemented?

I ask because most patterns are pretty intimidating at first glance, and I haven't had much experience coding them. Most that I've had the chance to implement were worth the effort, but some made me feel like I wasted my time. I'd like to try taking down a beast and finding that it was not as much of a struggle as it initially seemed. H...