Skip to main content

Questions tagged [design-patterns]

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

Filter by
Sorted by
Tagged with
10 votes
1 answer
1k views

I'm prone to building centralized classes that manage the other classes in my designs. It doesn't store everything itself, but most data requests would go to the "manager" first. While looking at an ...
jprete's user avatar
  • 1,519
7 votes
3 answers
3k views

Using an OO language with static typing (like Java), what are good ways to represent the following model invariant without large amounts of duplication. I have two (actually multiple) flavours of the ...
flamingpenguin's user avatar
3 votes
2 answers
3k views

I've implemented a rudimentary ORM layer based on DataMapper (I don't want to use a full blown ORM like Propel/Doctrine - for anything beyond simple fetch/save ops I prefer to access the data directly ...
sunwukung's user avatar
  • 2,275
4 votes
3 answers
478 views

I have a philosophical question about the MVP pattern: I have a component that checks whether a user has access to a certain privilege. This privilege turns on or off certain UI features. For ...
Brian Mains's user avatar
15 votes
1 answer
8k views

I am setting up a new RESTful web service and I need to provide a role-based access control model. I need to create an architecture that will allow users to provide their username and password to get ...
Allen's user avatar
  • 281
5 votes
4 answers
3k views

I use OOP programming with inheritance, but I've not yet used interfaces.I want to learn how to use design patterns, but I'm finding them very difficult to learn. Is there is any way to learn design ...
WebDev's user avatar
  • 839
5 votes
2 answers
2k views

I am about to implement a API for my TCP/IP server written in Java. Right now I have a temporary method that takes a String, executes a command based on the String and returns a String basically like ...
Svante's user avatar
  • 153
16 votes
10 answers
3k views

I'm trying to educate my colleagues in the area of design patterns. Some of the original Gang of Four patterns are a little esoteric, so I'm wondering if there is a sub-group of "essential" patterns ...
Craig Schwarze's user avatar
8 votes
4 answers
2k views

I am trying to design the architecture of a system that I will be implementing in C++, and I was wondering if people could think of a good approach, or critique the approach that I have designed so ...
anjruu's user avatar
  • 255
1 vote
5 answers
566 views

public int foo(int x) { int defaultValue = 0; return foo(x, defaultValue); } public int foo(int x, int y) { return x + y; }
Steve's user avatar
  • 411
17 votes
3 answers
9k views

I can't help but notice the amount of design patterns that are out there. Does anyone have suggestions on an order I should learn them in? Or should I pick and choose them at random? The only one I ...
CrazyPenguin's user avatar
12 votes
5 answers
2k views

The open-closed principle (OCP) states that an object should be open for extension but closed for modification. I believe I understand it and use it in conjunction with SRP to create classes that do ...
Kaleb Pederson's user avatar
9 votes
6 answers
673 views

My company (small, about 40 people across 3 offices) occasionally does "developer workshops" online where one of the devs hosts a presentation about some tech topic. It's not necessarily about our ...
Tesserex's user avatar
  • 3,035
2 votes
6 answers
2k views

Imagine to have this code: class Foo: def __init__(self, active): self.active = active def doAction(self): if not self.active: return # do something f=Foo(false) f.doAction() ...
Stefano Borini's user avatar
9 votes
3 answers
3k views

I've just started creating my very first little Java Swing app. When the program opens, it brings up a single, simple window with a label and a couple buttons. Clicking one of those buttons is ...
Pops's user avatar
  • 4,123
26 votes
7 answers
5k views

Possible Duplicate: When is Singleton appropriate? I am a new programmer (4 months into my first job) and have recently taken an interest in design patterns. One that I have used recently is the ...
Darren Young's user avatar
  • 2,175
7 votes
1 answer
747 views

So here is a question for you, having read some great answers to questions such as Test-Driven Development - Convince Me. So my question is: "Can Test-Driven Development be used effectively on non-...
JHarley1's user avatar
  • 701
3 votes
2 answers
851 views

Suppose I have a controller class with a bunch of properties. Each time a property is changed, I would like to update the model. Now also suppose that I use the command pattern to perform model ...
k rey's user avatar
  • 571
5 votes
2 answers
1k views

First the background, during interviews in the past, many times I have been asked to design some or other variation of card game as programming puzzle, and I have tried to design it in OO way, but I ...
Gaurav's user avatar
  • 3,739
2 votes
1 answer
454 views

I have a User class which needs to load data from a variety of sources, e.g. the main user database, WordPress user metadata, authorizations from another app, etc. For the sake of organization, I want ...
user avatar
3 votes
3 answers
100 views

We produce a number of analysis tools which we re-brand and customise for other businesses to include in their websites. The tools are typically product comparison, data/trend analysis and report ...
gingerbreadboy's user avatar
16 votes
10 answers
7k views

When designing relational database schema for web applications, I often find a case where I end up creating a table just to contain one row, and only one row. It feels like that is the wrong way to ...
Apreche's user avatar
  • 329
5 votes
1 answer
355 views

There are some issues about how to manage our program designs and programming styles. I was assigned to find a solution to write reusable code - though, the programming team does not follow the rules. ...
Salivan's user avatar
  • 373
32 votes
7 answers
3k views

A lot of web frameworks have a MVC-style layout to code and approaching problems. What are some good similar paradigms for JavaScript? I'm already using a framework (jQuery) and unobtrusive js, but ...
GSto's user avatar
  • 8,541
3 votes
4 answers
827 views

Which if the SOLID principles introduced by "Uncle Bob" Martin had the largest effect on your day to day coding? Please give details!
TaylorOtwell's user avatar
  • 2,697