A design pattern is a general reusable solution to a commonly occurring problem in software design.
0
votes
3answers
56 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
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 ...
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 ...
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, ...
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 ...
9
votes
3answers
394 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
6answers
211 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 ...
4
votes
4answers
215 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 ...
-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 = ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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
...
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 ...
-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 ...
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 ...
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 ...
6
votes
3answers
180 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 ...
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 ...
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 ...
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 ...
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
2answers
141 views
Are there any well-known quantitative approaches to evaluate a particular design whether it satisfies or violates the SOLID design principles? [duplicate]
I designed an application framework by considering the SOLID design principles and supported by design patterns. However, I wonder if there are any automated tools or well-known approaches to evaluate ...
0
votes
1answer
97 views
Is there any design pattern to remove elements from a hash map?
In my application I keep track of the running threads via a hash map, in that way I can retrieve the correct thread and do any actions. The app evolved in a way that new threads are created and old ...
3
votes
3answers
164 views
Design pattern to dynamically create patterns found in a list of links
Can anyone help me think of a way to dynamically generate the patterns section of a tool I am creating? I'm not sure how to store and generate these "patterns" dynamically.
What the program does is ...
0
votes
0answers
11 views
Design pattern to dynamically create patterns found in a list of links [duplicate]
Can anyone help me think of a way to dynamically generate the patterns section of a tool I am creating? I'm not sure how to store and generate these "patters" dynamically.
What the program does is ...
8
votes
3answers
406 views
Refactoring an existing abstract class and its parameters
I have an abstract class A which declares an abstract method doStuff. Currently there are many classes that inherit from A and implement doStuff.
The class' instances are initialized at run-time ...
1
vote
0answers
21 views
How to manipulate JDBC connection with Service layer [migrated]
I have a Spring MVC App, it works fine, but now I inserted the service pattern and I don't know what is the the best way to treat my JDBC Connection inside my DAO.
I have an interceptor which creates ...
10
votes
2answers
400 views
I should have used a factory method instead of a constructor. Can I change that and still be backwards-compatible?
The problem
Let's say I have a class called DataSource which provides a ReadData method (and maybe others, but let's keep things simple) to read data from an .mdb file:
var source = new ...
4
votes
1answer
110 views
Creating an entity relationship in REST: May I create the parent by posting to a child id?
We are currently designing a REST API to access classical customer data.
One of the elements in the API are the assets of an user. The assets are added under a given service. The backend API will ...
0
votes
0answers
25 views
Pattern for XPDL import
I am using xml serialization for importing/exporting data from/to xpdl format.
And I need a little advice - to what pattern to use. Right now I have 1 huge class for controlling the whole process (it ...
-1
votes
0answers
69 views
Pattern for efficiently intersect two vectors
I have two vectors of objects and both have an integer start and end index. Now I want to intersect this two vectors and apply a function if both of the vectors have an element with the same index. ...
-1
votes
3answers
60 views
Best way to create draw with limitation
I'm writing a program to automatically make the draw for a competition. There are four objects: Debate Judge School Team Each Debate has two teams and a judge. Each team participates in three debates. ...
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 ...
0
votes
1answer
146 views
How to design an application that read files using MVC pattern?
I am going to write an application that reads data from a csv file, and display that data to the user. I intend to apply an MVC design pattern to create this application. A user will interact with ...
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 ...
3
votes
3answers
171 views
Dynamically change of UI on value changes in list box
I have a list box with several elements, let it be web servers (tomcat, iis etc). For each list box value, UI must have different views. For example, if we choose IIS, user name and password fields ...
3
votes
3answers
272 views
Simple questions to test understanding of Dependency Inversion Principle
I am preparing a short (1-2 hour) presentation about DIP to several (~5) junior developers (1-3 yr xp) in the office. At the end of the presentation I want to know whether they understood what I was ...

