A design pattern is a general reusable solution to a commonly occurring problem in software design.

learn more… | top users | synonyms (1)

20
votes
3answers
5k views

Where we should put validation for domain model

I still looking best practice for domain model validation. Is that good to put the validation in constructor of domain model ? my domain model validation example as follows: public class Order { ...
14
votes
2answers
1k views

What is a 'good number' of exceptions to implement for my library?

I've always wondered how many different exception classes I should implement and throw for various pieces of my software. My particular development is usually C++/C#/Java related, but I believe this ...
10
votes
6answers
1k views

Is it necessary to know and understand design patterns in order to be a professional programmer? [duplicate]

Possible Duplicate: Are design patterns really essential nowadays? Is it necessary have a knowledge and understanding of design patterns for someone to be a professional programmer? Why?
4
votes
2answers
599 views

Age of Design Patterns

When did these design patterns originate? Balking, Builder, Delegation, Facade, Memento. I have looked for days across the net, so if someone points me to a simple google search I may shoot myself. ...
0
votes
2answers
276 views

Inheritance versus Composition in a business application

I have a training management and tracking system, with a high level structure as follows: We have a Role1, e.g. Manager, Shift-boss, miner, etc. and a Candidate, training for that Role. The role has ...
19
votes
5answers
8k views

Is “Mapper” a valid design pattern or is it a variation of the “Factory” pattern?

A common pattern I see is what's known as the Mapper pattern (not to be confused with DataMapper which is something else entirely), which takes as an argument some kind of "raw" data source (e.g. an ...
6
votes
2answers
273 views

Should ActiveRecord-based domain models have visible properties? Why or why not?

Should ActiveRecord-based domain models have visible properties? Why or why not? My experience and studies have always lead me to believe that object properties should always be protected, and that ...
7
votes
2answers
466 views

Help me classify this type of software architecture

I read some books about software architecture as we are using it in our project but I can't classify the architecture properly. It's some kind of Enterprise Architecture, but what exactly... SOA, ESB ...
5
votes
4answers
507 views

Where does form processing belong in an MVC application?

I found this question on stack overflow and I have a question about one of the answers: In Zend Framework, forms are typically objects with decorators, but usually (I thought) processing is done ...
11
votes
8answers
987 views

How 'simple' is a real KISS solution? [closed]

I confess: I have a problem to "Keep It Simple and Short" most of the time because trying to make it according to the books I have read, design-patterns I have heard etc. gives me such an enthusiasm ...
3
votes
2answers
1k views

How do you organize an ASP.NET MVC 3 application with potentially hundreds of views but with only a few entry points?

Assumptions: Minimalist ASP.NET MVC 3 application for sending emails where the view represents the contents of an email. Over 500+ email types. I would NOT like to have 500+ actions in my controller ...
2
votes
3answers
530 views

RFC: Extending the MVC Design Pattern

I've been using the MVC pattern in my applications for years (with full separation of the controller from its views). Having to implement several hundred views to represent a little over 100 model's ...
2
votes
2answers
671 views

Translating objects from one type to a another

I am working on a server-client app in c# and need to send an object from the client to the server via WCF. For simplicity I will call it WorkingClass as it is what does the work. public class ...
6
votes
2answers
451 views

Is there a standard, formal name for an object or class that behaves as if it is a given object?

I have an app in Django that expects to get a record with the fields email, first_name, and last_name. However, sometimes I want to be able to send it something that isn't actually a record but ...
35
votes
5answers
9k views

Is object pooling a deprecated technique?

I am very familiar with the concept of object pooling and I always try to use it as much as possible. Additionally I always thought that object pooling is the standard norm as I have observed that ...
3
votes
2answers
739 views

Which GOF design patterns work well with TDD, and which do not?

The GOF Design Patterns book rarely mentions the test-ability of each pattern. I'm aware that there are patterns such as Singleton that would lead to code for which it is difficult to write unit ...
-11
votes
5answers
996 views

Are version control systems a form of design pattern? [closed]

I'm having some trouble understanding what a design pattern is and isn't, particularly with respect to version control systems like CVS and Git. Is "push, pop, stack" a "design pattern"? If yes, is ...
1
vote
2answers
522 views

Am I using Factory and Impl classes properly?

In my 2d destruction derby simulator I have a CargoTruck class and CargoTruckImpl that implement an interface called Truck. CargoTruck has a reference to CargoTruckImpl which is returned through the ...
10
votes
9answers
1k views

Is this an anti-pattern?

I've seen this a lot in our legacy system at work - functions that go something like this: bool todo = false; if(cond1) { ... // lots of code here if(cond2) todo = true; ... // some other ...
4
votes
1answer
435 views

Architecture: for a Single website to be supported for different Clients

I have developed a system with one company profile. The system is built using WCF services, asp.net. Now another company wants to use our system as well. And they might need some customization and ...
15
votes
2answers
5k views

DDD - Does an aggregate root's repository handle saving aggregates?

I am using a DDD-like approach for a greenfield module of an existing application; it's not 100% DDD due to architecture but I'm trying to use some DDD concepts. I have a bounded context (I think ...
2
votes
3answers
721 views

Recommended content for layers

As an expansion from my previous question about using separate projects for seperate layers - Good practice on Visual Studio Solutions I now wish to know if I am putting the right functionality in ...
2
votes
2answers
74 views

Should one define an interface and code an adapter for it whenever a dependency is found?

Given a particular third-party class/library you want to make use of, the simplest thing to do would be to just hardcode API calls to it through your application. On the other hand you have the ...
4
votes
3answers
409 views

What is the name for this variation to Adapter Pattern?

Introduction An Adapter normally wraps another object, so that it can be used in an interface it wasn't designed for, e.g., when you want to use interface Node { Node parent(); ...
2
votes
1answer
175 views

Is a multi-page web app unsuitable when reliable server pushes are required?

Imagine a call center web application with a soft phone that automatically detects when a call has started or the caller has hung up. The obvious approach to receiving these messages would be some ...
4
votes
1answer
688 views

When should the presentation model design pattern include one or more controllers?

I have been researching the usage of the Presentation Model design pattern for an application I am preparing to build. The specific technology I will be using is Flex though I doubt that it matters ...
4
votes
2answers
162 views

Designing around the constraints of external services in a client-server architecture

Suppose you have a client that interfaces with a server which in turn invokes an external service to fulfill some of the client's requests. I'm designing the client and server and need to accommodate ...
3
votes
2answers
621 views

Examples of MVVM adoption outside the Microsoft community?

IS MVVM getting any kind of traction outside the Microsoft community? Within Silverlight this is a non-issue, but for other technologies, like JavaScript it surely is: For instance Knockout.js is a ...
3
votes
8answers
2k views

Do I need to learn Design Patterns if I'm preparing to be Android Developer? [closed]

Please advise if it is required to learn design patterns if I'm studying for Android development?
11
votes
3answers
1k views

Tips/advice on how to reduce the use of “manager” classes?

I sometimes hear that having too many "manager" classes in your program's design is code smell and add an unnecessary layer of complexity. To me it makes sense that people want to use manager classes ...
0
votes
1answer
130 views

Name for WS pattern where a generic object is returned? [closed]

Two part question: I am working on a project where the webservices all return a generic object. On success, that object then contains the data returned from the webservice along with additional ...
2
votes
4answers
301 views

Is there a pattern for subscribing to fired events/messages at specific intervals?

I'm not sure if this a common scenario or not, but I have a need along the following lines: I have an object (I'll call it node) and this object has methods X, Y, and Z. I want to be able to have ...
5
votes
1answer
125 views

Checking members and instantiating in properties

Consider this: public MyClass { private Resource _myResource; public Resource MyResource { get { if(_myResource == null) { ...
5
votes
2answers
432 views

Trying to identify IClass, Class, ClassImpl pattern

I've been seeing a lot of code recently that looks like this: public interface IFoo { int Bar(); } public static class Foo { public static IFoo Create() { return new FooImpl(); } private ...
6
votes
1answer
5k views

Implementing a DAO for entity framework

Could anybody help me to find a good tutorial about how can I implement DAO pattern and also tools that help me to create this classes in automated way.
12
votes
8answers
1k views

Algorithm Vs Design [duplicate]

Possible Duplicate: Is it essential to learn algorithms to be a real programmer? This question is, perhaps, related mostly to web developers who, like myself, code enterprise applications ...
9
votes
4answers
742 views

Recommend a design pattern/approach to exposing/tolerating/recovering from system errors, Exception handling (e.g.s in Java, C++, Perl, PHP)

Can you recommend a design pattern/approach to exposing/tolerating/recovering from system errors, Exception handling (Java, C++, Perl, PHP)? Some errors need to be reported. Some errors can be ...
4
votes
3answers
991 views

How do you call a “Proxy” that delegates to *several* implementations?

In a traditional GoF Proxy, you have an Interface, an Implementation, that implements the Interface, and a Proxy that also implements the Interface, references an instance of Implementation, and ...
3
votes
4answers
241 views

Are there any languages built to facilitate implementing design patterns?

Often it is not obvious how to implement a given design pattern in a language. Sometimes it is difficult or cumbersome. Are there any languages built to make using design patterns easy and effective?
70
votes
14answers
4k views

What should take precedence: YAGNI or Good Design?

At which point should YAGNI take precedence against good coding practices and vice versa? I'm working on a project at work and want to slowly introduce good code standards to my co-workers (currently ...
14
votes
4answers
3k views

Does anyone have a specific example of using the Flyweight Pattern?

I have been studying design patterns and came accross the fly weight pattern. I have been trying to see opportunities to use the pattern in my applications but I am having trouble seeing how to use ...
1
vote
3answers
899 views

what are your web application server side layering design rules and the best practices you like to apply?

A web application is often designed to be layered. Typically there would be a Repository (Dao) layer, a Service layer and a Control (web handling) layer. The Control layer uses the Service layer which ...
14
votes
14answers
6k views

What would be the best real example to explain the usefulness of Inheritance ? [closed]

When trying to explain the concept of Inheritance in OOP, the common example is often the mammals example. IMHO, this is really a bad example, because it will lead the newbies to use this concept the ...
2
votes
1answer
579 views

Login with Twitter or Facebook - How to link accounts

I've been developing a site and I've been trying to come up with a method to make sure all Social Network accounts of a certain user are linked together. I've had one snag from the start, and maybe ...
4
votes
7answers
2k views

What to do with obsolete code? [closed]

Code that we no longer use builds up. So what should one do when one doesn't need it anymore? Deleting it feels wasteful, especially large chunks, and there's always the chance the exact same thing ...
6
votes
5answers
1k views

How often do you actually use design patterns? [duplicate]

Possible Duplicate: Are design patterns really essential nowadays? I recently read a book on design patterns. A few of them seem very usefull in specific situations. Im not sure how much ...
5
votes
3answers
2k views

What should I name this helper class? [closed]

Usually when writing unit tests I create a helper class with extension methods. I use these methods exclusively for generating generic data for things that I am too lazy to type out. I usually name ...
8
votes
4answers
465 views

Is there is a case when there is no any reasonable replacement for singleton design pattern? [duplicate]

Possible Duplicate: When is Singleton appropriate? I've seen many explanations why is Singleton is evil. But is there really no such a case when Singleton is the only beautiful solution?
16
votes
4answers
384 views

Is there a specific design strategy that can be applied to solve most chicken-and-egg problems while using immutable objects?

Coming from a OOP background (Java), I'm learning Scala on my own. While I can readily see the advantages of using immutable objects individually, I'm having a hard time seeing how one can design a ...
4
votes
2answers
2k views

Observer pattern over HTTP and TCP/IP (Server-Client)

I have a server and many clients (around 50 clients) who connect to that server based on a web application, which is of course based on HTTP protocol, which in turn uses TCP/IP (correct me if I'm ...