Skip to main content

Questions tagged [patterns-and-practices]

Design patterns (repeatable solutions to commonly occurring problems) and best practices in software engineering

Filter by
Sorted by
Tagged with
3 votes
3 answers
349 views

I'm creating a basic 3D game in C++ with SDL2 and OpenGL3, and one of my learning goals for this project is to design my code around the ability to swap out SDL or OpenGL. However, the problem I'm ...
steamdog's user avatar
2 votes
4 answers
479 views

I recently came across some code: val, ok := i.(SomeInterface) if ok { val.Method() } The above is Go, and attempts to cast to an interface and then runs the method for that interface against the ...
DubDub's user avatar
  • 645
-1 votes
2 answers
147 views

let's say we're building an Ecommerce Marketplace. We have Sellers and each Seller has Products. We want to display a list of available Products across all Sellers to Buyers. But, we only need to ...
Staskij's user avatar
  • 21
1 vote
2 answers
171 views

Lets say I have a project which is something relatively simple like a copy checker for legal text files stored in git, that multiple people contribute to via pull requests that must be reviewed before ...
A G's user avatar
  • 135
0 votes
1 answer
165 views

I have a program which needs some constant data, in JSON-like format. However, this data only needs to be consumed by my Python program, and by making it Python code, I can include types like datetime....
pigrammer's user avatar
  • 111
2 votes
3 answers
196 views

As the title says, Im thinking if it's a good practise to have classes that have Open and Close methods in the sense that they can be reused without a new instance being created again. Also, if I want ...
Nmaster88's user avatar
  • 167
0 votes
0 answers
309 views

I've been interested in following what other successful libraries are doing with their nuget packages. Unfortunately, I can't seem to find any materials to read online and I don't even know what to ...
Lawrence's user avatar
  • 135
-1 votes
1 answer
247 views

When writing a program that uses a working directory, e.g., PostgreSQL data directory or download target for wget, is there an advantage of having a CLI argument (or an environment variable) for such ...
Glutexo's user avatar
  • 147
-1 votes
1 answer
117 views

Suppose that I have a class named CharStream Additionally, there are a large number of functions which convert their function input into a CharStream def funky_the_function(_input): input = ...
Samuel Muldoon's user avatar
1 vote
0 answers
119 views

I am having trouble naming and thus searching for the right keywords for a pattern I am seeing in my web applications and their associated difficulties. Here are some examples of the pattern I mean: ...
Matthijs Steen's user avatar
1 vote
3 answers
231 views

I am creating a simple P2P file sharing system, where one peer can send some Objects (e.g., String, custom objects, etc...) to another peer. The peer, that receives the Object, can then manipulate it, ...
Simone Brigante's user avatar
-1 votes
2 answers
151 views

I code an Object-Oriented simulation where you can have a Unit move on a Terrain. The cost of such move depends both on both Unit capabilities and Terrain features: a boat can move on water, a plane ...
Uriel's user avatar
  • 131
-1 votes
3 answers
965 views

Given the (old) debate over whether Singletons are overused/abused/are worth it - would it be a bad idea to inject the dependencies as default parameters? In this way, we could get rid of defining ...
Veverke's user avatar
  • 541
1 vote
2 answers
3k views

I found the following definition of Repository Pattern: Repositories are classes or components that encapsulate the logic required to access data sources. They centralize common data access ...
DFSFOT's user avatar
  • 119
0 votes
3 answers
147 views

I had a discussion at work about whether to unit test a private static object we're using as data for a public component. const data = { 45: { name: 'John' }, 2: { name: 'Patricia' }, 27: { name: '...
Jose Daniel Vivar Personat's user avatar
0 votes
1 answer
307 views

This question is mainly about readability and understanding of the code. Im am also in the process of creating a SCSS framework like Compass and Bourbon. I struggle to write SCSS because I like to see ...
Pagel's user avatar
  • 11
0 votes
1 answer
751 views

For a paper I am writing, I need to find the origin of the following two phrases: Code against the interface, not the implementation and Test the interface, not the implementation (Note: the ...
Mike Nakis's user avatar
  • 32.8k
2 votes
2 answers
308 views

How does phone number based authentication work, and what are its best practices? I've noticed there are apps with streamlined sign-up/log-in processes where only a phone number is required, simply ...
dev-brent's user avatar
1 vote
1 answer
904 views

As an example, let's say you have the following pseudocode: if test environment: # meaning you don't have the typical service account prod perms sudo as service account + do operation else: # in ...
notacorn's user avatar
  • 109
6 votes
1 answer
1k views

I started working on a project and I saw some methods with this With prefix and I'm wondering if this refers to a known pattern. Does anyone know of this naming pattern?
underthevoid's user avatar
0 votes
3 answers
148 views

Asked this originally here, and didn't receive any answer so far, hence posting here too. Let's say company A acquired company B in a certain region. This means, A and B were competitors in that ...
Munim's user avatar
  • 119
6 votes
4 answers
860 views

I've noticed a certain idea recur in different contexts, but before I start calling it "the sandwich pattern", it would be useful to know (in the spirit of other "Is there a name for ...
ShreevatsaR's user avatar
2 votes
2 answers
161 views

I'm in a dilema where I'm translation a full mobile app where the translations are going to be a key value pair but I'm not sure how to name the key. Should I name the keys describing what the text is,...
Vencovsky's user avatar
  • 371
1 vote
1 answer
186 views

Here's a common question I ask myself: If I have a ThingDoer class and it has a method DoThing(), and I want to log a message stating "Doing a thing", should I put this logging code in the ...
vargonian's user avatar
  • 337
1 vote
1 answer
167 views

I'm learning about writing WebApi design patterns. I am trying to create a simple CRUD web app with ReactJS UI and C# .NET CORE webapi with sql backend. Articles show that specific Repositories are a ...
klau's user avatar
  • 21

1
2 3 4 5
8