A design pattern is a general reusable solution to a commonly occurring problem in software design.
0
votes
1answer
83 views
Should I follow patterns strictly?
I have a service which is an API client.
It's goal is to instantiate a concrete client you tell it (different providers), implement it's methods (createRequest and doRequest) and forward their call ...
0
votes
0answers
75 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 ...
-1
votes
1answer
98 views
One row database table or JSON file
If I have data that I will only need to update very rarely (once a month), would it be a good idea to use a JSON file instead of a database table with only 1 row?
37
votes
2answers
4k views
What are the improvements of MVP over MVC?
I have read for three days about the Model-View-Controller (MVC) and Model-View-Presenter (MVP) patterns. And there is one question that bothers me very much. Why did software designers invent MVP, ...
-1
votes
0answers
143 views
How to keep coupling of this software component to a minimum? [on hold]
Language is C++, but it's kind of a general question. There is a software component that:
provides 2 interfaces to components on the same and on higher layer (user control)
uses 4 interfaces of ...
0
votes
1answer
68 views
Which pattern should I use for factory + wrapper
I have to program a generic client that uses diverse concrete clients (diverse APIs), all sharing the same interface. I have to log the response of the client.
To accomplish this (logging in ...
4
votes
1answer
122 views
How to wait for the execution of method and then exit?
I have a console application (dotnet core, ubuntu), that looks like following:
void Main()
{
try
{
var job = new Job();
job.Start();
while(Console.ReadLine() != "quit"...
1
vote
1answer
63 views
Should I use dependency inversion in this case?
I have a Document class and a DocumentItem class. A document creates multiple DocumentItems.
As my project has evolved, I realized that DocumentItem needed some "deep" logic to properly display, ...
-1
votes
1answer
60 views
When to use structured record/object, when to use list of strings?
I've written some apps using simple imperative way - now I want to learn more about building software the object oriented way.
My goal is to take an Excel file and load one of the tables into memory. ...
1
vote
0answers
45 views
Pattern for endpoint that routes requests?
I am building a service that will push notifications to many other services. It has a couple of different notification types that each consumer may care about, but likely will not care about all of ...
0
votes
2answers
181 views
Is singleton the right way to go in the case of a game?
I've been reading the top posts of stackoverflow and SE and all over the place it says how bad singletons are but I am unsure how to rewrite my code.
As of now I have two projects that bind into a ...
0
votes
0answers
16 views
Page pattern in Angular 2 Testing documentation
I'm familiar with the Page Object Pattern from doing Selenium tests. It seems to me like the Angular 2 team has borrowed this concept in their testing documentation.
But I feel like this is not ...
4
votes
1answer
39 views
Update model chain on event driven pattern
What is the formal name for this specific problem scenario in an event-driven architecture, and what are the common approaches to handle it?:
After an action or event is dispatched, several ...
7
votes
1answer
131 views
What is the procedure that is followed when writing a lexer based upon a grammar?
While reading through an answer to the question Clarification about Grammars , Lexers and Parsers, the answer stated that:
[...] a BNF grammar contains all the rules you need for lexical analysis ...
9
votes
2answers
231 views
Application service layer calling database functions. Bad architecture?
Scenario:
Stack: Java, Spring, Hibernate.
Model: Client-Server Application.
Pattern: Model-View-Controller (MVC).
The Service Layer classes has three behaviors:
Some services have the business ...
0
votes
0answers
107 views
What is this pattern? Data processing pipeline with SQS + Traffic Controller, similar to AWS SWF
I'm planning out a system for a data-processing pipeline, which:
ingests various data sets from 3rd party sources
standardizes the data into a common format
transforms the data in a variety of ways, ...
0
votes
0answers
28 views
Keep data up to date via api
I have a program that needs to get a part of its data from an api of another program, and the data needs to update every 5 seconds.
For example:
I have a program that presents homework for each ...
16
votes
4answers
579 views
What does it mean when one says “Encapsulate what varies”?
One of the OOP principles I came across is: -Encapsulate what varies.
I understand what the literal meaning of the phrase is i.e. hide what varies. However, I don't know how exactly would it ...
4
votes
3answers
115 views
Is there a common pattern for handling missing data found deep in an application?
I have a manufacturing management application that I'm in the middle of redesigning to make it more universal (we acquired a small company and they will use the tool as well). Where before I had many ...
19
votes
4answers
3k views
Why would a development team insist that using a single solution for multiple projects in Visual Studio “increases interdependence complexity”?
I'm helping to manage an external team who are starting to develop new versions of some existing products. Historically, this team has always used a model of a single project in a single solution for ...
2
votes
2answers
95 views
Is using REST consumed by a Javascript framework on the front-end the same as using microservices?
I have a monolithic application. It is MVC, PHP, all on one server. It does get copied to another server or replicated. There are also older web pages that connect to databases that aren't related ...
3
votes
2answers
98 views
Nested transaction management .NET
I have an asp.net core project that is divided into the following structure
Controller
Store
Repository
The controller receives requests, and calls the correct Stores that are responsible for ...
1
vote
1answer
76 views
What are Repositories, Services, and Actions/Controllers?
I started a project using Slim3 and PHP using limited knowledge of application architecture. The plan was to create the project and separate application concerns. It was all going well, but things got ...
1
vote
2answers
117 views
OO design of Ad application
I am making an oo design for an app. So far, I came with this, I looks like it could work, but I am not sure of correctness of it's design.
Old design
EDIT
Okay so, I used factory pattern, and it ...
1
vote
0answers
44 views
Access to the leafs of Composite pattern Java
I have some question about the Composite pattern. I have implemented a model like these:
Element is an abstract class, RegexElement is the "primitive", a sub class of Element and RegexBlock, the real ...
4
votes
2answers
83 views
Should I create a (new) project for shared UserControls?
Context: I'm creating some applications to help me on my daily tasks, it does not connect anywhere and the only "data" it has to deal with is the parameters that I enter on the input fields.
This is ...
0
votes
0answers
24 views
WCF Windows Service with plugin pattern, accessing several webservices and a database
I'm redesigning a WCF Windows Service (InstanceContextMode.Single) which was created by an external supplier, while it was super urgent and when there wasn't really much time to design the software. ...
0
votes
2answers
234 views
Is it acceptable to escalate a software error to HTTP 500?
Should an error 500 only be thrown by the web server, or is it acceptable for your program to throw one itself?
try {
some bad code;
}
catch (Exception) {
set_header_code(500);
set_content_type(...
1
vote
0answers
47 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 ...
3
votes
4answers
320 views
How do I describe the Repository pattern?
I'm currently working on the project with the new team and they are using Repository pattern which is new to me. In this repository, they're currently doing
1.If we are offline, we will load data ...
1
vote
1answer
64 views
Is this a Proxy or Decorator pattern implementation?
The way many design patterns are described in the classical literature is somewhat different from their implementation in dynamic languages such as Javascript.
The presence of some features like ...
1
vote
1answer
31 views
KPI Module structure
My plan's to develop a module for easy customer KPI handling across projects.
It should consist of a small SDK to put 2-3 lines of code in the project, a "template"/model for a SQL table (code first ...
4
votes
1answer
107 views
How much of the data preparation, transformation, and processing belongs in Repository layer?
I have a use case where I display variables in a PDF file. But to get there is not simple, but I could do something like this:
/*
* takes product model number, retrieves, processes, formats values
...
-1
votes
1answer
60 views
How to analyse user input and determine if it (kind of) matches an answer
I'm working on a quiz system that will allow users to enter text as an answer. The question could be something simple to start with, looking for a short phrase, or a select few words as the "correct" ...
0
votes
2answers
215 views
When is a polyglot program something worth using/deploying? [closed]
Polyglot Programs strikes me as pretty confusing and error prone. Right away I don't see any use to it besides "showing-off". Wouldn't that be a bad programming pattern, since it's not modular?
Is ...
0
votes
1answer
78 views
How to design the system which executes two process independently with different configuration?
I have two process ProcessA and ProcessB. I want to run these two process independent of each other. There is no relation between them at all.
Each process should have a different Properties object.
...
6
votes
3answers
694 views
Is there a canonical or favourable classification of software design problems?
The question seems to be quite vague, so let me give some background:
I have given the concept of design patterns some thought and stumbled upon the classification used by the Gang of Four:
...
0
votes
1answer
60 views
Pattern to use when only a few functions have a dependency?
I have a class like this:
class X {
X (databaseconn, httpclient) {
this.httpclient = httpclient
this.databaseconn = databaseconn
}
public func1(a, b) {
// ...
}
public func2(x,...
9
votes
2answers
516 views
What Makes the Iterator a Design Pattern?
I have been wondering what it is that makes the Iterator special when compared to other similar constructs, and that made the Gang of Four list it as a design pattern.
The Iterator is based on ...
0
votes
4answers
142 views
How to implement Progressive Disclosure in C++ API
Following the article Programmers Are People Too by Ken Arnold, I have been trying to implement the progressive disclosure pattern for an API.
Basically, the idea mentioned in the text is to break ...
8
votes
1answer
140 views
Module Requiring vs Dependency Injection in Javascript
These days a question popped out in my mind:
Does the way we Javascript go against almost everything that is considered a good practice in traditional Software Development?
I have a series of ...
1
vote
0answers
40 views
Media Player with MVC pattern
Good morning.
I'm developing a media player software with MVC pattern. My question is about the reproduction of media elements.
I think we need 3 software classes in order to do the design. These ...
6
votes
1answer
180 views
Idiomatic way of writing a GUI system in Go?
I'm writing a little GUI system for my game in Go. So far my structure is kind of like this:
type Component interface {
Update()
Render(ctx)
Translate()
GetComponent() []Component
...
4
votes
1answer
83 views
I have a class for creating objects from a database row. How to design a class to perform functions on all rows e.g. counts on db table
Say I have a database for storing cars data. Each row is essentially a car and I've a class that takes a row of the data and builds my car object.
I now want to build a dashboard that can tell me all ...
1
vote
2answers
110 views
How to complete a task in two seperate 'else' statements while maintaining DRY [duplicate]
What is the best way to implement the following code without having the same code duplicated in two different blocks, but while maintaining efficiency and readability?
if (expression1):
if (...
1
vote
1answer
81 views
Complicated Authorization Based on dynamic criteria
I am sorry for not posting any code. I am stuck at the design phase -that's why-
What I want to accomplish is: allowing system administrators of a 'Staff Task System' to dynamically set rights to a ...
1
vote
1answer
117 views
Storing Local Filesystem Paths in Database
I'm developing a webapp where I have sets of data stored locally on my computer and I run a tool which transforms the data and uploads it to my webapp. However, I need to be able to rerun the tool on ...
2
votes
2answers
88 views
Which pattern should I use for building up a character?
I have an application that lets users create their own character from clothing like hat, pants and facial features, like beard and eyes. I'm using a canvas to display the built up character. The order ...
3
votes
1answer
64 views
Implementing unit-of-work for multiple storage types
I'm trying to implement the unit-of-work pattern for mutliple storage types like the windows registry, a database or the app.config but I cannot figure out how to do it. All examples I find use Entity ...
2
votes
1answer
69 views
Implementing A Set of Rules
I have been tasked at work with implementing what I can only refer to as a rule interpreter. Part of my job is to identify production errors as they occur with shipment codes, and we are looking to ...