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
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, ...
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.
...
308
votes
16
answers
137k
views
Why are shortcuts like x += y considered good practice?
I have no idea what these are actually called, but I see them all the time. The Python implementation is something like:
x += 5 as a shorthand notation for x = x + 5.
But why is this considered good ...
277
votes
14
answers
126k
views
Should we avoid object creation in Java?
I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible.
This seems somewhat to defeat ...
123
votes
12
answers
48k
views
Why are multiple programming languages used in the development of one product or piece of software?
I am a recent grad student aiming to start my Master's in Computer Science. I have come across multiple open source projects that really intrigue me and encourage me to contribute to them (CloudStack, ...
249
votes
16
answers
50k
views
What's wrong with comments that explain complex code?
A lot of people claim that "comments should explain 'why', but not 'how'". Others say that "code should be self-documenting" and comments should be scarce. Robert C. Martin claims that (rephrased to ...
296
votes
16
answers
30k
views
Grokking Java culture - why are things so heavy? What does it optimize for? [closed]
I used to code in Python a lot. Now, for work reasons, I code in Java. The projects I do are rather small, and possibly Python would work better, but there are valid non-engineering reasons to use ...
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 ...
26
votes
8
answers
6k
views
What is a good way to indicate that a number is not something you can count with?
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 ...
25
votes
13
answers
10k
views
How much time should you spend planning a commit before writing code?
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 ...
97
votes
53
answers
10k
views
Harmful temptations in programming
Just curious, what kinds of temptations in programming turned out to be really harmful in your projects?
Like when you really feel the urge to do something and you believe it's going to benefit the ...
138
votes
17
answers
15k
views
How do I know how reusable my methods should be? [closed]
I am minding my own business at home and my wife comes to me and says
Honey.. Can you print all the Day Light Savings around the world for 2018 in the console? I need to check something.
And I am ...
134
votes
14
answers
22k
views
Should the solution be as generic as possible or as specific as possible?
Say I have a entity that has "type" attribute. There could be 20+ possible types.
Now I'm asked to implement something that would allow changing the type from A->B, which is the only use case.
So ...
191
votes
15
answers
40k
views
Why are the sizes of programs so large?
If we look at the vintage program Netscape Navigator or an early version of Microsoft Word, those programs were less than 50 MB in size. Now when I install google chrome it is 200 MB and desktop ...
126
votes
27
answers
10k
views
What are the worst false economies in software development? [closed]
What are the worst false economies (that is ways of saving money that ultimately cost more than they save) prevalent in the software industry and how do you combat them?