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

learn more… | top users | synonyms

0
votes
0answers
8 views

Best practices for implementing MVVM and MVC in delphi Pascal [on hold]

I'm a Delphi pascal programmer, I use the latest Embarcadero delphi XE, and I would like to take advantage of design patterns such as Model view controller and model view view-model. However, there ...
-1
votes
0answers
5 views

Passing configuration to a handler [migrated]

I'm building my own JET Parser and one of the things I am trying to do as per the JET specifications is to allow changing of the start and end tags from the default ...
-3
votes
2answers
54 views

static factory method alternative to nested switch statements? [on hold]

At first I liked the idea of nested switch statements, but on a second-look, it seems a bit confusing to read. I'm iterating through two enum's as so: ...
3
votes
1answer
29 views

Erlang pattern matching excersise

I recently started my first project with Erlang. I've been skimming documentation and various books to get the information I need, and it's going well, but now that I have something that works I want ...
3
votes
1answer
62 views

Splitting My Code Into Classes/Functions

I'm looking for code correctedness, best practices. The player will have different spells, that can be cast on different keyboard key combinations. Right now what I have is one .as file with ...
-1
votes
0answers
39 views

OO Design - returning a result vs. returning an object already including the new result [on hold]

I hope this question will not be downvoted. I am interested in a good OO design but unfortunately do not have any well experienced developer who can answer me. I'm creating some mechanism for ...
5
votes
2answers
199 views

Strategy pattern instances based on enums

I have a view which takes a DataPresenterStrategy instance to retrieve the proper text out of some data: ...
5
votes
1answer
45 views

Down the rabbit hole with MVP

Following-up on this post where I implemented a Repository Pattern in vba to abstract ADODB and enable testing my Excel app without hitting a database backend; curious about how far vba would let me ...
2
votes
2answers
103 views

Select item of IEnumerable<T> in UI (MVVM)

Please, help improve following code. I have list of users, item of the list has buttons remove (remove user from list) and profile (navigate to user profile). I use ...
3
votes
1answer
52 views

Implementation of MVC pattern with paintComponent method

Could someone review my code, with respect to OOP, clean code and MVC pattern? Main app: ...
8
votes
4answers
851 views

Decision Table for the Movement AI in a Game

I posted a question on Stack Overflow about how to implement Decision Tables in Objective-C after reading about them for the first time in chapter 18 of Code Complete. Nobody provided an answer, so ...
1
vote
1answer
47 views

Apply Good Patterns about Logging in Executor Process

I have source code for execute a command (ProcessStart) using Impersonate, and I want apply Best practices and good design pattern, and good performance if is possible. Too, I want use good Logging ...
1
vote
1answer
36 views

Module pattern callback implementation

I'm rewriting a simple app using HTML/CSS/JavaScript that creates animations with images using intervals, and there's a bunch of buttons that controls these animations. It's scaling and becoming ...
2
votes
0answers
22 views

Is this Repository/UOW design workable?

I'm using VS 2013/EF 6/WEB API 2. This application of mine which is working on will eventually grow to be big project and I'm in the very beginning stage and need your expertise to make it simple as ...
3
votes
0answers
36 views

Logging strategy setup

I finally set up my logging infrastructure to work as desired, however I feel like I had to do quite a lot things just to fulfill a few requirements. Now I'm worried if my approach has major ...
9
votes
2answers
77 views

YARPI: Yet Another Repository Pattern Implementation

