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

learn more… | top users | synonyms

1
vote
1answer
30 views

What should the relation between parent and child GUI components be?

This seems to happen every time I create any sort of GUI. I have trouble figuring out how child classes should communicate to their siblings. It's a general problem, but it's probably easier to use a ...
0
votes
3answers
73 views

What is the preferred access modifier for instance variables of a data transfer object?

I'm creating a data transfer object and can't decide whether it would be better to just give public access to the instance variables or if there would be a purpose to using getters and setters to ...
0
votes
0answers
34 views

Matrix Pattern Recognition Algorithm for a 2D space

I have a picture that I elaborate with my program to obtain a list of coordinates. There is a matrix represented in the image. In an ideal test I would get only the sixteen central points of each ...
0
votes
1answer
78 views

Extension objects pattern

In this MSDN Magazine article Peter Vogel describes Extension objects partten. What is not clear is whether extensions can be later implemented by client code residing in a separate assembly. And if ...
9
votes
3answers
395 views

Is this pattern bad?

I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing ...
5
votes
3answers
257 views

Programming style in Perl

I work in Java so basically I use OOP paradigm during coding. I am about to start working in Perl and I was wondering what is the paradigm that Perl developers follow. In wiki it mentions that it ...
0
votes
0answers
46 views

Using a Finite State Machine for access management?

My intranet site uses LDAP and Active Directory to authenticate users. There are 2 kinds of Users: Managers and Employees. They are differentiated by having membership in a particular AD group. In an ...
1
vote
0answers
73 views

Is there any efficient Java solution/Algorithm to find values in a text field based on key string with delimiter? [migrated]

Is there any efficient Java solution/Algorithm to find values in a text field based on key string with delimiter? Example: Rules: I. Key: username Start-Delimiter: ; End-Delimiter: ; Need to find ...
3
votes
4answers
255 views

As a tooling/automation developer, can I be making better use of OOP?

My time as a developer (~8 yrs) has been spent creating tooling/automation of one sort or another. The tools I develop usually interface with one or more API's. These API's could be win32, WMI, ...
0
votes
2answers
54 views

How to create different paths for users to take through the pages in my site?

I have a website where users are directed to go through a sequence of pages to perform a sequence of work tasks (transcribe a paragraph, answer a survey, interact with another user, etc). For short, ...
0
votes
0answers
52 views

Is this a sensible way to implement a model? [migrated]

I've created the following model for an academic project, and I'm wondering if this is a sensible way to manage a model: using System; using System.Collections.Generic; using System.Linq; using ...
2
votes
3answers
190 views

Is it completely impossible to have total separation without leakage of any kind in a design? [closed]

For the past week I have been attempting to write a proof-of-concept project using dependency injection, a service layer, unit of work pattern + repository. I am looking to design something that can ...
-2
votes
0answers
72 views

Using an abstract class or interface as strategy? [duplicate]

I watched this video explaining the Strategy Pattern: http://www.youtube.com/watch?v=94t2ayF1l3o It gives an example for a game where the context is the character, the strategy a weapon. The concrete ...
2
votes
1answer
74 views

design strategy pattern with null checking

