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

learn more… | top users | synonyms

3
votes
0answers
11 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. ...
0
votes
0answers
12 views

Stock market investment design [on hold]

I'm dealing with stock market investments; I have an Account() which can have multiple Holdings()s and each ...
0
votes
0answers
13 views

Organizing iOS Accessibility Implementation [on hold]

I am implementing Accessibility for our iOS application. Accessibility has following main configurations. Voice over enable/disable checks. ...
0
votes
1answer
64 views

C# Interfaces - Making them more generic, Adding specific\bespoke methods [on hold]

I'm writing a generic import\export program to import\export Stock and Sales Orders from a number of legacy accounts systems. I'm loading the correct concrete classes using a factory pattern, so the ...
3
votes
0answers
33 views

Number Wizard with an independent logic environment

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 environment independent. I'm a bit ...
3
votes
1answer
44 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
votes
0answers
22 views

Developing a Swift iOS app “The Right Way” [closed]

Recently, I've learned Swift and the basics to develop an iOS app. Now, I want to develop a real application by my own, but I'm very concerned about writing good code, so I've looked up for "best ...
0
votes
0answers
22 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
41 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 ...
0
votes
0answers
35 views

Refactoring data processing method into classes [closed]

I'm building an application that processes email messages in a mailbox, and, for each message, transforms the attachments and then replies to the sender. This application implements an existing ...
2
votes
2answers
56 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
139 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
28 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
68 views

Handling errors of nested promises

This is in one of my AngularJS controllers: ...
1
vote
1answer
37 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
57 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
89 views

Manage Connection Without 'using' statement

I replace this common statement: ...
1
vote
0answers
52 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
48 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
114 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
108 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
168 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. ...
-1
votes
1answer
20 views

Matlab quadractic function with graph

I'm very new to MatLab and I am having some difficulty creating the code and just understanding what to put where. I got my quadratic formula to run and loop(Ex 4.2), but now I've been asked to have a ...
2
votes
2answers
36 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
34 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
26 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
66 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
88 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
99 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
50 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
123 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 ...
5
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
55 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
64 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
42 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
227 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
61 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
53 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
103 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
96 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. ...
2
votes
1answer
109 views

Querying a database with Dapper

In the current project that I am working on, we are using dapper to query the database and sometime when mapping from dynamic types to concrete types we end up with a messy block of code. I created a ...
4
votes
1answer
71 views

Creating an async consumable object in Node

Background I have a situation where I have fixed number of objects with their own routines that would need to be called with the same initial message. To accomplish this, I have a Factory that ...
4
votes
1answer
76 views

Use of static factory methods for vectors and matrices library

I've been working on a Java-based mathematics library focusing on vectors and matrices. I plan to use it for an important upcoming project, so the classes are analogous to data types available in GLSL ...
2
votes
0answers
31 views

Mediator class to handle a bunch of rules between objects

When a LivingBeing attacks another LivingBeing, an attack roll is made to determine if a hit occurs. If a hit occurs, a damage ...
4
votes
2answers
127 views

Separation of concern on micro lvl

The task is to create a DataTable with 1 column + header and 7 rows with content. The content will never change Implementation: ...
10
votes
4answers
2k views

TicTacToe AI needs optimization

How do I condense this gigantic monster into something more manageable? I heard about command pattern but I can't figure out how to use it. What other solutions are there? ...
-1
votes
1answer
74 views

DDD and Dependency Injection a smell or common [closed]

I am working on a little something to build up my understanding of DDD. Those of you who are familiar with the game Fantasy Premier League will perhaps understand my dilemma or even maybe inform me I ...
1
vote
1answer
89 views

Car store implementation using abstract factory

I'm studying design patterns and I made this car store implementation. Although I'm confident that the idea is right, I'm not confident that the implementation is good. I would like you to check it ...
4
votes
0answers
63 views

Follow up on CRTP with multi-level hierarchy

I was working on a similar problem to this post, asked a question on the Eigen Mailing List, and Gabriel pointed me to the above post, from which I was able to get my code working again. He further ...
5
votes
3answers
142 views

Design of a remoteControl class for connecting to electronic devices

In a course that I'm taking on learning object oriented programming in java, I have completed an assignment for modeling a home entertainment system and the ability for a user to be able to use a ...