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

learn more… | top users | synonyms (1)

0
votes
1answer
29 views

Design a Queuing Solution with Clustering and Multiple Consumers

It is a Design Problem which I am listing out here. I have different set of business operations that are carried out for different business entities. Operations: Operation A Operation B Operation ...
4
votes
2answers
73 views

Design solution for communicating between multiple layers

We are developing a framework that has several layers and would be deployed in a multi-threaded environment. Each layer may have its own input/output data type. The top layer takes the input, performs ...
0
votes
2answers
66 views

Pattern for caching DAOs: strategy or decorator?

I'm building a php system with the Services/DAOs/Domain Models pattern, and now is the time to implement a caching system for the DAOs. Would you use a decorator pattern, or maybe the strategy ...
1
vote
2answers
50 views

many to many relation in database schema and oop class diagram

I have Student and Group entities. Student can have many groups and Group can have many students too. so in database I should have middle class and change many-to-many relation to one-to-many and ...
1
vote
2answers
190 views

API - How to handle scope based functionality?

TLDR; Where and possibly how should I implement scope based logic in the example code? I have got a ASP.NET Web Api. The Api uses OData (on top off REST) for data endpoints and OAuth 2.0 ...
0
votes
0answers
39 views

Multi process programming

I'm developing an xml server in python which serves as an api emulator for an existing server. I'm using process libraries in order to handle multiple processes in the server for each client request. ...
1
vote
1answer
176 views

Methods for structuring JavaScript SDKs

I've built a REST API and have been using Backbone models throughout a couple different applications to communicate to it. I would really like to build a single JS SDK that can be used in any ...
0
votes
1answer
227 views

How could I avoid singletons in this case? [duplicate]

Using Dart in the client part of a web app where I have an application manager that contains a List of application instances and references to services that are used by each application as in the ...
0
votes
2answers
178 views

What design pattern for changing interface?

