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

learn more… | top users | synonyms (1)

0
votes
0answers
8 views

How to simplify structure of a monitoring software that uses the Observer pattern?

I am working on a project where I have to monitor the status of an elevator. So far, my design looks like this: We are using a third party library to read and monitor real-time values from the ...
-5
votes
0answers
19 views

patterns and technologies are commonly accepted as useful [on hold]

In terms of business development, there are design patterns that are favored by some companies and others that aren't. For example, some companies want developers to know and implement the MVVM ...
4
votes
1answer
72 views

Clean Architecture - How to go from “Database Driven” to “Independent of Database” [on hold]

I am looking for some clarity and hopefully some advice on writing clean architecture for a large system. My Companies "Web Solution" is +-10 years old, my job is to rewrite it. It is written across a ...
-5
votes
0answers
22 views

Sites to improve Java programming skills [on hold]

I am a Java coder with 3.5 years of Industry experience. I wanted to improve on my Java coding skills on Collections, along with design patterns. Any sites where we can learn i get small real time ...
5
votes
1answer
107 views

Is there a design pattern for managing deep many-to-many relationships?

I'm having trouble defining this data pattern I've come across working on several applications. It consists of: An object type which is composed of many objects itself A second object type, where ...
2
votes
1answer
135 views

Is it a good idea to have separate UI components make their own webservice calls?

I have few UI components in an angularjs web-application. Each display data based upon same input. One shows stats which are calculated on the basis of a time period. Other shows a chart of daily ...
1
vote
0answers
23 views

Abstract Alert Dialog Builders (Same Method Calls, Different Objects)

Currently I'm working on an Android library that creates a dialog which allows to select colors from a palette (examples at the end) and I've stumbled upon an interesting design problem. To create ...
4
votes
3answers
117 views

DDD design question

I have a question on modelling an Entity\Aggregate root in DDD. I am refactoring a project that uses Entity Framework and business logic as services, the services contain lot of logic which I believe ...
0
votes
1answer
35 views

Flux Pattern dispatcher broadcast

I'm trying to get a better understanding of the flux pattern Facebook introduced a while ago. From what I understand the dispatchers dispatches every payload to all registered callbacks. Does anyone ...
-2
votes
0answers
48 views

Builder Design Pattern : Accessing/Passing model data in/to Concrete classes [on hold]

First of all Sorry for question if its completely wrong, i am new to Design Patterns. I asked this question here also ...
0
votes
2answers
117 views

Repository pattern with service layer - too much separation?

I have an MVC site which uses the repository pattern. I don't feel like I'm using the MVC style enough, so I'm getting ready to re-architect some of it. But I'm also wanting to do it so if the ...
2
votes
0answers
63 views

Seperate settings and implementation class hierarchies

