Tagged Questions

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

learn more… | top users | synonyms

2
votes
1answer
39 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
12 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
0answers
30 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 ...
0
votes
0answers
15 views

Python - call all methods of a class [on hold]

I'm wondering if my design is flawed or if I'm thinking this incorrectly: I have a class Lexer that has a number of methods. All methods are ...
3
votes
1answer
35 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
79 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
51 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
27 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
30 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
111 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 ...
5
votes
1answer
62 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
73 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
145 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
69 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
24 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
57 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
54 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
78 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
105 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
37 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
83 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
204 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
109 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
219 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
71 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
37 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
54 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
66 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
146 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
748 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
63 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
143 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
861 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
31 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
82 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 ...
5
votes
1answer
199 views

Road to MVC: the case of Settings Table View Controller

Now that I know that MVC can help do better code, I want to make my SettingsTableViewController class conform to it. ...
22
votes
2answers
412 views

KISS my… unit of work

I've seen many, many UoW+Repository implementations. Whenever one was built on top of Entity Framework, I'd cringe at the added complexity. Sure the complexity buys you (sometimes) full decoupling ...
1
vote
1answer
166 views

Unit of work + repository + service layer with dependency injection

I am designing a web application and a windows service and want to use the unit of work + repository layer in conjunction with a service layer, and I am having some trouble putting it all together so ...
3
votes
3answers
139 views

Object Interaction in OOP (especially Python) [closed]

Say you have a number of similar objects (e.g. instances of the class Person). Each of these instances can belong to a number of Groups, also represented by a class. To stick with the examples of ...
3
votes
1answer
93 views

Examining programming laboratory exercise for faculty

I'm developing software for examining programming laboratory exercise for faculty. I have an Error object that can be attached to students work. It can be attached ...
5
votes
0answers
81 views

PubSub and two-way data binding

I looked up how to use the PubSub pattern in JS and came across a few articles. I wanted to have two way data binding, so when a one of an Object's Properties value was set, it would update x number ...
3
votes
1answer
60 views

Design of colour fading for WinForms controls effect

I wrote this little piece of code to linearly interpolate between a winforms control's background colour and any arbirtrarly chosen colour. I don't like the way I wrote this piece and I was ...
3
votes
1answer
51 views

Factory Class for Game World

The world in my strategy game is comprised of a number of towers. At the start of the game, only one tower is generated, and when the player discovers new towers they are created and added to the ...
2
votes
2answers
168 views

How far should I go with abstraction?

I've been trying for a while to write clean and testable code, with the help of DI and abstractions. I found myself guilty of service-itis, creating 3 or 4 interfaces for something that clearly ...
1
vote
0answers
48 views

Separation of concerns for security checks

I needed a nice typesafe way to implement security checks for various domain objects and actions that can be performed on them. I had an idea how to do it, so I implemented it as a simple proof of ...
2
votes
0answers
61 views

Implementation of Command Pattern [closed]

I'm trying to implement Command Pattern, but it's much harder than I thought. Main marker interfaces first: ...
4
votes
3answers
96 views

An approach to the network messaging service

I'm working on the communication module of an ecommerce application. This module takes care of handling messages that come from other apps over the wire. The awful switch case is never an option so I ...
2
votes
1answer
78 views

Is my design achieving Separation of Concerns in this MVC implementation?

I've read lots about getters and setters being evil, unless there is good call for one, but I cannot figure out how to implement that knowledge into my Model layer. Say in my Model layer I have a ...