When the context class can accept a null strategy, is there another way to do it without check if its null? Is this considered a good strategy design implementation? class MainApp{ static void ...
5
votes
6answers
212 views

Re-architecting a classic inheritance design

I have the opportunity to rewrite a core piece of a project (C#) that is inheritance-heavy and feels increasingly restrictive in how it is designed. The scenario is pretty simple, imagine an ...
1
vote
0answers
22 views

Re-architecting a classic inheritance design [duplicate]

I have the opportunity to rewrite a core piece of a project that is inheritance-heavy and feels increasingly restrictive in how it is designed. The scenario is pretty simple, imagine an application ...
0
votes
1answer
133 views

Designing application flow

I am creating a web application in java where I need to mock the following flow. When user trigger a certain process (add product to cart), I need to pass through following steps Need to see in ...
2
votes
2answers
114 views

Design patterns: Extract instance types into different buckets

I have the following type hierarchy: interface I: ----+class B implements I ----+class C implements I ----+class D implements I I have another class Consumer1 that supports types C and ...
4
votes
4answers
216 views

Returning a boolean when success or failure is the sole concern

I often find myself returning a boolean from a method, that's used in multiple locations, in order to contain all the logic around that method in a single place. All the (internal) calling method ...
2
votes
4answers
152 views

How to genericize foreign key references in table?

I am trying to design a table to store references to multiple tables as a "target" of the item in each row. An example should clarify what I am trying to do: Imagine you have 4 tables (images, ...
-3
votes
1answer
62 views

Refactoring methods with the same behavior [closed]

Imagine you have 2 methods : GetConsolidation([...]); GetReportOfConsolidation([...]); These 2 methods use the same "behavior" (some local variables assigned with data) like : var data = ...
3
votes
1answer
208 views

How do the Application and Database Interface Layers interact at their boundary?

I was watching one of Uncle Bob's videos and he brought up the Database Interface Layer. He had this diagram showing it: These arrows show that the DB Interface Layer is aware of and calls the ...
2
votes
3answers
203 views

Solution looking for a problem (learning design patterns, school) [closed]

I'm enrolled in grad school and this summer we're tasked with a series of projects that should include implementations of design patterns from a couple of textbooks. Our first project is for one of a ...
1
vote
1answer
50 views

Extracting domain logic from the forms to which they are coupled?

Many applications do nothing to separate the interface from domain logic. I’ve been programming for a couple decades and have worked at more than a dozen shops and none of them have taken any measure ...
0
votes
1answer
76 views

Introducing Fowler's Table Data Gateway to refactor poorly designed systems

I am developing an application, which currently has about 150,000 lines of code. The previous developer didn't really use any discipline when writing code. Application is in production but is ...
10
votes
3answers
290 views

Object Oriented Programming in JavaScript. Is there life without it? [duplicate]

At our company we have pretty large body of PrototypeJS based JavaScript code, which we are porting to jQuery for several reasons (not really important here). I'm trying to set up coding guidelines to ...
3
votes
3answers
316 views

Which design pattern would be best for this case?

I have a class, called PolicyProvider, at present with the following (abridged) interface: public interface IPolicyProvider { List<Policy> GetRenewalPolicies(Client client, int ...
19
votes
10answers
2k views

To design pattern, or not to design pattern

Design patterns are good, but complex. Should we use them in small projects? Implementing design patterns needs more sophisticated developers, which in turn raises project costs. On the other hand, ...
13
votes
6answers
622 views

Map of functions vs switch statement

I'm working on a project that processes requests, and there are two components to the request: the command and the parameters. The handler for each command is very simple (< 10 lines, often < ...
1
vote
2answers
117 views

How to make big chunk of hardcoded menuitems in a programmable way

So in the javascript app, we have a lot of repeated chunk of menu items with the specific settings: URL, Name, Title, etc etc (these settings sometimes can be optional). Here is the gist of the ...
3
votes
4answers
368 views

Are Compiler Directives an Antipattern?

I'm working on a legacy system that has a helper class that is symbolically linked into many different .Net projects within a solution. The logic is riddled with compiler directives that change it's ...
3
votes
1answer
203 views

Distinguishing between UI command & domain commands

I am building a WPF client application using the MVVM pattern that provides an interface on top of an existing set of business logic residing in a library which is shared with other applications. The ...
0
votes
1answer
265 views

Best place to write SQL queries

I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes - QueryBuilder ...
0
votes
2answers
144 views

Design pattern for client/server sessions?

Are there any common patterns or general guidance I can learn from for how to design a client/server system where the both the client and server must maintain some kind per-client session state? I've ...
1
vote
1answer
62 views

Design pattern for sharing Social Authentication across subdomains?

Right now building an app that authenticates using either email or different social accounts. Because it is going to function on multiple subdomains and domains, I'm wondering if there's a design ...
1
vote
1answer
193 views

What principle of OOAD is this pattern breaking?

I'm trying to make a case for not putting the structure in the parent BaseModule class I've shown below. I'm more for a Strategy Pattern, and minimizing inheritance in favor of has-a relationships, ...
0
votes
0answers
33 views

How to perform method [migrated]

I have class Person, two child classes Staff and Student, interface IPerson. Also I have a class Database and class Gateway. Class Database has private string name = "username"; and method ...
-1
votes
0answers
124 views

From programmer to architect [closed]

I'm a web developer in a fairly disorganized enterprise (we don't have an architect around, nor documentation or even plans) and I would like to become a software architect. My goal is to be able to ...
65
votes
20answers
4k views

Is OOP hard because it is not natural?

One can often hear that OOP naturally corresponds to the way people think about the world. But I would strongly disagree with this statement: We (or at least I) conceptualize the world in terms of ...
6
votes
3answers
181 views

Which of these design patterns is superior?

I find I tend to design class structures where several subclasses have nearly identical functionality, but one piece of it is different. So I write nearly all the code in the abstract class, and then ...
2
votes
2answers
110 views

Where should I parse data obtain with a DAO

I have a DAO that brings data from a web service, that data comes in a string, in the likes of: *NAME|John Doe *DATEOFBIRTH|1978-23-01*ID|anID123 (...) I have a DTO that I wanna fill up with the ...
13
votes
9answers
1k views

Can/should the Single Responsibility Principle be applied to new code?

The principle is defined as modules having one reason to change. My question is, surely these reasons to change are not known until the code actually starts to change?? Pretty much every piece of code ...
3
votes
1answer
58 views

MVC URL formatting/design

In refactoring a lot of MVC code, I have run into an issue with my URL design. For example, let's say we have a Venue object public class Venue { public long ID { get; set; } public ...
-1
votes
0answers
22 views

Struts2: Convention Plugin vs. XML Configuration

What are the pros and cons of using Convention plugin over xml configuration in a Struts2 application? What is more preferred in real-world enterprise applications? Is it important that a Struts2 ...
0
votes
0answers
70 views

How to implement multi-theme PHP application

I am developing an application which will handle many virtual stores and I would like to have many themes that the user could choose anytime. I would to know what's the main ideia to implement it. I ...
8
votes
4answers
371 views

What is the meaning of “inversion” in `Dependency Inversion Design Principle

I'm reading Design patterns. I know what this principle do. high-level and low-level classes are depend on abstractions. But why we say this inversion?
1
vote
0answers
48 views

If SqlDataReader is going to be disposed, do I need to call close()? [migrated]

If I instantiate a SqlDataReader inside a using block, do I need to call close() on the reader? Simple example of looking up a user shown below. using (var connection = new ...
12
votes
11answers
1k views

Is there a canonical book on design patterns?

I am interested in learning design patterns and would like to know what are considered top tier books in learning this subject. Is there a book out there that's the de-facto standard for describing ...
0
votes
0answers
35 views

Python web application frontend for equipment diagnostics and interaction

My goal is to have a Python application that runs a web server which hosts the user interface, and based on interactions from a user in their browser, long running tasks get kicked off and through ...
3
votes
1answer
265 views

Patterns for a tree of persistent data with multiple storage options?

I have a real-world problem which I'll try to abstract into an illustrative example. So imagine I have data objects in a tree, where parent objects can access children, and children can access ...

1 2 3 4 5 18