Skip to main content

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
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
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
308 votes
16 answers
137k views

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

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 ...
Slamice's user avatar
  • 2,667
123 votes
12 answers
48k views

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, ...
Parth Patel's user avatar
  • 1,029
249 votes
16 answers
50k views

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 ...
Aviv Cohn's user avatar
  • 21.6k
296 votes
16 answers
30k views

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 ...
Mikhail Ramendik's user avatar
69 votes
17 answers
24k views

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 ...
CodeYogi's user avatar
  • 2,186
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
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
97 votes
53 answers
10k views

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

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 ...
Koray Tugay's user avatar
  • 1,595
134 votes
14 answers
22k views

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 ...
LoveProgramming's user avatar
191 votes
15 answers
40k views

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 ...
Niklas Rosencrantz's user avatar
126 votes
27 answers
10k views

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?
98 votes
45 answers
30k views

"Best practices" are everywhere in our industry. A Google search on "coding best practices" turns up nearly 1.5 million results. The idea seems to bring comfort to many; just follow the instructions,...
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
244 votes
16 answers
21k views

I'm a beginner web developer (one year of experience). A couple of weeks after graduating, I got offered a job to build a web application for a company whose owner is not much of a tech guy. He ...
solidsnake's user avatar
  • 2,035
130 votes
15 answers
30k views

I recently encountered a class which provides pretty much every single-character as a constant; everything from COMMA to BRACKET_OPEN. Wondering whether this was necessary; I read an "article" which ...
Austin Day's user avatar
  • 1,351
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
282 votes
6 answers
169k views

In a git environment, where we have modularized most projects, we're facing the one project per repository or multiple projects per repository design issue. Let's consider a modularized project: ...
Johan Sjöberg's user avatar
184 votes
17 answers
25k views

I recently had a job interview in which they gave me an hour to write some real code. It wasn't a huge amount, probably less than 100 lines. After about 45 minutes, I compiled, ran it, and got it to ...
CaptainCodeman's user avatar
52 votes
90 answers
27k views

Please, stay on technical issues, avoid behavior, cultural, career or political issues.
0 votes
4 answers
282 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
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
237 votes
17 answers
137k views

Accidentally I've stumbled upon the following quote by Linus Torvalds: "Bad programmers worry about the code. Good programmers worry about data structures and their relationships." I've thought ...
94 votes
7 answers
18k views

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 && ...
innova's user avatar
  • 1,051
105 votes
47 answers
77k views

There is a colleague of mine who constantly writes: if (someBool == true) It drives me up the wall! Should I make a big deal of it or just drop it?
118 votes
16 answers
24k views

Rightly or wrongly, I'm currently of the belief that I should always try to make my code as robust as possible, even if this means adding in redundant code / checks that I know won't be of any use ...
KidCode's user avatar
  • 2,213
94 votes
14 answers
9k views

I have learned a significant amount of coding, however, it's always been in a scientific environment (not computer science), completely self-taught without anyone to guide me in the right direction. ...
Ashish's user avatar
  • 359
152 votes
22 answers
26k views

Note more discussion at http://news.ycombinator.com/item?id=4037794 I have a relatively simple development task, but every time I try to attack it, I end up spiraling in deep thoughts - how could it ...
133 votes
19 answers
17k views

Whenever I find myself writing the same logic more than once, I usually stick it in a function so there is only one place in my application I have to maintain that logic. A side effect is that I ...
96 votes
13 answers
13k views

I'm writing classes that "must be used in a specific way" (I guess all classes must...). For example, I create the fooManager class, which requires a call to, say, Initialize(string,string). ...
Gil Sand's user avatar
  • 2,193
187 votes
17 answers
16k views

I find myself pondering over this question from time to time, again and again. I want to do things the right way: to write clean, understandable and correct code that is easy to maintain. However, ...
Flot2011's user avatar
  • 2,192
64 votes
10 answers
31k views

After reading many posts explaining closures here I'm still missing a key concept: Why write a closure? What specific task would a programmer be performing that might be best served by a closure? ...
Bendrix's user avatar
  • 769
53 votes
15 answers
36k views

I read the first chapters of Clean Code by Robert C. Martin, and it seems to me it's pretty good, but I have a doubt, in one part it is mentioned that it is good (cognitively) that the functions ...
OiciTrap's user avatar
  • 729
48 votes
6 answers
10k views

If all accounts have 2FA for a given product, is there any reason why the 2FA box couldn't be on the primary login screen? Is it bad practice to request 2FA code along with username and password on ...
Leggy's user avatar
  • 597
42 votes
40 answers
7k views

This question made me think that there was a better question to ask. What did you learn in school that you didn't care about at the time, but turned out to be useful or you had to relearn in the ...
39 votes
8 answers
10k views

Given a repository which contains two different applications A and B (e.g. bootloader and RTOS), is it ok to copy source code from A to B in order to avoid dependencies (include's, adding A source ...
Martel's user avatar
  • 615
24 votes
10 answers
7k views

While I am reading The Pragmatic Programmer e2, I came across Tip 38: Crash Early. Basically, the author, at least to my understanding, advises to avoid catching exceptions and let the program crash. ...
Hawk's user avatar
  • 487
-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
135 votes
10 answers
107k views

Has anyone thought about why so many of us repeat this same pattern using the same variable names? for (int i = 0; i < foo; i++) { // ... } It seems most code I've ever looked at uses i, j, k ...
81 votes
15 answers
64k views

I am talking about 20-30+ millions lines of code, software at the scale and complexity of Autodesk Maya for example. If you freeze the development as long as it needs to be, can you actually fix all ...
Joan Venge's user avatar
  • 1,980
20 votes
8 answers
23k views

Consider the following: public boolean maybeUpdateTime() { if (this.timeReference.isAfter(lastInterval.getBeginning()) { this.timeReference = lastInterval.getEnd(); lastInterval = ...
Lucas Noetzold's user avatar
52 votes
18 answers
49k views

Does function length affect the productivity of a programmer? If so, what is a good maximum number of lines to avoid productivity loss? Since this is a highly opinionated topic please back up the ...
105 votes
15 answers
121k views

I must confess that I was not so strong in data structures when I graduated out of college. Throughout the campus placements during my graduation, I've witnessed that most of the biggie tech companies ...
-2 votes
1 answer
216 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
129 votes
11 answers
33k views

As a "new" programmer (I first wrote a line of code in 2009), I've noticed it's relatively easy to create a program that exhibits quite complex elements today with things like .NET framework for ...
Adam 's user avatar
  • 1,397
140 votes
5 answers
166k views

Just browsing the google maps source code. In their header, they have 2 divs with id="search" one contains the other, and also has jstrack="1" attribute. There is a form separating them like so: <...
danludwig's user avatar
  • 1,768
-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

1
2 3 4 5
32