Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
0answers
14 views

Nested vs. Non-nested Types in GraphQL (or recursively-nested types)

I am starting to dive into GraphQL, and one thing I haven't been able to find a solid answer on is how and if one should use nested types or not, or even effective design patterns when using GraphQL. ...
0
votes
2answers
81 views

Calling a method with different parameters and iterate

I have a method that inserts into the Android Calendar an event. You can see a simplified snippet in two steps: 1)declare the variables 2) I put them into a kind of array that in the end will insert ...
0
votes
1answer
19 views

Is it good practice to use data API for access cross platform

All, Question: Should I have a common data access API between various cross platform applications or keep the data access specific to the UI even though it would result in duplication? Background: ...
1
vote
2answers
55 views

Practices for encapsulating collections in aggregate roots

How exactly should AddSomething methods in aggregate roots look like? Should I construct the objects in a call to the method, or should they be constructed inside the method?: For example: public ...
1
vote
3answers
240 views

Is an OS kernel a singleton?

In my understanding, a singleton design pattern is where we have only one instance of an object in a system. I am not sure on this part of the definition, but I believe in an OS there is only one ...
-4
votes
0answers
37 views

Need help to migrate system design [on hold]

I have to migrate the current system into the latest best software architecture. Actually in my organization having 100+ CORN-Jobs (Windows Tasks (.exe)) to do backend process. The problem is here is ...
-1
votes
1answer
28 views

Which scenario is the best for service worker architecture?

We know about using service workers in modern web sites. Consider a scenario back-end as node.js and SQL Server. Data is loaded from central database to local customer web app (DB is about 700 MB) ...
3
votes
1answer
50 views

View-model architecture

I have two screens: A screen with a list of items, where every item in the list has "Show Details" and "Update buttons" An item details screen. The "Show Details" button navigates to item details ...
4
votes
2answers
298 views

Why do I need a game loop with states, instead of init the next state in current state directly?

