Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [design-patterns]

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

5
votes
0answers
3k views

Option<T> functional type implementation and scenarios

Have you ever being implementing Option<T> functional type? It is discussed here: https://app.pluralsight.com/library/courses/tactical-design-patterns-dot-net-control-flow/table-of-contents ...
4
votes
0answers
129 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
0answers
3k views

Unit Of Work with multiple database context

I have created an application (net core 2 & ef core) with Unit Of Work and Generic repository pattern. I used to have one database context but due to some business logic I had to create a second ...
3
votes
0answers
318 views

Is it good to pass variables through methods?

I am working on a team where my mates introduced the service & repository pattern. We work on Lumen micro framework. So from the controller, the call is passed to the service and then to the ...
3
votes
0answers
5k 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 ...
3
votes
0answers
440 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 ...
2
votes
0answers
65 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 ...
2
votes
0answers
89 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 ...
2
votes
0answers
79 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 ...
2
votes
0answers
63 views

Coupling form fields to functionality: using a Command Bus?

I built an app where the app owner can build custom forms for each of his clients. The forms have default fields like "name" and "message" as well as custom fields for each client requirement, like "...
2
votes
0answers
51 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 ...
2
votes
0answers
66 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 ...
2
votes
0answers
64 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, ...
2
votes
0answers
2k views

How to improve a pattern 'enum class with methods'

Over many years, I always find myself reconsidering this design, so I wanted to get some feedback on my solution to it. Problem: I need a limited amount of objects = instances from a class, and I ...
2
votes
0answers
41 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 ...
2
votes
0answers
391 views

How to dispatch these functions in Objective C to not lock Main thread?

There's a large shared object (kind of OpenGL context) in my project. It is accessed from multiple threads. To ensure only one thread at the moments is using SHARED_OBJECT, mutex (kind of ...
2
votes
0answers
97 views

Access modifiers in combination of interpreter pattern with template method pattern

Motivation: (Skip to "The Problem" if you don't need motivation for it) As a project for myself, I'm writing an expression parser for certain kinds of mathematical expressions, and I'm using the ...
2
votes
0answers
84 views

Idea on replacing DAO/Domain obj pattern

I know someone has probably already thought of this, but here is a way to replace DAOs and Domain objects: For example public class Bike { private int id; public Bike(String model) { //...
2
votes
0answers
77 views

Is there a name for this Registry-Slot-Updaters pattern?

I noticed a pattern in my code. It applies to situations where things can be selected. It revolves around classes which I call (and in code often suffix with) Registry, Slot and Updater. Registry ...
2
votes
0answers
377 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 ...
2
votes
0answers
294 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 ...
2
votes
0answers
342 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 ...
2
votes
0answers
79 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). ...
2
votes
0answers
301 views

Perfect video processing pipeline?

I'm working on a modular video processing pipeline. It's currently presented as a tree of modules. Each module has a set of "results" and can dynamically request data results from other modules. Each ...
2
votes
0answers
162 views

Proper pattern to use when sharing large amounts of code and a similar control flow?

So I'm currently building an application that allows a user to fill out paperwork digitally, and then that information is taken in by the server and a PDF is populated and returned to the user. The ...
2
votes
0answers
162 views

Design Pattern for Internal Builder

There is an object which is very complicated to build and many algorithms needed to figure out how it should be created (for your curiosity it is an object that represents and draws the beaming of ...
2
votes
0answers
1k 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 ...
2
votes
0answers
465 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 ...
2
votes
0answers
269 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 ...
2
votes
0answers
369 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
0answers
1k 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 ...
2
votes
0answers
523 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 ...
2
votes
0answers
65 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 ...
2
votes
0answers
545 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 ...
2
votes
0answers
244 views

Callback pattern handling exceptions - Best practices in .NET 3.5

I am looking to implement the callback pattern with error handling such that error is caught and pass to the callback code with the response. Since I am using .NET 3.5, I cant use Task (TAP) pattern ...
2
votes
0answers
811 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? ...
2
votes
0answers
482 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 ...
2
votes
0answers
83 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 ...
2
votes
0answers
137 views

Processing a list of atomic operations, allowing for interruptions

I'm looking for a design pattern that addresses the following situation: There exists a list of tasks that must be processed. Tasks may be added at any time. Each task is wholly independent from all ...
2
votes
0answers
617 views

NCurses, scrolling of multiline items, “current item” pointer and “selected items”

I am looking for hints/ideas for the best (most effective) way on how to scroll multi-line items as well as emphasizing of the "current item" and "selected items" such as: 1 FOO ITEM 1 Foo sub-item ...
2
votes
0answers
34 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: ...
2
votes
0answers
204 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 ...
2
votes
0answers
148 views

Run a function when a function in a list is executed?

Goal: I'm currently doing an MVC project and I have this method to update the ViewBag (based on previous actions of the user). I would like to call this function whenever a certain list of MVC Actions ...
2
votes
0answers
252 views

What are the best ways to organize view hierarchies in GUI interfaces?

I'm currently trying to figure out the best techniques for organizing GUI view hierarchies, that is dividing a window into several panels which are in turn divided into other components. I've given a ...
2
votes
0answers
563 views

How should Object Model wrapper classes behave when underlying objects are deleted?

I'm currently building an object model library for use in a project. It wraps our internal concepts - Servers, Folders, Items - in an object hierarchy (IFolder, IItem, etc), and we have several ...
2
votes
0answers
206 views

Pattern or solution for using classes with different interface the same way

What I would like to achieve is to use classes (now two, later more) with different interface the same way, so I would like avoid using decisions based on the interface on upper levels for instance, I ...
1
vote
0answers
106 views

How to store relational data belonging to different client customers?

My users will be businesses with a small number of accounts each: e.g. Business #1 with 3 users, Business #2 with 5 users, etc. I am trying to determine the best way to organise the relation (on ...
1
vote
0answers
61 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. ...
1
vote
0answers
61 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 ...
1
vote
0answers
47 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" ...