Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >

Questions tagged [programming-practices]

Programming Practices are the commonly or not so commonly used practices in development of software. These can include things like Agile Development, Kanban, Coding shortcuts, etc.

Filter by
Sorted by
Tagged with
1 vote
1 answer
238 views

I'm developing firmware for control system. That system will collect data from different sensors (using ADC, GPIO, I2C temperature sensors, etc.), process this data and generate some control signals. ...
Leonid P.'s user avatar
13 votes
7 answers
3k views

I’m a programming student, and I have a problem that’s holding me back. In my first year, we coded in Pascal, and back then, AI tools like ChatGPT weren’t as popular. But starting from my second year, ...
AslanPAPA's user avatar
  • 273
0 votes
4 answers
281 views

So I just learned about Expression<TDelegate>. As a library author this really intrigued me; my libraries make extensive use of source generators to generate both high-performance code and code ...
Applekini's user avatar
  • 117
-2 votes
1 answer
215 views

I'm working on an ASP.NET Core application that requires handling multiple types of a single entity. Each type has its own properties and validation rules, which has led to confusion and complexity in ...
Marko Sami's user avatar
-1 votes
1 answer
186 views

Recently, I spoke to an Engineering Manager about some work I've done: I had to implement a micro-service to a third party API contract (that they will call). Part of the requirement is to ...
Ahmed Tawfik's user avatar
0 votes
0 answers
74 views

I'm designing a browser-based application that will display real-time data collected from OPC server. I have decided to use Angular framework for the browser application development. The browser ...
Kamrul A's user avatar
0 votes
3 answers
320 views

I'm wondering if it's bad practice to have a variable in a webserver which counts the amount of incoming requests and put it in an environment variable. In C# for example you have System.Configuration....
Vincent's user avatar
  • 383
0 votes
1 answer
147 views

I'm writing a python package that depends on a relatively old library that breaks in a very specific case: when running a container in read-only mode, a .wh..wh..opq file is added to a directory where ...
Will G's user avatar
  • 11
-2 votes
1 answer
602 views

I sometimes use some language model assistance (e.g., GPT-4o) while coding. I'd like to save somewhere the prompts and language model versions I used. Are there good practices or even conventions to ...
Franck Dernoncourt's user avatar
10 votes
4 answers
5k views

Specifically with CMake builds, if you don't specify a build type explicitly, the build will use neither Debug nor Release compilation flags. I was writing my own Makefile for a simple program and ...
Reverent Lapwing's user avatar
-3 votes
2 answers
812 views

I am wondering if throwing an error in programming is good Idea at all ? While programming we throw error when something unexpected or invalid has occurred. But if we have thrown exception and it is ...
FaisalAhmed's user avatar
1 vote
2 answers
170 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
298 views

Lombok is used in the legacy project where I am currently working for since last year. The project is legacy with 10+ years, and POJO/JavaBeans, i.e. @Data annotated classes, have been widely used for ...
Rui's user avatar
  • 1,935
0 votes
4 answers
229 views

TLDR: I have three subclasses, each inherits from the same parent class, each defines an identical method that does almost the same thing, except that each of these methods has a different return type....
thatUserHOverThere's user avatar
2 votes
2 answers
625 views