For example, it is common to see games with game loop and states: stateChanged(){ switch(state){ STATE.PLAYER_SELECT_CHARACTER: this.currentController=new PlayerSelectCharacterController()...
3
votes
4answers
566 views

C# has no friend class - what are better options

I return to this question every couple of years, so now i decided to solve it once and for all, by asking here. So, the sequence: I'm writing a simple application that parses Json file (...
2
votes
1answer
68 views

How do I refactor a graph service to where I can encapsulate if/then/else statements?

I have a graph service where I use if/then/else statements. class GraphService { function getGraphData(array $products) { foreach ($products as $products) { $...
2
votes
2answers
116 views

Which design pattern for combination of objects in Java?

I am looking for the best approach to design the following system : I have a class of object, called Compilers (C, Go..Etc) I have another class of object, called Protocols (HTTP, RPC, WEBSOCKET..Etc)...
0
votes
2answers
71 views

Passing a context object to the constructor or to the method

I am writing a recursive descent parser. Let ParseContext specifies the context for parsing. Pseudocode: class ParseContext { Logger logger; // logger for error/warning messages Locale ...
1
vote
1answer
65 views

How should the service layer be done?

so I have this android app at work, if I understand it right the DAO/services/UI layers is to "decouple" the UI from the database. I have 2 problems with that : 1/ Decoupling Like this if things ...
1
vote
1answer
46 views

Fail over for application that does outgoing requests

We built an application that has a list of fixed intranet URLs and crawls these periodically, transforms the data, stores it in a database. We have the requirement that the application has some kind ...
2
votes
1answer
101 views

Traversing over two similar object structures using a pattern

Let's say I have an Object Structure like this that I import data into from a source: Reporting: Body: ReportingEntity: DocSpec Reports[]: ConstEntities[] DocSpec ...
1
vote
0answers
59 views

Is there a pattern/cleaner way of saving a large object with multiple nested classes?

I'm in the midst of a rather large project which involves decomposing a very old and large ColdFusion legacy application and creating some .NET services in it's place. Due to this, there are some ...
0
votes
2answers
40 views

Passing storage location to factory function vs storing it yourself

I have run across a bunch of code where they are essentially doing void CreateFoo(string foo_param_1, int foo_param_2, vector<Foo> *foo_storage) { Foo new_foo = FooFactory(); new_foo....
1
vote
0answers
72 views

MVC - How should components inside controller communicate?

I'm developing a level editor in Java. I'm designing its code in MVC. From what I've learned: controllers can have a direct reference (fields) to views and models. Views can have direct reference to ...
0
votes
1answer
61 views

Method for loading and running user defined code in .NET windows application

Are there any patterns that address how to have and application load and run user defined code at run-time? I am looking into developing a C# library that the users of a Test Executive application (...
0
votes
0answers
16 views

How microservices and EIP relates

I've been working some time in microservices architectures and have created multiple micro services using Spring Boot framework, let's say UserService, AccountService, BillingService, ...
0
votes
3answers
76 views

Start and exit actions in while loops

Sometimes I find it useful to have loops that do an action at the beginning and/or the end of a while loop. The best way I can think of for representing this in C++ would be: if(condition) { // ...
0
votes
1answer
48 views

Builder pattern in multiple stages

I like using the Builder/Director pattern to build complex objects. It works really well. The only restrictions (maybe it is not really a restrictions) I see is that all of the parameters for the ...
0
votes
1answer
68 views

MVP (Model-View-Presenter) Drawing Application

I'm trying to make a simple drawing application with the MVP pattern. Let's consider I want to be able to draw a circle and drag (move) the circle around on a JPanel. After the drag, the model should ...
2
votes
1answer
119 views

Is it a good idea to use Singleton pattern for an API manager?

So basically I am writing a wrapper for a REST API in objective-c so that our customer can easily use them in their iOS development. I am trying to find a good design pattern for this purpose, it ...
-1
votes
3answers
176 views

Should a simple factory method include the “new” operation?

For example, suppose I have a class to create a button with specific styles common to my app, I can have either Return a new modified object: public class ButtonFactory { public static Button ...
1
vote
1answer
59 views

MVC: How to use data model list in recursive views

I am trying to learn web app MVC in PHP.Most of the articles discussed about 1-to-1 MVC pattern given bellow Controller: gets user request & update model, Model: receives orders form Controller &...
3
votes
2answers
75 views

Is there any design pattern available for pushing data from devices to cloud?

Hopefully I am posting a question in right forum. As per https://meta.stackexchange.com/questions/68384/whats-the-difference-between-stack-overflow-and-software-engineering-se-previo `software ...
1
vote
0answers
42 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 ...
1
vote
3answers
273 views

Easy to maintain ways that helps code readability in C#?

Say we start with a base class that states if an object is valid or not (included one interface and two child classes for discussion purpose), like: interface IValid { bool IsValid(); } public ...
-1
votes
0answers
68 views

Looking for a Design pattern [duplicate]

I am looking for a fitting design pattern. What I have is a sequence of processes that all use results of one or more of the previous processes. Something like this in pseudocode: List<B> = ...
14
votes
5answers
658 views

Is the use of ***Helper or *** Util classes containing just static methods an AntiPattern

I am often confrontated with helper or util classes in Java or whatever kind of language. So I was asking myself if this is some kind of Anti Pattern and the existence of these kind of classes is ...
2
votes
1answer
64 views

Persisting domain state without exposing underlying provider(s)

Working on a DDD application where I need to persist state. Here's a very simple example: public interface IRoot { public int Id { get; } void UpdateValue(int value); } public interface IState {...
0
votes
1answer
55 views

Adapting third party conversions

I have a couple of pieces of functionality that are similar but not quite the same. They both involve converting a type that I own to other types that are owned by a third party library, so out of my ...
-1
votes
1answer
96 views

API gateway for web-fronted applications, is it worth it?

So am in the process of developing a new application and am welling to adopt a micro-services based architecture (am new to that). The problem is that the application will be exposed to the final ...
3
votes
2answers
208 views

What is abstract about the Abstract Factory?

I've been always wondering why the Abstract Factory Pattern is actually called abstract? I don't understand what is abstract about it? It somehow does not fit in the image of abstract classes that I ...
1
vote
2answers
107 views

Patterns for tracking state in recursive Haskell code

A frequent pattern in my Haskell code is element-wise recursion for transformation of a list with some carried state generated using the data in the list. Usually, this looks something like this: ...
1
vote
1answer
49 views

Cleanly testing multiple Preconditions before throwing an IllegalArgumentException so that all failures are represented

Motivation; I want to report on all the possible problems at once instead of having to peel the onion of every possible problem over and over. It also makes testing much easier because I can ...
-1
votes
0answers
36 views

Should I use Next() convention or Done()

I'm designing a new Node.JS web framework. It's partly based off Express.JS but I have changed core functionality. I'm stuck on a design decision and having analysis paralysis. In express, one would ...
1
vote
1answer
48 views

Ensure encapsulation and Open/Closed principle with Command pattern?

I'm developing a small multiplayer game. It'll be served by one websockets server and consumed by multiple consumers. As such I need to be cautious about concurrency errors. The general software ...
0
votes
0answers
36 views

Polling Postgres DB architecture

We are using Spring Integration DB polling which polls a table every second and executes some logic based on result. My questions are: What are some good practices we can implement to account for DB ...
1
vote
0answers
62 views

How to design the Unity Container?

I have three projects: WebAPI, Services and Repository. WebAPI has a reference to Services and Services has reference to Repository. Now I need to add a Unity Container for Services and ...
2
votes
2answers
157 views

Is it an antipattern to introduce complexity into a builder?

I've looked at various definitions of the builder pattern and whilst there's varying definitions, they tend to be focused on the broad definition of incremental construction. However, it seems that ...
2
votes
5answers
232 views

How to pass command line parameters to various parts of program

Consider a large program with many different parts that have a single command line interface, as is the case with most applications. How best do I handle passing various command line parameters, that ...
3
votes
2answers
64 views

Where do I encode value conversion methods in an MVC web app to display values in different unit systems in the View?

I have a use case where I do internal data computations using English system, due to various precomputed graph coefficients and other data already using the English system. But for output I need to ...
0
votes
0answers
54 views

Does putting javascript in my JSP file make it impossible to test?

The project I'm working on has lots of JSP files, some of which have javascript script blocks scattered throughout and some of these scripts interact with other javascript packages that are served ...
0
votes
3answers
247 views

What is a real-world usage for Prototype pattern in Java?

After having studied GoF Prototype pattern and taken a look into Java implementation using the Object#clone() method I am still confused about when to use this pattern in a real application? Please, ...
0
votes
1answer
45 views

How should “preparation” and “usage” of the same data be separated in a DDD application, if at all?

In most domains, there is an app that "prepares" data, and another app that "serves" the prepared data. The data, however, is from the same Core Domain, which causes some confusion in modeling. Some ...
1
vote
2answers
62 views

Should static and historical data be split in the API? To what extend?

The project is a read-only interface for a company database. In the database, there is some 'static' data about departments, in a Departments table. The value of these fields don't change with time (...
-1
votes
2answers
70 views

How to choose the most suitable solution for a problem given some choices?

To ilustrate my main concern let's start by considering a "trivial" typical problem, data filtering & parsing coming from a process and dumping the information onto something {gui console, file, ...