Sorry guys, I should have clarified the fact that the modified method is abstract in Father. Then if the method signature changes, all its implementations in SonX shall also change(at least the ...
3
votes
1answer
99 views

Designing a better performing total permissions setup for multiple permission levels

We've got a global system that we are attempting to solve a permissions issue around. Currently, our system serves a number of different applications out to our clients and each client has their own ...
1
vote
2answers
244 views

How to design a scriptable communication emulator?

Requirement: We need a tool that simulates a hardware device that communicates via RS232 or TCP/IP to allow us to test our main application which will communicate with the device. Current flow: ...
3
votes
1answer
86 views

How should I represent composeable, associative computations to be repeatedly applied to units of data?

Spoiler My question is the following: Are there any design patterns for representing chainable functions that are for the problem described below? High-Level Decription of the Process I'm ...
3
votes
1answer
42 views

Template pattern with varying input type in overridden method

I am trying to use template pattern to define a generic algorithm in java. But the method that needs to be overridden, takes an object as input. This object will vary depending on the concrete ...
1
vote
1answer
403 views

State Pattern - should a state know about its context?

I am referring to the state pattern as described in this link. In the example class diagram, a context has numerous states. However, it does not show how does a state communicates with a context ...
3
votes
3answers
243 views

Best approach for tracking dependent state

Let's pretend I work on a project tracking application. The application is a database backed, server hosted, web application. In this application there are Projects which have many Activities which ...
7
votes
1answer
1k views

Useful design patterns for working with FragmentManager on Android

When working with fragments, I have been using a class composed of static methods that define actions on fragments. For any given project, I might have a class called FragmentActions, which contains ...
0
votes
1answer
160 views

Where and how to reference composite MVP components?

I am learning about the MVP (Model-View-Presenter) Passive View flavour of MVC. I intend to expose events from view interfaces rather than using the observer pattern to remove explicit coupling with ...
0
votes
0answers
18 views

Is having a parent controller to manage a set of tabbed sections an anti-pattern for an angular application?

A lot of times, I have long forms that I divide into multiple tabbed sections. Each section is managed by it's own controller and there is a parent controller that manages the whole view. I use ...
23
votes
2answers
5k views

How to improve upon Bloch's Builder Pattern, to make it more appropriate for use in highly-extendable classes

I have been greatly influenced by Joshua Bloch's Effective Java book (2nd edition), probably more so than with any programming book I've read. In particular, his Builder Pattern (item 2) has had the ...
2
votes
1answer
123 views

Why use a enum to create the singleton pattern [duplicate]

Why would you use an enum to create a singleton pattern? To what purpose would it serve over a conventional singleton pattern? I have seen the above used. The code uses an enum to create this pattern ...
2
votes
1answer
31 views

Applying initialization-on-demand holder idiom at variable level rather than class

I was looking for the idiomatic way to implement thread-safe lazy initialization for a configuration collection retrieved from the DB inside a Spring bean. I decided to adapt the ...
25
votes
4answers
25k views

What is the point of using DTO (Data Transfer Objects)?

What is the point of using DTO and is it an out dated concept? I use POJOs in the view layer to transfer and persist data. Can these POJOs be considered as an alternative to DTOs?
0
votes
1answer
152 views

Is this a pattern? If so, which one? (Contexts, Requests and Responses) [closed]

In most of my code nowadays, I adapted to an approach which I think I read in the context of "Clean Code". It was some years ago and I cannot find the source again, so I would like to know what the ...
0
votes
4answers
110 views

Client vs Creator in Factory Method and Abstract Factory patterns

This page descibes one important difference between Factory Method and Abstract Factory: http://architects.dzone.com/articles/factory-method-vs-abstract The difference, according to this page, is ...
3
votes
3answers
166 views

Is it misleading to label code as a particular design pattern if it only loosely fits the definition?

Background: I have a rough, but working understanding of ~15 design patterns. It's been my experience using design patterns in my own projects that the resulting implementations usually end up as some ...
0
votes
1answer
363 views

Interface questions for using Command Pattern and Dependency Injection together

I have many projects that have essentially the same high level requirement: test all hardware on a device. Each device can have a different communication protocol, requires different test equipment to ...
0
votes
0answers
73 views

Dealing with several custom getters

I have a data structure with data units containing different types of data. I've wrapped the data in "Field" objects so that each field is able to independently parse user input in a desired way. ...
1
vote
1answer
179 views

Best OOP pattern to use for creating a commandline SQL API for a proprietary json based company datastore

We need to create a SQL commandline tool for querying a proprietary json based datastore. I'll be using java. Any suggestions on the primary OOP design pattern I should use for building this API? ...
1
vote
1answer
92 views

Should make concrete factories in the same count of families of objects or according to stages in my problem?

I am programming a game. In this game I have 3 stages. In the first stage, there is a static goal and a static shooter in the game. In the second stage, the goal will move. And in the third one both ...
5
votes
2answers
504 views

How should I handle logger failures?

In several of our company's applications, we use a custom logger. It's fairly robust, though we may replace it with something like NLog in the future. One of the logger's tasks is to log any ...
0
votes
1answer
233 views

Is factory pattern a right pattern for the situation described here?

Is factory pattern a right pattern when we want to consolidate the related objects? Problem - In the Set-top box, I have a user-io, basically the interface to control the settop box - The user-io can ...
2
votes
2answers
109 views

Design pattern for composition workflows

Please bear with me as I find this tricky to articulate exactly what I am after (probably not a good sign..). I have several services set up which can be combined in a particular order to create ...
1
vote
1answer
160 views

PHP - Repository matrix pattern?

I'm trying really hard to refactor some of my legacy code in the project using best practices and design patterns + DDD so I'd love some feedback on an issue I'm currently having. Let's assume that I ...
1
vote
0answers
120 views

When do I reuse or create a new Builder

I've implemented a Builder Pattern in a project I'm working. I'm using this design pattern to created Fields and Components (div, tables, panel (boostrap)). So I have a Director Component class. It ...
5
votes
2answers
410 views

Trying to identify IClass, Class, ClassImpl pattern

I've been seeing a lot of code recently that looks like this: public interface IFoo { int Bar(); } public static class Foo { public static IFoo Create() { return new FooImpl(); } private ...
5
votes
4answers
663 views

Design Patterns for Coordinating Change Event Listeners

I've been working with the Observer pattern in JavaScript using various popular libraries for a number of years (YUI & jQuery). It's often that I need to observe a set of property value changes ...
0
votes
1answer
69 views

Can JUnit be used to test this project?

I currently have an interesting situation occurring with my code, and after hacking away at what turned out to be a dead end for the last two weeks, I'm here asking those smarter than I to educate me ...
2
votes
1answer
103 views

Is Singleton enough for a EMailUtil or there is any better implementation? [duplicate]

I am developing an application, where I have to send lots of emails for user account creations, validation, invites etc. I have implemented a static class EMailUtil which has different methods like ...
2
votes
1answer
88 views

Simple and Composite transactional services: Question about separation of concerns and transactions

I believe I know the answer to this but I'm looking for any holes or anything I may be missing. This is focused on Spring and Java but could really apply to any programming stack. Anyway, we have a ...
0
votes
4answers
414 views

Is it bad to use DI to inject constructor parameters at runtime?

These are two classes, the first one I inject an instance of type IEngine while the second one I inject owner's name, tickets and engine. Version 1: public class Car { public Car(IEngine ...
0
votes
1answer
45 views

How to organize conversion logic for strategy pattern?

I have a Color class. It has a property model which is a class that implements ColorModel interface, this property could be a RGB, Hex or HSL classes which implementing ColorModel interface. // ...
2
votes
1answer
423 views

How do you show the exception handler in a class diagram?

I have one exception handler class. I want to show this class in the uml -- class diagram. But, I do not know how to represent relationship between class <X> and exception handler class. How can ...
1
vote
1answer
426 views

Confused on how to properly employ a Repository Pattern with Service/Business Layer on top

I'm building a ASP.NET Web Api 2 solution for learning purposes, and I've hit a snag. I was wondering if anyone could tell me what exactly it is that I'm missing. My Web Api solution has 4 Layers: ...
1
vote
2answers
327 views

How to present a stable data model in a public API that allows internal data structures to be changed without breaking the public view of the data?

I am in the process of developing an application that allows users to write C# scripts. These scripts allow users to call selected methods and to access and manipulate data in a document. This works ...
0
votes
3answers
105 views

Various methods manipulating same member variable versus each takes inputs and provides output [closed]

As software design paradigm which is better? to let various methods manipulate a member variable, or define each method or function to take some inputs and provide some outputs? For example class ...
0
votes
1answer
175 views

Design Pattern Question

I'm relatively new to the world of OOP, and having read through some design patterns, I'm struggling with that 'aha' moment. I have the following objects Event (Single event, with start time and end ...
33
votes
8answers
10k views

Return magic value, throw exception or return false on failure?

I sometimes end up having to write a method or property for a class library for which it is not exceptional to have no real answer, but a failure. Something cannot be determined, is not available, not ...
1
vote
1answer
76 views

Which design pattern restricts limits class creation to certain classes

I have a fairly simple application that is divided into two classes. The first class is the Manager class and the second class is the employee class. These are simple classes and do not inherit from ...
1
vote
0answers
54 views

Extend, wrap, or both to add generics to a class that should have had them?

So I'm using a C# framework that has a great example of where generics would be useful, except they weren't used. For simplicity's sake, we will say it was a list (I know C# has its own list), but ...
-2
votes
1answer
62 views

Front-end or Back-end Implementation of API? [closed]

Lets say I want to implement an API from an external website, for example like Dribbble or Last.fm. I'm fairly new to this new generation of front-end MVC's (angular, etc), and most example's I've ...