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

learn more… | top users | synonyms (1)

3
votes
2answers
5k views

Using PDO with MVC

I asked this question at stackoverflow and received no response (closed as duplicate with no answer). I'm experimenting with OOP and I have the following basic MVC layout: class Model { // do ...
3
votes
2answers
651 views

Design backward and forward button operations of a browser

If you were asked to design the backward and forward button operation (as a library) in a browser, how would you do it? What will be your APIs and parameters to them? what data structure will be best ...
4
votes
2answers
811 views

Is there a design pattern for chained observers?

Several times, I've found myself in a situation where I want to add functionality to an existing Observer-Observable relationship. For example, let's say I have an Observable class called PriceFeed,...
2
votes
1answer
2k views

Should I implement BackBone.js into my ASP.NET WebForms applications?

Background I'm trying to improve my group's current web app development pattern. Our current pattern is something we came up with while trying to rich web apps on top of ASP.NET WebForms (none of us ...
7
votes
2answers
10k views

Creating a Predicate Builder extension method

I have a Kendo UI Grid that I am currently allowing filtering on multiple columns. I am wondering if there is a an alternative approach removing the outer switch statement? Basically I want to able ...
1
vote
1answer
2k views

Class Design and Structure Online Web Store

I hope I have asked this in the right forum. Basically, we're designing an Online Store and I am designing the class structure for ordering a product and want some clarification on what I have so far:...
2
votes
2answers
331 views

What are the caveats of the event system built on Messenger rather than on classic .NET events?

MVVM Light and PRISM offer messenger to implement event system. the approximate interface looks like the following one: interface Messanger { void Subscribe<TMessageParam>(Action<...
5
votes
1answer
705 views

Abstract Factory Method and Polymorphism

Being a PHP programmer for the last couple of years, I'm just starting to get into advanced programming styles and using polymorphic patterns. I was watching a video on polymorphism the other day, and ...
5
votes
6answers
573 views

.NET - refactoring code

I have inherited and now further develop a large application consisting of an ASP.NET application, VB6 and VB.NET application. The software was poorly written. I am trying to refactor the code as I ...
5
votes
2answers
1k views

Designing web-based plugin systems correctly so they don't waste as many resources?

Many CMS systems which rely on third parties for much of their code often build "plugin" or "hooks" systems to make it easy for developers to modify the codebase's actions without editing the core ...
0
votes
2answers
347 views

Are monolith and microkernel design patterns or strategies?

What's the difference between a design pattern and a strategy? Is the monolith actually an anti-pattern?
1
vote
1answer
2k views

Use decorator and factory together to extend objects?

I'm new to OOP and design pattern. I've a simple app that handles the generation of Tables, Columns (that belong to Table), Rows (that belong to Table and have Columns) and Values (that belong to ...
7
votes
2answers
472 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 (...
2
votes
4answers
3k views

Should I use the factory design pattern for every class?

I've been writing a website in PHP. As the code becomes more complex, I keep finding problems that can be solved using the factory design pattern. For example: I've a got a class Page which has ...
2
votes
2answers
292 views

doing a full permutation search and replace on a string

I'm writing an app that does something like a custom number (license) plate generator tool where if I ask for the plate "robin" it will suggest I try: r0bin rob1n r0b1n Are there any published ...
1
vote
1answer
600 views

Central Exception Handler

Recently I've been thinking about a general ExceptionHandler, that I could initialize once in my app context and inject it everywhere. The idea that it will have quite simple interface with just ...
3
votes
1answer
955 views

Microkernel architectural pattern and applicability for business applications

We are in the business of building customizable web applications. We have the core team that provides what we call as the core platform (provides services like security, billing etc.) on top of which ...
0
votes
2answers
334 views

Question on refactoring and code design

Suppose, I have a class with a constant static final field. Then I want in certain situations that field to be different. It still can be final, because it should be initialized in constructor. My ...
5
votes
3answers
22k views

In MVC , DAO should be called from Controller or Model

I have seen various arguments against the DAO being called from the Controller class directly and also the DAO from the Model class.Infact I personally feel that if we are following the MVC pattern , ...
26
votes
12answers
4k views

Is there an antipattern to describe this method of coding? [closed]

I have a codebase where the programmer tended to wrap things up in areas that don't make sense. For example, given an Error log we have you can log via ErrorLog.Log(ex, "friendly message"); He ...
2
votes
4answers
5k views

How to solve cyclic dependencies in a visitor pattern

When programming at work we now and then face a problem with visitors and module/project dependencies. Say you have a class A in a module X. And there are subclasses B and C in module Y. That means ...
3
votes
2answers
1k views

Lazy Processing of Streams

I have the following problem scenario: I have a text file and I have to read it and split it into lines. Some lines might need to be dropped (according to criteria that are not fixed). The lines ...
1
vote
2answers
359 views

What is a useful pattern to maintaining an object state in a one to many relationship?

I am looking for a design for my application, here are the players(classes) involved. struct Transform { // Uses a matrix to transform the position. // Also acts acts as the state of a Dialog....
5
votes
2answers
2k views

Alternative to “inheritance versus composition?” [duplicate]

Possible Duplicate: Where does this concept of “favor composition over inheritance” come from? I have colleagues at work who claim that "Inheritance is an anti-pattern" and want to use ...
-2
votes
2answers
133 views

Software patterns for frameworks [closed]

I am currently doing some research about software patterns and about architectural patterns for frameworks specifically. Google is not really showing off for this topic, so I am curious which ...
4
votes
1answer
405 views

Has the emerging generation of programmers got the wrong idea about design patterns?

Over the years I've noticed a shift in attitude towards design patterns, particularly amongst the emerging generation of developers. There seems to be a notion these days that design patterns are ...
0
votes
1answer
579 views

would a composite design pattern be useful for group membership?

I'm trying to think about the best way to handle group memberships on a website. People sign up and select checkboxes in a list of interests. Every week we send out interest-themed emails to those ...
3
votes
2answers
409 views

Clarification on the Strategy Pattern

I've just been reading through some basic design patterns, Could someone tell me if the term "strategy pattern" only applies if your implementing a completely abstract interface? What about when ...
2
votes
3answers
261 views

What is the best approach to solve a factory method problem which has to be an instance?

I have to add new funcionality in a web service legacy project and I'm thinking what is the best approach for a concrete situation. The web service is simple: It receives a XML file, unmarshalling, ...
3
votes
4answers
2k views

DDD: Service or Repository

I am developing an app in DDD manner. And I have a little problem with it. I have a Fare (airline fare) and FareRepository objects. And at some point I should load additional fare information (from a ...
5
votes
2answers
2k views

Constant values in the interface

Some time ago I have read two different books and each of them gives totally different answer for the question if it is a good pattern to define constant values in the interface (in java). So I am ...
22
votes
7answers
2k views

Pattern for a class that does only one thing

Let's say I have a procedure that does stuff: void doStuff(initalParams) { ... } Now I discover that "doing stuff" is quite a compex operation. The procedure becomes large, I split it up into ...
5
votes
2answers
2k views

Data structure for pattern matching

Let's say you have an input file with many entries like these: date, ticker, open, high, low, close, <and some other values> And you want to execute a pattern matching routine on the entries(...
1
vote
2answers
2k views

Adhering to a protocol and being a subclass at the same time?

In objective C, I have a situation where I would like to have an abstract protocol (interface) with 5 methods and 4 properties, but at the same time, I'd like to have a common implementation of 3 of ...
6
votes
1answer
445 views

DDD: service contains two repository

Does it correct way to have two repository inside one service and will it be an application or domain service? Suppose I have a Passenger object that should contains Passport (government id) object. ...
17
votes
3answers
5k views

How to store prices that have effective dates?

I have a list of products. Each of them is offered by N providers. Each providers quotes us a price for a specific date. That price is effective until that provider decides to set a new price. In ...
-2
votes
2answers
199 views

Design for a plugin based application [closed]

I am working on application, details of which I cannot discuss here. We have core framework and the rest is designed as plug in. In the core framework we have a domain object. This domain object is ...
3
votes
2answers
260 views

Best design for a “Command Executer” class

Sorry for the vague title, I couldn't think of a way to condense the question. I am building an application that will run as a background service and intermittently collect data about the system its ...
0
votes
2answers
215 views

When modeling a virtual circuit board, what is the best design pattern to check for cycles?

To make it simple assume you have only AND and OR gates. Each has two inputs and one output. The output of two inputs can be used as an input for the next gate For example: A AND B -> E C AND D -> F ...
5
votes
3answers
6k views

Manager/Container class vs static class methods

Suppose I have a Widget class that is part of a framework used independently by many applications. I create Widget instances in many situations and their lifetimes vary. In addition to Widget's ...
0
votes
1answer
400 views

In PHP, what are the different design patterns to implement OO controllers as opposed to procedural controllers?

For example, it's very straightforward to have an index.php controller be a procedural script like so: <?php //include classes and functions //get some data from the database //and/or process a ...
6
votes
1answer
267 views

Event Aggregator.. not getting a response, how to determine completion?

I'm rewriting a vehicle tracking application, a google maps based thing.. The users are able to search for a vehicle by typing a few characters of the vehicles "callsign". My application is based ...
2
votes
1answer
86 views

In GSL, why do some functions take a “workspace” argument?

In certain functions in GSL (GNU Scientific Library), some functions take a "workspace" environment as an argument. For example, gsl_poly_dd_taylor from this page. Why? Wouldn't it be easier for ...
5
votes
1answer
576 views

iOS app with a lot of text

I just asked a question on StackOverflow, but I'm thinking that a part of it belongs here, as questions about design pattern are welcomed by the faq. Here is my situation. I have developed almost ...
2
votes
3answers
11k views

Relationship DAO, Servlet, JSP and POJO

I want to implement a JSP, POJO, DAO and Servlet in my J2EE program. However, I don't fully understand how the relationship between these elements should be. Is the following (MVC) setup the right way ...
1
vote
3answers
241 views

“Best fit” to avoid reuse of object instances in a collection

Imagine I have a collection of object instances which represent activities for a user to undertake. Dependent on user attributes, I have to randomly select instances to present activities to the user....
2
votes
6answers
8k views

Designing a Business Rule Engine

I have a requirement where there are 10 Rules to be applied on data in excel. If Rule 1 and Rule 2 fails rest of the rules are not checked. But if Rule 1 and Rule 2 passes the rest of all the Rules ...
11
votes
4answers
4k views

Combining template method with strategy

An assignment in my software engineering class is to design an application which can play different forms a particular game. The game in question is Mancala, some of these games are called Wari or ...
3
votes
4answers
537 views

Which one of the SOLID principles had the largest effect on your code? [closed]

Which if the SOLID principles introduced by "Uncle Bob" Martin had the largest effect on your day to day coding? Please give details!
1
vote
3answers
296 views

two ways of doing the same thing, what is preferred?

I have some context then I can do: with context.getError(Object): ErrorHolder holder.addError(error) OR context.setError(Object, error) setError will probably have this implementation: context....