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.

0votes
4answers
224views

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 ...
Charanor's user avatar
308votes
16answers
136kviews

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 ...
123votes
12answers
48kviews

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, ...
Parth Patel's user avatar
276votes
14answers
125kviews

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 ...
Slamice's user avatar
  • 2,657
26votes
8answers
6kviews

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 ...
Pieter B's user avatar
10votes
4answers
5kviews

Is there something between Debug and Release build?

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
250votes
16answers
50kviews

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 ...
Aviv Cohn's user avatar
25votes
13answers
10kviews

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 ...
Tom Huntington's user avatar
296votes
16answers
30kviews

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

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 ...
CodeYogi's user avatar
23votes
6answers
6kviews

How important is it to clearly understand requirements and architecture before starting to code? [closed]

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
5votes
5answers
951views

Is it bad practice to use nullptr in ternary operation?

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
97votes
53answers
10kviews

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 ...
138votes
17answers
15kviews

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 ...
Koray Tugay's user avatar
-2votes
1answer
163views

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 ...
Marko Sami's user avatar

153050per page
close