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

learn more… | top users | synonyms

3
votes
3answers
171 views

Engineering a minimalist image interface without templates

I'm practicing different ways of class design, so I'd like feedback on the design characteristics. Of course code practice comments are also welcome. It was a conscious decision to omit templates. My ...
-2
votes
0answers
10 views

Tables with same columns in Relational Database [on hold]

I need to know if its a good practice to make tables with the same columns on the database. I have a situation where i have 4 kinds of documents wich each one of them have a correct format (something ...
0
votes
0answers
25 views

Sun's HttpServer Simple HTTP server design [on hold]

For an assignment I had to write a simple Http server (multithreaded) with the help of Sun's HttpServer. This server has to handle 4 resource (/login (GET), /cards (GET), /send (POST) , /list (POST)) ...
0
votes
0answers
16 views

Testing if object is not deleted [on hold]

My object creates an thread and that thread modifies object-creator during his life cycle. The problem is, that thread should not invoke objects methods when it is destroyed. I have found some ...
1
vote
2answers
68 views

Adding action id to a history repository

In my system I have a history repository. My history class is big and with a lot of information regarding operations. My ...
1
vote
0answers
26 views

Decorator pattern for an application

I've created a decorator in my Rails application. However, the initializer has 3 params. Is this generally acceptable in decorator or should I refactor this or try a different pattern? ...
1
vote
0answers
36 views

Soccer game using libgdx and an Entity System Framework

I'm working in a game as a hobbie. I'm using an Entity/Component/System architecture using Libgdx as Engine and Ashley as Entity Framework. I have a GamePlayScreen in which I initialize my system, ...
7
votes
6answers
147 views

Super Market Checkout Pricing Strategies

I saw this question and thought it looked like a great opportunity to try my hand at the Strategy Pattern. I've never used it before, but I think I did pretty well. Did I? The code below can also be ...
5
votes
4answers
484 views

Database adapters

I'm writing adapters for some MS Access database because I really didn't like that automatically generated code that Visual Studio was providing. Right now I just need to get data, not updating ...
1
vote
2answers
36 views

Separate Ajax code in separate modules

This is the first time I am working on OOJS code and I am a beginner in JS. I think I have pretty much messed it up. I am planning to modularize my code, but with the inclusion of ...
1
vote
1answer
62 views

Creating various types of menus using dependency injection

I am here to discuss what are the possible improvement can be made in order to make the following code covering all the principles of programming paradigm ( SOLID , DRY ...etc ). Basically, I am ...
3
votes
1answer
53 views

Communication between View and Controller in MVC implementation

I'm working on a moderately complicated (not super basic, but not a feat of programming strength) project to create a virtual tabletop for a tabletop game I play. I'm trying to conform to good design ...
1
vote
0answers
26 views

Template design for static and dynamic sizes [closed]

Original design Consider the following class: ...
0
votes
1answer
50 views

Define constants in Util class or not

Which is best? I have a bunch of components in my projects. It's related to Ashley (a java entity system) to libgdx (a game engine). this components are like that: ...
-1
votes
2answers
40 views

Varying the parent class dynamically in Python

I am trying to dynamically pick a parent class in Python 2.7: ...
3
votes
0answers
45 views

Representing trajectory points using inheritance

Problem Background I need to represent trajectory points and trajectories (encapsulating these points) in the form of a collection of classes. All trajectory points have two essential elements: time ...
10
votes
1answer
201 views

C++ Observer design pattern implementation

I'm using the Observer design pattern in order to manage events in the game I'm currently developing. I based myself on the implementation demonstrated here but improved it in order to ease its use. ...
4
votes
1answer
60 views

Number Wizard standalone (UI independent) implementation

I was inspired by Number Wizard game question and I decided to write my own version of the game. My goals were to follow the SOLID principles and make the logic UI independent. I'm a bit confused ...
3
votes
1answer
62 views

Linq-to-SQL DAL on a Windows Forms project

I just started out a new job as a C# programmer on .NET 3.5. My manager gives me total independence on how I build my modules, which is generally a good thing, but there are minuses too. Having too ...
1
vote
1answer
35 views

Fruit game using nape physics with refactoring to Builder Pattern

I am doing a game that uses nape physics in ActionScript, but my question isn't about language. It is about the use of patterns. I had fruits in my game. I did one interface ...
3
votes
1answer
58 views

Is it an anti-pattern to let ViewModel fill itself from a domain object?

Let's say you have a Employees table mapped to a Employee class. Now you want to code a Edit page for general information. You need a ViewModel with all the properties you need to build the page, so ...
2
votes
2answers
58 views

Generating classes from enum

I have a system that receives messages. Each message has a type defined. These types are declared in an enum: enum MessageType { TYPE1, TYPE2, ... , TYPE999 } ...
6
votes
2answers
146 views

Performing multiple validation checks

I have a validation which checks that a string is a valid asset number. There are currently three formats it could be in, like: 001-123456, ...
1
vote
1answer
39 views

Manager for customer billing and subscriptions in Rails

I'm looking to get rid of a couple dependencies that I have a sneaking suspicion are present in the code that I'm writing. Right now I have a service class that manages my subscriptions for part of ...
1
vote
2answers
75 views

Handling errors of nested promises

This is in one of my AngularJS controllers: ...
1
vote
1answer
40 views

Organizing museum artwork

I have a small Django project to help organize museum artwork. In my models.py file, my museum object is defined as follows: ...
1
vote
1answer
60 views

PHP Memento design pattern implementation

I am a self-taught programmer. I decided to learn design patterns by reading about them, and then coming up with their implementation in PHP. I know that learning would be virtually impossible without ...
6
votes
1answer
108 views

Manage Connection Without 'using' statement

I replace this common statement: ...
1
vote
0answers
60 views

Replacing IUnitOfWork with a Factory Pattern

As a follow-up to this blog post and this question, I wanted to post my idea of replacing the IUnitOfWork with a factory pattern. It seems to me that in the case of this blog post the IUnitOfWork ...
1
vote
1answer
53 views

Exposing includes to client over webservice for database queries

I am using a CQRS type patter for querying data in my application. I am currently using entity framework to connect to the database. ...
0
votes
2answers
162 views

Library management system in C++

I am doing a beginner C++ project and it's simply a library management system where a student will hire, give back a book, book and hire records are stored in a binary file etc. I'm approaching the ...
6
votes
2answers
115 views

System for registering people

For a small administrative program, I have to be able to register people and their data. But, files are sometimes created through a phone call "on the fly" and then later certain data is added to the ...
7
votes
1answer
177 views

Creating composite objects using the builder pattern

I need to decode and encode TLV (Tag, Length, Value) data which is a composite part-whole tree structure. ...
2
votes
2answers
38 views

Functions and a GUI for entropy-related calculations

I wrote a script with utilities for calculating the entropy of iterables and included a Tk GUI that shows a quick overview over a text's properties in real-time. (on GitHub) I tried to follow PEP 8 ...
2
votes
1answer
35 views

Is it bad practice to have executable code in my channel state object?

I have a CommunicationStateMachine object that's attached to my channels. It keeps track of who's turn it is to speak, how far along the conversation the server and ...
2
votes
0answers
27 views

Functional, Loaner-Like Pattern For Consuming SQS Queues, Deleting Queue Items On Success

My program fetches input from a RabbitMQ or Amazaon SQS-like queue. There is not always input available in the queue. If a message is available, it triggers work. If that work is successful, ...
4
votes
1answer
76 views

Observer Pattern with an Observer observing multiple Subjects

Is the below a good solution for an observer to monitor multiple subjects. My only fear is that if an observer was monitoring a wide range of subjects then the update method could get quite large ...
1
vote
2answers
104 views

Generic repository object design + static DAL helper

I would like you to review the solution I came up with to the following scenario: In attempting to model a generic Repository object (that receives a generic type parameter) to interface with my ...
3
votes
2answers
118 views

Building a chain of responsibility in Ruby to apply transformators on an object

I try to make a middleware stack system in the rack way (but not for HTTP request). Here is the main class: ...
2
votes
1answer
51 views

Shared access point

In my game, people connect to my server. The server creates a GamePeer per connection. GamePeer creates one ...
3
votes
2answers
130 views

Service Layer Design

I have written the following service class for my application and at the moment it only contains a single method which is responsible for carrying out the necessary actions to add a new team to the ...
6
votes
2answers
1k views

ViewModel creator design

I am trying to move some logic outside my controller for creating my view models for the view. I have a lot of queries to fire to make sure the complete view model is ready, so to keep my ...
4
votes
1answer
64 views

Factory pattern for creating sub classes derived from interface with generic type

Would like to know if the factory pattern I've implemented for my stat library is the correct way to go. I have an interface IPlayerStatsManager where the type parameter is an interface as well ...
0
votes
1answer
68 views

Service per Controller

We have a base module consuming the company API. In each app I've written almost always a service per controller. Because most controllers are specific to a entity (a single user, a single post, list ...
0
votes
0answers
47 views

Object Oriented design - connection to multiple databases

I have a Python application which uses both SQLite and Postgresql. It has a connector class for each database: ...
3
votes
1answer
329 views

Onion Architecture

After doing a whole bunch of research on Onion Architecture, I have made an attempt at implementing this in a new system that we are developing. We have the Layers as per below: Domain ...
1
vote
0answers
84 views

Imgur API implementation using Retrofit

I've recently (an hour ago) started a project for making a wrapper for Imgur's API using the REST client Retrofit. I've only implemented a single endpoint so far as I'm questioning my design. While ...
2
votes
1answer
67 views

Decision tree for binary classification

I want to become a good Python programmer and so I'd like to know what in my code practices I can improve. Overall I feel like a pretty solid programmer but writing this code felt very "Java" so I am ...
2
votes
1answer
107 views

Database Access Object Class

I learned of the Database Access Object design pattern from a friend and decided to implement it recently to my MySQL database. The code uses MySQLi to connect to the Database, and uses prepared ...
5
votes
1answer
106 views

Creating and saving blurred screenshots in iOS

I am trying to create a class that takes a screenshot of the screen, makes it blurry and saves it to NSUserDefaults. ...