Questions tagged [design-patterns]
A design pattern is a general reusable solution to a commonly occurring problem in software design.
299
questions with no upvoted or accepted answers
10
votes
3
answers
2k
views
Balance between aggregate boundaries and domain consistency in DDD
Designing an Aggregate and choosing an Aggregate Root getting tricky for me all the time especially when it comes to ensuring right transactional contexts and consistency constraints so I'm wondering ...
6
votes
1
answer
409
views
How to set up a sql database to cater for user records, group records and default records?
Outline
I have an application that loads data from a database. I'm not talking about client data here though, I'm talking about application configuration. The database will therefore come with some ...
5
votes
3
answers
735
views
Designing a flexible search API response
Quick Summary
I'm building a search micro-service that will allow searching across different types of resources in a particular system (e.g. blog posts, users etc.). The API that will be exposed will ...
5
votes
3
answers
1k
views
Handling common code among presenters
I'm facing some issues related to code duplication when following MVP architectural pattern in an Android project that I'm working with.
My project structure is separated by packages: data, domain, ...
5
votes
0
answers
7k
views
Assembler vs Entity Translator and Entities vs DTO
I was hoping that someone could explain the exact difference between an Assembler and Entity Translator.
Martin Fowler describes the Assembler as a sort of Mapper(?) which converts DTOs into Domain ...
4
votes
6
answers
411
views
Best practice to architect a system in which local users may override global definitions
Our travel industry client, operating across three continents and several countries, wants to standardize the process of choosing travel packages, air routes, hotels, and hundreds of other travel ...
4
votes
0
answers
284
views
Global variables and common block management in Fortran
Background
The high level overview of my situation is described here. I am breaking it apart into smaller, specific questions, such as this one, regarding extensive use of global variables in a ...
4
votes
0
answers
434
views
Best design pattern/approach for a Factory which needs multiple types of input
I want to develop a Factory of INotifications.
public interface INotification
{
string Text { get; }
string UserId { get; }
NotificationType NotificationType { get; }
}
The problem is, ...
4
votes
0
answers
472
views
Separate 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 ...
4
votes
0
answers
139
views
Environment that enables variable constraint checking and creation
Currently, I'm working on a system that enables users to add Tag's to available TagTypes on specific pages. For instance, we would have a TagType called "Installer" and the user wants his name ...
3
votes
0
answers
392
views
Is MVVM appropriate for a .NET MAUI Blazor hybrid app?
I am preparing to create my first .NET MAUI Blazor hybrid app. It is a relatively new technology so there aren't a ton of resources to look at, but of the ones I have found, they are all structured ...
3
votes
0
answers
184
views
API Gateway Design Pattern - Backends for Frontends
I am contemplating the use of the design pattern API Gateway, specifically the Backends for Frontends derivative.
We have a number of 3rd party software packages that expose an API. Over the course of ...
3
votes
2
answers
231
views
Visitor pattern applicable ? - Applying rules to a list of registrations
I have a list of Registration's, on which I need to apply a set of rules to each individually.
Rules can be a single Rule, or a sequence of rules, representable by a tree. One rule is a ...
3
votes
0
answers
140
views
Designing a filtering function
This question is not so much about how to implement a solution as I've already implemented a working solution, but more about how to improve how I implemented it. The implementation process of the ...
3
votes
0
answers
281
views
Efficient BACnet device polling strategy
Example BACnet network:
Some help is needed to solve a problem around architecting an efficient method of polling BACnet devices across multiple networks (i.e. MS/TP networks) where client software ...
3
votes
3
answers
1k
views
Is Enum Polymorphism bad for DAO Methods?
I have been going back and forth in a discussion about polymorphic enums to call different DAO methods depending on enum entry, and I haven't been able to get a common agreement on this subject.
Lets ...
3
votes
0
answers
221
views
How should domain model entities expose information about the current state of their properties?
I'm new to DDD, so please bear with me.
I am trying to design a domain model around an extremely large and complex existing system, where most of the current "domain" logic is either in the UI or in ...
3
votes
1
answer
317
views
Data processing pipeline design for processing data
I have a use case for which I need to build a data processing pipeline
Customer contact leads data coming from different data sources like csv, data base, api has to be first mapped to a universal ...
3
votes
0
answers
112
views
Python3: How to change the design of a class hierarchy to improve access to objects there buried?
I asked this question already at stackoverflow together with a serialization related part and at codereview for the design part only. Since the design related part receives no answers or comments on ...
3
votes
0
answers
69
views
How does "redux" decouple the different components so they can be tested separately in unit tests?
In the past we saw a big move from traditional MVC to MVVM for user interfaces:
One of the primary motivations for MVVM is that the view and viemmodel are competely indepedently of each other and ...
3
votes
0
answers
78
views
Memento and releasing resources
Let's suppose we have a class whose state has to be saved and later restored, and we resorted to the Memento pattern for that.
What if the state includes resources that have to be explicitly ...
3
votes
0
answers
57
views
Parse track meet output file result
I am building out a parser for a well-known track & field meet management software output file (sample output).
I can parse this manually, and put items into my object model (overview below), but ...
3
votes
0
answers
463
views
How to separate data layer from business layer?
My current .NET project looks like below:
Solution (.sln)
--BusinessProject A (.proj)
--BusinessProject B (.proj)
--DataLayer (.proj)
--A separate project calling ExternalService 1 (folder)
--A ...
3
votes
0
answers
874
views
Fetch data in parent vs fetching data in child
I know that I want to develop a React App like so:
<PhotoPage>
<FeedFilter/>
<PhotoFeed/>
</PhotoPage>
Without using Redux, I know that I need to fetch a dataset of ...
3
votes
0
answers
93
views
Nested containers with subclasses
I have nested containers A and B. The attributes are there to show that classes have some other members. One of my functions f takes another container of such containers (let's say vector again).
...
3
votes
0
answers
2k
views
Dependency Injection and class Inheritance
The project I am working on for about a year now was used to create a new mysqli connection to the database each time there was a Query to the database. In order to quickfix this problem at places ...
3
votes
0
answers
725
views
Two-way adapters
In GoF there is a two way adapter concept:
A potential problem with adapters is that they aren't transparent to
all clients. An adapted object no longer conforms to the Adaptee
interface, so ...
3
votes
0
answers
356
views
Anemic Domain Model Developer thinking about a rich domain model
Martin Fowler talks about the Domain Model where the Business Logic Layer contains classes that contain state and behaviour. As far as I am concerned this means:
1) Controller calls a class in the ...
3
votes
0
answers
551
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 ...
3
votes
0
answers
2k
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 ...
3
votes
0
answers
721
views
Building a generalized notification system: passive vs. active
Recently, I've tried my hand at building a notification system, but I quickly found that notifications are tricky things, especially in the context of building a general model. The diversity of what ...
3
votes
0
answers
80
views
Should my application call statsd directly or should I call statsd based off logs?
I'm planning on incrementing counters in statsd based of various events within my application. I have logging in place for these events. So, from my viewpoint I have two options:
Update the ...
3
votes
0
answers
675
views
Hierarchical ViewModels and tracking IsDirty/PropertyChanged events
I have a set of ViewModels depicted like in the below picture.
And, I have a couple of commands AcceptCommand, CancelCommand in the Top Level View Model that are bound to Apply, Cancel buttons ...
3
votes
0
answers
1k
views
ZeroMQ and Majordomo protocol
I am learning ZeroMQ and came across the Majordomo Protocol. I am wondering if I'm understanding this correctly, is the use case the same as.. for example.. the Microsoft Azure AppFabric service? ...
3
votes
0
answers
547
views
How can I put multiple hierarchical forms in a single web page and avoid making it a mess?
We are a group of developers working on a web application that accepts forms filled and sent by our users and present it in an overall view. Our main form view looks like this:
There are multiple ...
3
votes
0
answers
92
views
Pattern for data types that are related yet fundamentally different in utility
Background
I'm currently working on a codebase for what is to become a forthcoming website's content "engine", where it will take in different types of standardized data (implemented with XML), parse ...
3
votes
0
answers
45
views
PaypalCheckout object is composed of PaypalQuery objects. Hide PaypalQuery objects to users of PaypalCheckout?
I have a PaypalCheckout object that handles the checkout process: from initiating API calls, to providing an interface for front-end code (e.g. View/Controller).
The PaypalCheckout object handles: ...
3
votes
0
answers
279
views
Looking for design pattern to represent shared state in music sequencer
I like to give lots of context, but also to state the basic question up top as concisely as possible. Feel free to read a little or a lot.
I'm working on a music sequencer, and have been happy so far ...
3
votes
1
answer
149
views
How to model workflows
I'm building a helpdesk-type system, where there are:
Customer - can submit/resubmit tickets;
Manager - can review submitted tickets, assign to developers (one ticket to multiple developers), review ...
3
votes
1
answer
193
views
Message Mapper Design Considerations
Long question context, skip to tl;dr for the meat of it.
I am designing an integration between two web applications, and have come to the conclusion that a message pattern would be an appropriate ...
2
votes
1
answer
82
views
Converting the classes with multiple dimension to Bridge design pattern
Bridge design pattern is something which is very confusing and GOF does not do justice with beginners in the definition.
I was asked in my current organisation to add one more dimension to our class ...
2
votes
2
answers
240
views
Data getter inside Model or ViewModel in MVVM
I'm working on an app I created for myself using the MVVM architecture. On my ViewModel I have a list_items that, when changed, updates the corresponding UI element on the View. The list of items ...
2
votes
0
answers
72
views
Best approach for several steps with user input in between
I've read several questions and I couldn't find one specifically similar to mine. I also don't think there's a design pattern for this situation as I think my system is a legacy system and don't fit ...
2
votes
0
answers
104
views
Is there an elegant way to handle run-time dependent object composition without using dynamic_cast?
Context
I'm attempting to design a modelling framework that is modular and easy to extend and test. (I'm trying to follow open/closed, dependency injection, and composition over inheritence principles)...
2
votes
2
answers
414
views
Exposing methods for polymorphic children from the aggregate root
Consider the following fictitious toy example:
There is an aggregate root DayChecklist that holds a list of Tasks planned for the day:
class DayChecklist {
String id;
DateTime today;
...
...
2
votes
0
answers
374
views
How to handle a bunch of nested ValueObjects?
I'm writing a PHP web application (or actually a Symfony module). One part of it is a nested structure of ValueObjects (meaning: they are immutable and have to be validated on the creating). Such an ...
2
votes
0
answers
2k
views
Is gRPC a good choice for my scenario?
Im starting to develop a visually-simple but infrastructural-ly robust real time multiplayer game to show off my backend skills and hopefully get a job at Blizzard or something like that.
The game is ...
2
votes
0
answers
134
views
Design Pattern to unify similar generated classes
I have a project where I work with generated classes for some web interfaces. Some of these classes are (almost) identical and most of the functionality I need them for only use the identical parts. ...
2
votes
0
answers
441
views
Third-party API wrapper in Java: how to design
Suppose, there's a site that provides an API, such as this:
Users post questions, answers on that site
You can make GET and
POST calls
There are two types of authentication: weak (only gives
read ...
2
votes
0
answers
62
views
How to join two sets of 6 tables and select the list into another set of 6 tables
A1
|__A2
|__A3
|__A4
|__A5
B1
|__B2
|__B3
|__B4
|__B5
C1
|__C2
|__C3
|__C4
|__C5
Given a list of A and a list of B, we want to "join" ...