Is trunk-based development (TBD) viable for development of software where versioning, compatibility, long term support and service level agreements (SLA) play a big role for business (e.g. libraries, ...
user avatar
-1 votes
1 answer
134 views

I have been asked to get involved with a Team that is currently having delivery issues for various reasons. During my review I came across an acceptance criteria on a user story; If you call v1 of ...
Kinexus's user avatar
  • 303
5 votes
5 answers
1k views

I've set up a ternary operator in place of a pile of if-else's, the final expression being nullptr in order to finish the loop, like so: int menuSelect; std::string operation=""; (...
Hench's user avatar
  • 61
0 votes
5 answers
461 views

Lately, I have been playing with this idiom: Changing a private member variable into a local static variable when: member to singleton class used in only one function member is mutex for a shared ...
Anon's user avatar
  • 3,649
2 votes
2 answers
633 views

Generally print statements are frowned upon in favor to logging. But are there any situations where I should prefer using print statements? In a interactive command line application, if I ask for user ...
Sourav Kannantha B's user avatar
0 votes
1 answer
499 views

I've started working on a C# codebase. There are three services which run the same set of steps of three kinds of objects, each returning IResult: public IResult FooService(Foo foo) { ... } public ...
hyperfiction's user avatar
2 votes
3 answers
290 views

In legacy code bases, some APIs might be encapsulated by different developers with separate classes many times. Example: public void calculate(int baseIncome) { revenueCalculator.calculate(...
Rui's user avatar
  • 1,935
26 votes
8 answers
6k views

What is a good way to indicate in programming that the sequence of digits you see is not a value you can do math on? I use a lot of numbers which aren't "numbers". From account-numbers to ...
Pieter B's user avatar
  • 13.3k
-1 votes
1 answer
177 views

I have 3 classes class Backup end class Database end Class App end The backup database has a reference to Database and App, like class Backup def getDatabase Database.create end def ...
Raja G's user avatar
  • 109
1 vote
3 answers
508 views

If I'm writing Scala functions and have to check for nulls in situations where I can't avoid it (say, working with Spark UDFs and some legacy Java types), is it better to turn things into Option or to ...
wrschneider's user avatar
  • 1,369
3 votes
5 answers
545 views

What are the rules about acronym usage that are related to the business ? I always hesitate between using the acronym or not. When talking with people who work here they will understand faster when I ...
mp9007's user avatar
  • 59
2 votes
3 answers
254 views

Is there a programming principle/guideline that tackles the correctness of a implementation beyond the methods signature contract of an interface? Let's say we have a repository interface with two ...
qUneT's user avatar
  • 53
2 votes
4 answers
3k views

I have a java class with an init method. It's different from the constructor. The constructor just initializes the variables/fields. The init method connects to a database and performs some ...
joker's user avatar
  • 131
1 vote
0 answers
95 views

I have the following piece of code. Line 1 is a container (for simplicity, one can think of it as a list of elements e1, e2, ..., en). Now there is a function function_fun which takes as input an ...
A J's user avatar
  • 19
-1 votes
1 answer
116 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
23 votes
6 answers
6k views

Whenever possible I have been requiring an understanding of the requirements and architecture for the next scope of work before starting to code. Sometimes due to schedule pressure on larger projects ...
Bill Dyer's user avatar
  • 377
1 vote
4 answers
379 views

This has erupted from quite a turbulent meeting between two senior developers, a lead developer and an engineering lead, and after 90mins reached no resolution. We create Spring Boot Java services ...
Crazy Dino's user avatar
-1 votes
1 answer
111 views

I'm working on a project that requires the use of verifiable credentials, and I'm looking to build a wallet that can store and manage these credentials according to the W3C standard. However, I'm ...
ash's user avatar
  • 99
3 votes
3 answers
884 views

This sounds like a newbie's question, but please bear with me. I have 10+ years of commercial software development experience, and I still don't know how to do this properly. I'm working on a pet ...
Violet Giraffe's user avatar
2 votes
3 answers
517 views

I had a debate with a work mate regarding the following code as to which one of it would be the better practice: My code (in pseudo): var A = <precondition either TRUE or FALSE>; var B; if(A) { ...
Chams's user avatar
  • 29
3 votes
0 answers
170 views

Let's say my language's standard library does not include TrickyFunction(). Since implementation seems quite trivial for me, I decide to create utils in the project and add such function, for others ...
JoshThunar's user avatar
-1 votes
6 answers
1k views

There are techniques of proving program correctness under all possible cases, but that is a more advanced topic, for a later subject in your curriculum. I always had this doubt: Is it possible to ...
Dennis's user avatar
  • 25
0 votes
2 answers
99 views

I came across Environment Diagrams,it is described below Whenever Python needs to work with an object, that object is stored in memory; and, additionally, Python also needs a way to associate names ...
Dennis's user avatar
  • 25
0 votes
3 answers
790 views

Let's assume we have a method that we want to run as fast as possible and it needs to loop on a 2D array, naturally we would do a nested for loop as such: int[][] arr = new int[3][3]; for(int ...
Yoh's user avatar
  • 51
-1 votes
1 answer
18k views

So I was sending code for review and approvals for some changes I made recently. that includes a class as below: import lombok.Getter; import lombok.Setter; @Getter @Setter public class ...
Brooklynn99's user avatar
25 votes
13 answers
10k views

At the moment I'm spending more time planning out a commit than actually writing code when adding a new feature. Less than two hours would be lucky, and sometimes I'd spend a good part of the day ...
Tom Huntington's user avatar
1 vote
2 answers
367 views

I've gotten this idea in my head that i shouldn't use a libraries variable, if the variable name begins with '_', as it is standard to write private variables that way. But now i'm thinking i'm taking ...
Jesper's user avatar
  • 143
0 votes
2 answers
2k views

I'm busy working on a website – somewhat new to this – and I don't quite know where I should store static data: in the public folder as a separate json file, or within the .js file as an object. In ...
AlePouroullis's user avatar
1 vote
3 answers
368 views

I am fairly new to programming; I was following a tutorial that was using php 7.3.8. So I went to the documentation website of that same php version, and it says it’s no longer supported. So, I ...
alex schobel's user avatar
4 votes
2 answers
1k views

When trying to follow a functional programming paradigm, I often find myself in a situation where I have a chain of functions that I would want to combine/compose somehow, but they all also take in a ...
Cordello's user avatar
  • 423
-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
0 votes
1 answer
1k views

I am building a new Python library project to be consumed by several of my application projects. The existing code consumes environment variables for various configuration settings. Should my ...
Brian's user avatar
  • 183
2 votes
1 answer
1k views

Recently, I had to implement a business rule in a certain project. The rule basically consisted of checking a range between 1 and 12, values that would be used later, in some way, with Bootstrap. ...
Warlock's user avatar
  • 169
0 votes
2 answers
1k views

I am working on a project that generates an API with the possibility of doing CRUD operations based on a high-level description of the resources that the user would like to have in an application. In ...
jbolt's user avatar
  • 131
-1 votes
2 answers
281 views

Background: I'm coding an app, the core idea is simple - I can choose a 'Task' (consists of name, code to perform aka Runnable, progress) through GUI, start it, stop it, start all 'Task's and stop all ...
Wiktor's user avatar
  • 33
0 votes
1 answer
234 views

I'm in the process of redesigning our entire process control system (a daunting task, really!), and want to make the right decisions to how each system in the ecosystem communicates with each other. ...
Fruity Medley's user avatar

1
2 3 4 5
32