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

learn more… | top users | synonyms

1
vote
0answers
27 views

Using the Template Design Pattern to reduce code duplication between two algorithms

I have made a Skyline query solver which for now can solve the query with two different algorithms. The first is Block-nested loop (BNL) and the second is Sort filter skyline (SFS). The two are ...
0
votes
0answers
28 views

Appropriate design pattern for DB side-effect [on hold]

I have a data access layer method to cancel an order. This operation should have an associated "operation history" entry. My first (naïve) implementation looks like this (c#): ...
6
votes
2answers
273 views

Implementing both poor-man's MVP and MVPVM framework

I'm actually building some kind of framework to promote code reuse without over-reusing it. Besides, sometimes as it occurs with generic types, one expects type parameters to be constrained for the ...
2
votes
0answers
40 views

“Table Data Gateway” pattern

Using the table data gateway (TDG) pattern, I created a class QuestionGateway for retrieving, adding, updating, deleting, and sorting multiple-choice questions. ...
2
votes
1answer
64 views

Is there a better design pattern for a SDK?

At work I decided it would be better to reverse engineer a SDK for one of our pieces of hardware. Because it is work related I can't share the exact code.. but I can give enough of a gist of the code ...
5
votes
3answers
501 views

I command thee: do SOMETHING

I am currenly contributing to a Chat-Bot to be used across the whole SE-Network's chat which is implemented in Java 8. This bot is supposed to have commands. These commands again are supposed to be ...
0
votes
0answers
5 views

Generalization of phase based systems for card and board games [migrated]

In an exercise of futility I'm trying to abstract and generalize a framework where to build any turn/rule based system. I've had a head start but after decompiling HearthStone I'm second-guessing that ...
-2
votes
1answer
54 views

Creating new types that facilitate safety, flexibility, and DRY-ness [closed]

Disclaimer: I realize that a lot of my trouble has to do with how I'm grounded in the OO way of thinking. If you can point out exactly how I'm trying to force OO thought on Haskell, I would be very ...
0
votes
1answer
31 views

A function which collates data from various API calls. Help on design-pattern

Help on the appropriate design pattern for this. Program details: A scheduled script that fetches all the data from various framework-based API's - ...
2
votes
1answer
24 views

Detaching logic from listener implementation in “Smart UI” approach to follow a proper pattern

I took this code segment from existing source on Android, but it applies to anything from ASP.NET Forms to anything else where the UI has an event callback, and the logic is implemented directly in ...
3
votes
1answer
178 views

Result class which wraps another object

I have a result class which wraps another object if successful or an error if failure ...
-1
votes
1answer
34 views

Observer pattern with different notifications [closed]

I'm trying to create an observer pattern that the subject notifies the observers with different notifications. Normally in observer pattern implementations you can see only one method called ...
0
votes
2answers
56 views

Applying chain responsibility with IFilter

I have an interface IFilter and more types of filters: Filter1, Filter2, ...
3
votes
2answers
100 views

Parenthesis checker

I am working on a parenthesis checker program in Java that reads in a text stream from standard input and uses a stack to determine whether or not its parentheses are properly balanced. For example, ...
4
votes
1answer
114 views

Factory pattern with controls

I've created factory to create WPF controls. I have string with control name and I map it to enum. I think it's bad implementation of factory pattern. So please show me where I've made mistake. Main ...
2
votes
1answer
35 views

jQuery-Keyframes allows dynamic generation of CSS3 keyframes with callback events

I want to learn best practices for structuring these kinds of small jquery plugin libraries. I believe I am using a bad design pattern and what I was going for is fewest line numbers and minimal code. ...
4
votes
1answer
50 views

Passing data between themes and the page settings

I'm designing a small CMS with best practices I learned. I came to this conclusion when comes to including page content and themes to each page depending by user or whatever. But how could I make ...
3
votes
1answer
47 views

Swing application: Working with GridBagLayout and Mediator pattern

SCENARIO: As a follow-up of this question on Stackoverflow asked few days back, I am working on a swing application(article tagging tool) where the user(on an initial jpanel) would fill up some ...
5
votes
1answer
90 views

Basic console game architecture

I'm working on some simple console game and I'm starting to get stranded in my modelling. There is some fragmentation and tight coupling going on! In this version I would just want to be able to ...
2
votes
0answers
65 views

GOF Composite Design Pattern Implementation Using Modern C++

After reading about the composite pattern from the GOF design pattern book, I thought to re-implement the code mentioned in the motivation section using the modern C++ concept/idioms. Below is the ...
1
vote
1answer
58 views

Event handlers & helper methods for a Kendo Grid

Below are a few of my handlers and helper methods. This works perfectly fine, but I'm pretty sure I'm breaking about 1001 modern conventions and possibly even optimizations. Could you provide some ...
1
vote
0answers
41 views

WPF Binding to a Repository with Entity-Framework

I have an MVVM WPF application that will make use (hopefully) with a repository and ...
3
votes
3answers
139 views

Chain of Responsibility Design pattern in C++

I am learning design patterns from Design pattern for dummies. From that book I have written a chain of responsibility pattern with two programs. Can someone review and let me know which one is proper ...
8
votes
1answer
100 views

Custom JavaScript validation using the factory / module patterns

I am in the process of diving a bit deeper into JavaScript development and am looking at some common language patterns (module, and factory in particular). In this code, my aim is to create a ...
4
votes
0answers
84 views

Transformation of abstract models

In one of my recent projects I faced the problem of transforming an abstract class into another abstract class. The classes were structured like this and are part of an api for questionnaires: ...
6
votes
5answers
160 views

DP solution to min triangle path

I am studying for interviews for various companies. I wrote a solution to this problem, but if an experience programmer looks at it I am sure there are certain areas the code can be made in to a more ...
15
votes
6answers
1k views

Is wrapping exceptions good practice?

I have recently been refactoring some code in an effort to improve the exception handling, particularly to aid in improving the level of information given to developers during development. However I ...
-1
votes
2answers
90 views

Using singleton and/or factory patterns in business logic layer [closed]

I understand the purpose of singleton and factory patterns, however I have doubts implementing it. My problem is that whenever I need to call a method from BLL, then I have create an instance of BLL ...
0
votes
0answers
42 views

App using JQueryMobile and Cordova

I have received a project that is built on Cordova with JQueryMobile. The app is already published on three platforms and is being used by 100K+ users. Now I have to add new functionality in it. But ...
1
vote
0answers
63 views

Enhance MVC implementation

I know that there are several ways to develop the MVC pattern. To improve consistently my knowledge, I would like to get some advice and feedback. How could I enhance my code? I knew that there are ...
0
votes
1answer
66 views

Polymorphic template cloning class

I have a requirement of a templated clone() method which Base classes can implement through an ICloneable interface and all the ...
1
vote
2answers
80 views

Notifying Students in Courses - Strategically

I have the following implementation, and hope to get suggestions on how to improve the code. treeListViewModel.Courses is an observablecollection ...
7
votes
1answer
115 views

Adapter design pattern

I am referring to the book Design Patterns For Dummies to learn about design patterns. I wrote an adapter design pattern, as mentioned in the book. Is it proper or does it need some modification? ...
5
votes
1answer
58 views

Architecture for manager that gets shared among different components

It started with a simple log manager. Then I wanted to implement more features, for example printing the name of the component that send a message. Later on, I can think of giving each component that ...
-2
votes
1answer
39 views

Suggestion for refactor wpf project

I have done a WPF project and hope everyone can give suggestion for code refactor, especially for UpdateErrorList() method within the MainWindowViewModel.cs ...
6
votes
1answer
112 views

Breadth First Search not SOLID enough v2.0

Here is a link to my original question: Breadth First Search not SOLID enough Here is my first attempt at refactoring. Instead of using a Tuple, I used a ...
4
votes
2answers
206 views

Is this a correct Factory Method implementation?

I'm learning about design pattern and I tried to implement a Factory Method example, based on the GoF book. Can I say that this is a correct implementation of it ? If not I will be glad to find ...
3
votes
3answers
137 views

Implementing a POC Async Web Crawler

I've created a small proof of concept web crawler to learn more about asynchrony in .NET. Currently when run it crawls stack overflow with a fixed number of current requests (workers). I was ...
11
votes
2answers
239 views

Understanding the MVVM concepts and validation of my code

I have been learning MVVM concepts and trying to implement it in my new project. I want to validate my work that I have been doing these past days. I want to know if I follow correctly the MVVM ...
1
vote
2answers
82 views

Multi Threaded Report Generation

I have a requirement where i have to generate some report basically read from db and write data to Excel. I want your help in reviewing following things in my code. Data Base Connection Multi ...
0
votes
1answer
46 views

First facelets with JPA app on glassfish

So far as I've tested it, these few facelets files with JPA database connections work as intended. The queue, MyQueue, is at ...
4
votes
1answer
66 views

Logging using function as decorator in Guava

I needed to add a logger into my flow based on FluentIterable from the Guava library. I have a lot of functions and in some cases I would like to add logging when ...
2
votes
1answer
69 views

Still an observer pattern?

Usually when I see tutorials about Observer Pattern I see an unique method called notify, but I'm wondering. What if I have different methods that can be called in ...
6
votes
3answers
167 views

Counting occurrences of different categories of characters

This is a sort of follow up to my previous question: Counting the number of character occurrences This time I have written code that still counts the number of different characters in a string, but ...
10
votes
5answers
803 views

Is this Repository Design Pattern Valid and efficient?

I am using Dapper ORM in my Data access Layer, but I think analysis of the code below doesn't depend upon any specific ORM. What should be the single common place throughout the entire Data Access ...
4
votes
2answers
69 views

WCF service implementation

I have WCF Service using .NET 4.0. I have similar methods, similar code and I want use good patterns for improvement the code for get high level quality. I want reuse code, maybe using ...
4
votes
2answers
216 views

EF6 Code First unit of work pattern with IoC/DI

I'm trying to implement the unit of work pattern with dependency injection / inversion of control and entity framework version 6.1.1 Code First, in an asp.net-mvc project. ...
12
votes
2answers
877 views

Builder Pattern for Car class

I have some experience in Java. I am reading Effective Java by Joshua Bloch, the book talks about Builder pattern which I was unaware of. So,I have assembled a quick example of what I think builder ...
1
vote
1answer
37 views

PHP framework building: System Class (reads configuration .ini file)

I am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...
3
votes
2answers
100 views

PHP framework building: MySQL Connection and query class

I am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...