We use XML serialization to store class settings. Each setting-class has (but doesn't reference) corresponding implementation-class. Therefore we can easily make a "settings dll" without any ...
1
vote
1answer
80 views

Pattern for passing in a field as a parameter

I'm writing a Rails app which uses ActiveRecord ORM and a Postgres DB. I've got two attributes which are similar but are separate fields in the database. The assignment and saving of these is kinda ...
-1
votes
0answers
55 views

Design pattern for user-roles on MVC, following SRP [on hold]

I'm working on an application with 3 types of roles. Some roles may view the same data, and perform the same actions; but also differ in some other view or actions. Following SRP, I'm used to see a ...
0
votes
0answers
16 views

How should one model an ExchangeService object (in ews-java-api) for sharing MS Exchange connections?

I am creating an application which uses ews-java-api to connect to an MS Exchange server. Once the connection is authenticated, the api dictates use of ExchangeService object for searching mailboxes, ...
11
votes
2answers
616 views

DRY principle in good practices?

I am trying to follow the DRY principle in my programming as hard as I can. Recently I have been learning design patterns in OOP and I have ended up repeating myself quite a bunch. I have created a ...
2
votes
4answers
235 views

Good practice for holding immutable data

I'm wondering what is the best practice for holding immutable data, more specifically in C#. For instance, lets say I have an immutable object called Foo. public sealed class Foo { public int ...
2
votes
2answers
102 views

Where to put the Country Table?

It might sounds like a silly question but here is my problem. We have 100s of databases and in each of those databases, there is a country table. It was ok this way but we ran into minor problems at ...
0
votes
0answers
40 views

Securing HTML/JavaScript only web app / JAX-RS Backend [closed]

I am prototyping a small web app where the frontend will be a pure HTML+JavaScript+JQuery which consumes services from a JAX-RS backend. The application has started to have a shape now but I find ...
0
votes
1answer
79 views

How to design resilient web service clients?

I am writing an app that is supposed to talk to a web service. Let's say it's a chat app. It would need to receive a stream of new messages (so that they are pushed to the interface as quickly as ...
1
vote
4answers
178 views

Strategy pattern and “Is a” relationship

Imagine, I have class IAlgo which is an interface. I have derived from him and implemented his single method called matchCount in different implementations - AlgoA1, AlgoA2, AlgoA3, AlgoB1, AlgoB2. ...
6
votes
1answer
136 views

UI Design patterns for non-screen based project

I'm working on a small project coded in Python that uses a single button for input and a RGB LED as feedback, which responds to button presses and asynchronous events from the network. As the ...
2
votes
1answer
61 views

For DI, where to create dependencies (new objects) specifically within framework code?

Basic requirement I'm making a framework for learning purposes (and likely usage on personal sites). I'm using dependency injection in classes and I'm trying to design where would be a good place ...
5
votes
2answers
167 views

Persisting Large/Complex Entities with the Command Pattern — Am I doing it right?

I am in the process of designing and building a large-scale inventory management software-as-a-service that will, hopefully, live a long and fruitful life. Therefore I am exerting a lot of effort ...
-1
votes
2answers
129 views

Modelling a parcel management application

Scenario/Context: I am working on an application which would find out the highest volume of parcel delivery based on the pin code of a particular area by reading a text file which has the list of ...
2
votes
0answers
39 views

Go - idioms/design for determining when an unknown number of goroutines are complete

I have a workflow wherein I walk recursively through a bunch of directories, then for each file perform some action. I'm using goroutines to walk each directory, and also to process each file. The ...
2
votes
1answer
89 views

Thoughts on having a generic, reusable grid viewmodel

I'm developing a wpf-based application and I'm currently struggling to find the best way of supporting a recurring scenario in it. This app uses grids a lot. There are a bunch of features I want in ...
1
vote
3answers
124 views

How to understand if a property is a member of a class or I have to create a different class that holds it?

Sometimes when you create a class you can add there several properties (new data members) that you are not certain if you want to do or not. For example, I have a casino slots game. I have tiles and ...
0
votes
1answer
66 views

Implementing the State Pattern with Object.setPrototypeOf()

Take a look at this implementation of the state pattern in JavaScript: var ON = { switch: function() { Object.setPrototypeOf(this, OFF); this.state = "OFF"; } } var OFF = { ...
4
votes
3answers
130 views

Can a pimpl variation be implemented without any performance penalty?

One of the issues of pimpl is the performance penalty of using it (additional memory allocation, non-contiguous data members, additional indirections, etc..). I would like to propose a variation on ...
0
votes
2answers
115 views

How should I structure these Python classes?

Base Class I have a class called Remote. This class represents a remote machine and has properties such as ip, hostname, username, and password, as well as methods for transferring files to/from the ...
1
vote
0answers
100 views

Does this seem a reasonable design? [closed]

I'm trying to design a program that: Retrieves/saves pages from a MySQL table - each has an id, title, description, and page contents Has the ability to draw pages either in HTML or PDF Here are ...
1
vote
1answer
110 views

How to watch a message queue properly

I have a scenario where I need to 'watch' an Amazon queue. When a message arrives I need to get this message and process it. Right now this is implemented with a do/while and Thread.Sleep when no ...
2
votes
1answer
72 views

Class structure for Entity Framework

I'm using EF (Code first) and I'd like to isolate the properties from the methods (many of the methods reference other libraries that I don't want my database project to have to reference). As an ...
0
votes
1answer
70 views

How to avoid circular patterns in Node?

I'm new to Node and JavaScript (well, asynchronous programming in general) and I noticed when I was working on a project that the following code is a circular pattern and that these are bad practice ...
4
votes
0answers
84 views

What is the correct place to put checking of conditions in this use case?

Here is the situation: I have a database and a class that is basically a representation of a set of fields of different tables in it. Let's call it Message. "Message" does not know of the database ...
0
votes
2answers
67 views

How to better define SRP and “wholesome” objects? [duplicate]

Assume you have a class. It can really be any class that defines a domain concept like an employee, a product on an e-commerce site, or a car. One of those examples that are oldies but goodies. ...
4
votes
1answer
171 views

Understanding factories

I know there are hundreds of questions about this on here. I've probably read fifty different questions, blog posts and textbooks. The problem is I've gotten about 75 different answers. I have seen ...
2
votes
1answer
46 views

Best pattern for manager class that handles syncing objects between client and server

I am writing a client which has support of 'offline mode'. When offline records can be stored locally. When we go online we want to be able to synchronize these records with the remote API. I want ...
4
votes
1answer
51 views

Best practice for defining and keeping related stateless methods together in Objective-C

I have a few methods which are stateless: loginWithEmail: password: completion: signUpWithEmail: password: completion: resetPasswordForUsername: completion: Currently what I do is I create a class ...
2
votes
1answer
46 views

Pattern for “Assembling” result from multiple datasources

I'm creating a server in Java (although this question is language agnostic) that will do the following: Pull a set of "leads" from a database every 10 minutes For all leads with a certain marker, ...
0
votes
0answers
36 views

Is there a good pattern for building nested form objects with validations?

I'm using the form object pattern to handle data normalization and validation in my app. It's working well for simple cases, but some of my form objects are composites (or roll-ups) of multiple other ...
1
vote
2answers
93 views

What is a good way to organize service layer classes?

I had a Service layer in my app and, for a while, there's just one class for API calls Current Scenario MyAPI Class authenticateApp() authenticateUser() Looking in the future, that class will be ...
1
vote
1answer
92 views

Accepted Patterns For Base Class with both Static And User-Defined Data Sources

I have a requirement to build a 'base' profile library (in C# - NET 4.5.2) for various different internal (technical) consumers. This profile consists of metadata fields that would be shared by a ...
0
votes
2answers
152 views

Design Patterns: What design pattern should I use for the following? [duplicate]

I am trying to write an utility which traverses through a list of files and searches for a string in each file. On finding the string in a file, I will add it to a list and display the list. Which ...
4
votes
0answers
58 views

Which is the preferable design for my Gateway?

I'm writing a Gateway class that extracts information from a HTML document. One of the responsibilities of the class is to traverse a table in the document and extract data from its rows. I'm trying ...
1
vote
1answer
178 views

Could there be a use case for C# style auto-properties in Python

I've been doing a lot of work in C# recently (my primary language is Python) and I love that I can do something like public string MyProperty{ get; set; } Going back to Python I miss that sort of ...
1
vote
3answers
67 views

How to reuse domain model logic in services?

I am trying to avoid anemic domain models as it's said to be an anti-pattern. But doing so leaves my services to duplicate some of the logic. class User { public $status; public function ...
2
votes
1answer
82 views

Define an object with the interface as a type instead of class name [duplicate]

I try to practice with the design patterns and explore one of the possible implementations of the Observer Design Pattern in Java. I paid attention, that in this example the object is defined with the ...
1
vote
1answer
46 views

Where to put the domain in MVCS

From what I've read and understand MVCS (Model-View-Controller-Store) is a design pattern that lets you do the following: View - Application view, what the user will see. Controllers - Manages the ...