Following-up on this post, I wanted to be able to put a copy of that Excel workbook on a USB key and take it home to keep working on the code a bit (there's more than just one or two tables to ...
13
votes
3answers
1k views

How is my CMS design? Any security, design, or other issues?

I am trying to learn PHP in depth by creating this personal CMS. I try to utilize OOP concepts and do best I can... The way I am trying to design this CMS is to keep including 'modules' within a page ...
11
votes
4answers
182 views

More German overengineering™ - Class mappings and factories

Goals: So the plan was simple: Provide a factory to instantiate implementations of a certain interface (ModelConverter<T>), depending on what model-class you ...
1
vote
0answers
21 views

Repository and Unit of Work asp.net/mvc/tutorials

I'm so confused after reading so many blogs I'm still not sure which way to go and I need help with Repository/UOF pattern using EF 6. As I was following the example here asp.net/mvc/tutorials and ...
1
vote
0answers
21 views

Should I use an abstract repository, or abstract gateway when I have multiple implementations of a single interface? [closed]

I have a single interface called ITask, which several other interfaces inherit from. One being IGTask and another being ...
2
votes
1answer
103 views

Repository pattern best practices using EF 6

Update: Answer to @Ben:----- Interface: I agreed with you and I'm not sure why did I put that and I usually use Get or GetAll ...
1
vote
1answer
39 views

Extend or Encapsulate [closed]

I couldn't find proper tips anywhere, since searching for these general terms isn't very efficient. I deal with this almost everyday, creating Java SWT widgets in particular. Each time I create a ...
3
votes
0answers
43 views

Is this a valid implementation of the MVP pattern?

Since fxml controllers compromises pure MVP, I tried to implement the pattern in this way: Main presenter class: ...
10
votes
2answers
162 views

Do I need ninject when implementing DAL with generic repository and unit of work?

I am implementing generic repository and unit of work for the first time. I would be glad if someone can correct me if I am doing something wrong here. This is how I communicate with my DAL from ...
3
votes
0answers
95 views

Game Engine :: Entity Component Design - Handling Input

I am currently creating a game engine for educational purposes. ECS Design Pattern The first design pattern I've included is the Entity/Component/System pattern. Therefore I've got a base singleton ...
5
votes
3answers
105 views

Confusing control flow

Currently, the following code runs and produces the expected and desired output. However, I'm sure that there's much wrong with it. This project queries the (flat) database, instantiates each row as ...
3
votes
0answers
53 views

Debug log wrapper

Please review code correctness, best practices, design and code formatting. I will be adding functionality and most likely additional refactoring, however a stringent review would be welcome before I ...
4
votes
2answers
212 views

Factory design pattern example in C++

I found a definition of the factory design pattern as: "Define an interface for creating an object, but let the subclasses decide which class to instantiate." I understood the first part "defining ...
0
votes
1answer
66 views

Command line multipart or single file downloader

I am looking for a code review for this multipart or single file chunk downloader using threading and queues. downloader.py ...
3
votes
1answer
50 views

Refactoring this producer consumer class to minimize what is exposed

I don't like the service class below, specifically, the way it exposes the internals of the producer. While it would be possible to combine all three classes into one producer-consumer, I would ...
2
votes
1answer
41 views

Factory style pattern in method

I have a method in a class, and its sole purpose is to prepare another class for use: ...
7
votes
3answers
108 views

Text-based Blackjack game in Python

I am new to programming in Python and wrote a simple Blackjack project. I am looking for experienced peers to provide a high level code review about the overall design patterns and proper usages. The ...
2
votes
1answer
78 views

Basic PHP Factory Pattern

I have an object, KbArticle, that originally in it's constructor, would try to return null if the SQL query that retrieves the data for its required properties came ...
1
vote
1answer
44 views

Concept for saving context information

My Problem I have a library containing business logic which is being used from 3 different projects: Website Local WPF Application WCF Service The library uses Entity Framework and a connection ...
6
votes
5answers
174 views

Casting base to derived class according to a type flag

I have been writing an event class for my game engine and I came across to the following problem: Is casting a base class object to a derived class object given a type flag a good programming design? ...
4
votes
1answer
61 views

Builder/named argument/fluent interface pattern with unique_ptr

I'm trying to figure out the cleanest way to implement a fluent interface with unique_ptr and other "modern" C++ language constructs. Here's my first attempt: ...
4
votes
1answer
94 views

First attempt at making a user class

I've just begun creating my first user class. First, I need some clarifications. Am I using try and catch correctly? To ...
10
votes
2answers
308 views

OO design for Tic Tac Toe program

I am practicing object oriented design and have taken Tic Tac Toe as an example. I have written first all the requirements and then started writing code. I would like to get it reviewed so that I can ...
1
vote
1answer
47 views

Unity DI Composition Root vs XML [closed]

I'm having trouble figuring out the best approach with DI. After doing more research, Mark Seeman recommends using the Composition Root approach. In my example, I am using XML configuration to design ...
0
votes
1answer
52 views

Use of getters and setters with a car information example

I have very quickly mocked this up as an example model in Angular JS: ...
5
votes
2answers
71 views

DRYing up an initialization pattern

I maintain a VBA process that prints a large number of PDFs. It was awful when I inherited it and I've been making improvements over time, but I'm a bit stuck on this one. There are at least 4 ...
3
votes
2answers
34 views

DOM building using DocumentFragment

I want to build the markup below by iterating on an array of objects. The structure of the object is also listed below. I need some tips on how to make it clean. Markup I want to build: ...
7
votes
2answers
117 views

Basic snake game

Coming from a Java background, this is my first JavaScript-only game. I'm looking for some advice on what to improve. Also, I'm having trouble when it comes to program design. Sometimes I don't ...
6
votes
2answers
191 views

Is this a correct use of using protocols and delegate pattern in Swift?

I am trying to grasp the concept of delegates and protocols in Swift. So I have implemented my own PlayableMedia protocol with two concrete classes ...
0
votes
0answers
23 views

Re-factoring restrictions validation functions for proper OOP design in MVC framework

I am aware that code review is for refactoring code from an existing code. Let me first to say that the following code works but inefficiently and its very convoluted, so I would like to apologize if ...
11
votes
2answers
239 views

Input handling system using the command pattern

The online book Game Programming Patterns briefly describes the use of the command pattern to handle input in a game. I've attempted to write my own "one size fits all" input handling system based on ...
4
votes
2answers
98 views

Would this be considered MVC?

For many days, I've been re-designing my application, applying some custom pattern and making our code looks like a framework. I have something like this for separate the business logic, from views: ...
3
votes
1answer
68 views

Should I null coalesce EventArgs?

When I implement events, it usually looks something like this: ...
5
votes
1answer
72 views

Message Based Communication Design

I'm trying to design an API.NET for some communication purposes with Testing Equipment and I cannot figure out a proper way for designing the architecture. Basically, we have different (physical) ...
4
votes
4answers
91 views

How to name template method properly so it makes better sense?

Some might not think it's worth asking but I consider good function names quite important. I am not sure what should be the overridable function name in what I think is template design pattern. I am ...