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

learn more… | top users | synonyms (1)

1
vote
0answers
68 views

Guaranteed message sending for messages of different priority for different modules

We have created a message que system using priority messages. The idea behind this is as follows: We have a list of clients. All clients know if (and what kind of priority) messages they have ...
1
vote
2answers
184 views

Software Design, a fitting Design Pattern?

Currently we need to interface with a REST API. The only problem we have implementing this is choosing the right approach. We’ve done this by using Resources – for example a Photo Resource that has ...
0
votes
1answer
60 views

Change stock calculation depending on warehouse

I have a currently-existing stock management dashboard. The user selects a warehouse, and it displays the current stock in this warehouse. The stock management teams wants to display a date, ...
8
votes
7answers
356 views

A property that can represent both a single date and a date range: How to properly model that?

I work in a system that can represent a "shipping estimate" in two ways: A specific date: The item is guaranteed to ship at that date A day interval: The item will be shipped "X to Y" days from ...
13
votes
7answers
2k views

Is there a pattern for a more “natural” way of adding items to collections? [closed]

I think the most common way of adding something to a collection is to use some kind of Add method that a collection provides: class Item {} var items = new List<Item>(); items.Add(new ...
2
votes
2answers
460 views

How can I decouple query and context in a “query object” scenario?

I'm using a query object pattern (similar to this) to manage disparate queries while avoiding bloaded facades/repositories. A query object takes a number of constructor parameters, representing query ...
-1
votes
2answers
112 views

Chat Protocol Implementation

For a school assignment we need to implement a homebrewed protocol. We make usage of plaintext commands to send and receive messages. The commands underneath are currently supported by the messaging ...
2
votes
4answers
130 views

How to enforce how an interface is consumed

Imagine I have an interface: public interface MyInterface { void CallMeFirst(); void CallMeDuringApplicationLifecycle(); void CallMeOnApplicationExit(); } What is the best way of ...
5
votes
3answers
426 views

Scheme/Design Pattern for allowing a certain outside class to set properties

I came up with a solution (in PHP) to a problem and am wondering if it is a named Design Pattern, and if it is good practice. I have a collection class and an item class. The collection class is the ...
-1
votes
1answer
133 views

Does this pattern have a name?

I have a large XML file that I extract information from. I am extracting the information using a list of classes with a main method of the type ParsedValue[] GetValue(BigXmlFile). This is a bit like ...
2
votes
0answers
49 views

Mocking third party web service

I am working on a project to create a wrapper library which will be used to interact with a web service provided by the client's IT team. The reason for this library is that we interact with this ...
2
votes
1answer
56 views

Inferring system configuration using the existence of a file? any good?

This is a generic question about the idea of inferring some of the system configurations from the existence of a file or the lacking of it. For example, we have a module of the system which is ...
2
votes
1answer
140 views

In a polled interface, is it okay for an object representing hardware to start a task responsible for the polling?

I am a hardware/test engineer currently writing a C# application for a device that does not have any event/interrupt mechanisms. Because of this I am forced to poll the device's internal control ...
2
votes
1answer
289 views

Strategy Pattern not sufficient for my problem?

Let me sketch the situation: I have multiple users, with certain properties (2 enums) For each user I need to fetch data, for some with some basic filtering, for some extended filtering (= basic ...
0
votes
3answers
82 views

How to represent an object with actions that can only be used in a specific situation?

Let's say I'm designing an RPG type game, and this game has a turn-based combat system. There are some things that the player character/non-player characters can do inside and outside of combat. For ...
0
votes
3answers
225 views

Client-Server Application Object with child Objects

Actually I'm going to build an Client Server Application, at the Login I recive the User Object from the Server. An user has a List of tasks, but I don't want to load them at the Login. So what would ...
0
votes
0answers
45 views

Migrating off a Silverlight application to SPA - technologies

We have pretty big Silverlight LOB application. It works great, took many years to write and it's big... Back when we made a choice (2011) JS/HTML5 was in unknown state. Today we have all kind of ...
1
vote
1answer
70 views

How to uncouple and reuse persistence logic, user interface logic and business logic amongs embedded software projects

I have been working in embedded devices business more than 5 years as a software engineer. Most of the times our hardware manufacturers provide a Software Development Kit for their reference boards. ...
1
vote
2answers
212 views

Migrating large silverlight business application to MVC

I have the task to migrate a large silverlight business application in a new living technology. I had choosed asp.net MVC and web api. As we know, silverlight uses MVVM design pattern whereas asp.net ...
1
vote
4answers
106 views

File-Directory Implementation: Does a a file have to own a reference to it's dir?

I am currently issuing a problem while forming the program-design, which is exact like a File-Directory relationship, and to ease it, I am using that as an example. I think it is usual, that a ...
2
votes
3answers
71 views

Calculating a score and a breakdown of the score in different places - should I use the same methods?

I am creating a plugin that uses a metric to determine a score on one page and allows the user to click through to see a more detailed breakdown of the score on a separate page. The trouble is: I ...
2
votes
2answers
146 views

Design for an Android app (pharmacy duties)

I am creating an android app for pharmacy duties for different cities. My approach: I created an Interface with method getDuties, and for every cities I create a class named with name of the city ...
27
votes
5answers
5k views

Why was dependency injection pattern not included in the Gang of four?

Why was the dependency injection pattern not incluided in the gang of four? Did GOF pre-date widespread automated testing? Is dependency injection now considered a core pattern?
8
votes
1answer
282 views

How is Inversion of Control related to Dependency Inversion

In many articles all over the web the terms Inversion of Control and Dependency Inversion Principle seem to be mixed up and used as synonyms (further confusion is enforced by the tools that are called ...
10
votes
5answers
3k views

css - use universal '*' selector vs. html or body selector?

Applying styles to the body tag will be applied to the whole page, so body { font-family: Verdana } will be applied to the whole page. This could also be done with * {font-family: Verdana} ...
3
votes
2answers
196 views

Extending the flyweight pattern: an oxymoron?

I'm developing a BNF parser in PHP, for my own flavor of BNF. To keep the resulting parse tree, consisting of objects, as lightweight as possible, I decided to use the flyweight pattern for literals ...
3
votes
1answer
194 views

What design pattern is used in this delegating scenario?

I am currently having to bend some framework API to fit my usecase. The framework provides generic interfaces such as public interface Processor<T> { T process(T t); } with various ...
1
vote
0answers
130 views

OOP - Modeling a Chat Design Review [closed]

Seeking thoughts on the following design. I know the design could be lot simpler if use Sockets. But I wanted to think of a design with pure POJO classes. User string id; string displayname; ...
1
vote
3answers
245 views

Constructor with tons of parameters vs builder pattern

It is well know that if your class have a constructor with many parameters, say more than 4, then it is most probably a code smell. You need to reconsider if the class satisfies SRP. But what if we ...
5
votes
2answers
197 views

Respectable design pattern for making node modules flexible/testable?

I am looking to get some input from some more experienced testers than what I am. :) I am trying to make my node modules testable, allowing for dependency spying/stubbing/mocking without the need to ...
0
votes
2answers
127 views

OO design: separation of concerns

I have a collection of classes which model Logical(Boolean) Expressions. There is a base abstract class LogicalExpression, and derived classes : UnaryLogicalExpression, BinaryLogicalExpression, ...
4
votes
1answer
95 views

Does a mutually exclusive Decorator design pattern exist?

We know the Decorator design pattern, but how would someone go about implementing mutually exclusive decorators? Let's say I have a decorator pattern to implement weapon modifiers in a game. The ...
1
vote
2answers
154 views

Suggestions to distributed service pattern

We expose some webservices on a server, written in C#. Now we have to distribute the services to multiple servers, so the solution is distributed. And each request is dispatched to one the servers to ...
2
votes
1answer
126 views

What is an appropriate pattern for handling a queue of network events in C++?

I'm writing an application that sends and receives messages over the network and pushes them into a std::deque queue. and I'm looking for the appropriate programming pattern to handle all of the ...
2
votes
1answer
82 views

Design patterns to limit cross module logic

I have a web application which has a shopping cart with cart items. The cart items are added to the user session, so must be serializable. I have a checkout class which takes the cart items and saves ...
2
votes
2answers
127 views

Abstraction on Iterator Pattern?

Recently, I had the task to implement a research project where I had to read an XML file. XML file contained a list of messages that I had to send to some other system on a specific port. Each message ...
0
votes
0answers
54 views

Layer application and token authentication

Suppose we have an application with multiple layers in .Net: Domain layer (entities) Data access layer (entity framework) Business layer Web Services layer (Web Api) Presentation layer (MVC) Now I ...
3
votes
1answer
96 views

Snap to grid functionality in drawing application

I'm working on drawing application and I want to provide grid with snap to grid functionality. I'm trying to find the right way how to do that (ideally some design pattern), but I'm quite confused ...
3
votes
1answer
114 views

A “sort of” Units of Unit of Work

I've read Unit of Work pattern and tons of MVC/EF Unit of Work examples but what I'm trying to do is encapsulate multiple unit-of-work into a large set. Maybe this pattern already exists somewhere, ...
1
vote
0answers
76 views

Data Mapper pattern vs. model encapsulation

I am currently developing my first custom data mapper layer but have run into a conceptual problem that seems to be glossed over all books and guides I have read. My problem is as follows. My data ...
0
votes
6answers
486 views

Possible way to make java class builder more abstract by using interface required keys

I'm looking for a more abstract pattern for builders that handles required fields without the need of writing a validator that checks if all requried fields are set. I like this builder. But is ...
3
votes
2answers
127 views

How do you handle sequentiallity in API's?

Consider a use case of the form: The system shows a list of potential filters (by name, by creation time...). User chooses a filter and supplies necessary parameters. System shows a list of ...
0
votes
0answers
79 views

Proper way/place to apply decorator pattern for view layer in mvc

I have an array of model objects containing data some of which is states represented by integers. In the view these states are shown as icons and tooltips. The tooltip is needed only in the view and ...
0
votes
0answers
110 views

Multiple inheritance in ASP.NET MVC Controller

In one case BaseWizardController should implement background functionality of BaseController->BaseConsumerController, in other case it should implement only BaseController. Any ideas how can I do ...
1
vote
0answers
61 views

is Command appropriate software pattern for this?

I have following task: I need to send several instructions after each other to the hardware. Next instruction is never sent before either answer to previous instruction comes (valid answer or error) ...
0
votes
1answer
100 views

How to make it clear I'm violating Command Query Separation

Command Query Separation is a useful principle, though it's not always ideal. Sometimes you need to run a process, which will result in useful data you need to return. My specific case is uploading a ...
1
vote
2answers
72 views

How should an entity that abstracts an external service do its operations?

I'm creating a system using some DDD principles and I'm stuck with a problem. To give a bit more of context on what I'm trying to do, let me first describe what the system is about: The ideia is to ...
0
votes
1answer
66 views

Architecture of approval process

I want to design an approval process for my work flow but I wonder if there is an architecrural pattern or desing pattern for this solution. For example an engineer will create a work. And program ...
7
votes
2answers
210 views

Android: Pattern for checking requirements at startup?

My app's launcher activity checks a bunch of requirements like whether GPS is enabled, there's a network connection, the app has device administrator privileges, etc. Some of these checks display ...
1
vote
1answer
656 views

Correct pattern for Worker Processes involving Queues & Tables

Edit: OK, so, people said it is unclear what I am asking. I am asking for feedback on this design. Here is an example user story: As a group admin on the website I want to be notified when a user in ...