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.
1,595 questions
35
votes
2
answers
13k
views
Code development process for Voyager mission?
Voyager 1 reached interstellar space in August 2012 and is the most distant human-made object in existence. Launched just shortly after its twin spacecraft, Voyager 2, in 1977, Voyager 1 explored the ...
94
votes
7
answers
18k
views
Short circuit evaluation, is it bad practice?
In most languages it is possible to give priority to operators in an if statement based on order. I use this as a way to prevent null reference exceptions, e.g.:
if (smartphone != null && ...
1
vote
1
answer
238
views
Internal data representation in firmware
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.
...
-1
votes
6
answers
1k
views
Proving program correctness under all possible cases
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 ...
13
votes
7
answers
3k
views
How to code properly when you're used to relying on ChatGPT for solutions?
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, ...
57
votes
4
answers
75k
views
Which is a better practice - helper methods as instance or static?
This question is subjective but I was just curious how most programmers approach this. The sample below is in pseudo-C# but this should apply to Java, C++, and other OOP languages as well.
Anyway, ...
3
votes
11
answers
2k
views
OO Software Architecture - base class that everything inherits from. Bad/good idea?
I am reviewing a proposed OO software architecture that looks like this:
Base
Foo
Something
Bar
SomethingElse
Where Base is a static class.
My immediate thought was that every object in any class ...
25
votes
2
answers
18k
views
Exceptions in DDD
I'm learning DDD and I'm thinking about throwing exceptions in certain situations. I understand that an object can not enter to a bad state so here the exceptions are fine, but in many examples ...
13
votes
4
answers
11k
views
Should I avoid using spaces in my filenames?
I sometimes find experienced programmers who will actively avoid using spaces in their filenames, opting to use underscores or camelCase instead.
(i.e. /org map/attach jobs.cpp vs /org_map/...
0
votes
4
answers
282
views
Use-cases for Expression<TDelegate> except translating to another language?
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 ...
69
votes
17
answers
24k
views
How to write correct loops?
Most of time while writing loops I usually write wrong boundary conditions(eg: wrong outcome) or my assumptions about loop terminations are wrong(eg: infinitely running loop). Although I got my ...
4
votes
3
answers
1k
views
Turning structural code into object oriented code
This is a bit experimentation from my part because I had written a lot of procedural code back in my school days hence I have trouble in thinking in OOP way i.e. to find proper classes and ...
1
vote
3
answers
3k
views
What is difference between assigning to auto-Implemented properties VS their backing fields within the class
Before I started using auto-implemented properties, I was taught that when assigning properties in the constructor (because of the potential of making a property read only), I should assign directly ...
-2
votes
1
answer
216
views
Best Practices for Managing Multiple Entity Types in ASP.NET Core
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 ...
-1
votes
1
answer
187
views
Testability when API contract is fixed
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 ...