This tag is for questions that aren't specific to a programming language or environment.
This tag is for questions that aren't specific to a programming language or environment. This tag is not a tag for opinion questions, rather for questions asking about code structuring and design that is applicable in any language, or, for books that do not relate to a specific langugage, rather to programming as a whole, I.E.: Pragmatic Programmers, Code Complete.
My boss keeps mentioning nonchalantly that bad programmers use break and continue in loops.
I use them all the time because they make sense; let me show you the inspiration:
function verify(object) {
if (object->value < 0) return false;
if…
It seems there is a certain amount of agreement that exception messages should contain useful details.
Why is it that many common exceptions from system components do not contain useful details?
A few examples:
.NET List index access…
Regardless of programming language(s) or operating system(s) used or the environment they develop for, what should every programmer know?
Some background:
I'm interested in becoming the best programmer I can. As part of this process I'm trying to…
So I was reading a question about forcing the C# garbage collector to run where almost every single answer is the same: you can do it, but you shouldn't - except for some very rare cases. Sadly, nobody there elaborates on what are such cases.
Can…
This has become a large frustration with the codebase I'm currently working in; many of our variable names are short and undescriptive. I'm the only developer left on the project, and there isn't documentation as to what most of them do, so I have…
I've been pondering this problem for a while now and find myself continually finding caveats and contradictions, so I'm hoping someone can produce a conclusion to the following:
Favour exceptions over error codes
As far as I'm aware, from working in…
We have a lot of programming languages. Every language is parsed and syntax checked before being translated into code so an abstract syntax tree (AST) is built.
We have this abstract syntax tree, why don't we store this syntax tree instead of the…
The classical way to program is with try ... catch. When is it appropriate to use try without catch?
In Python the following appears legal and can make sense:
try:
#do work
finally:
#do something unconditional
However, the code didn't catch…
When doing single-threaded asynchronous programming, there are two main techniques that I'm familiar with. The most common one is using callbacks. That means passing to the function that acts asynchronously a callback-function as a parameter. When…
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 project or else you just trick yourself into…
Something that I've known for a while but never considered is that in most languages it is possible to give priority to operators in an if statement based on their order. I often use this as a way to prevent null reference exceptions, e.g.:
if…
After browsing several answers an Stack Overflow, it is clear that some natively compiled languages have garbage collection. But it is unclear to me how exactly this would work.
I understand how garbage collection could work with an interpreted…
I keep hearing about early and late binding, but I do not understand what they are. I found the following explanation which I do not understand:
Early binding refers to assignment of values to variables during design time whereas late binding…
In the setting of an interview: What is the best way to reliably identify when somebody is an excellent programmer. By this I mean he is one of those that is 10-15 times more efficient / rapid / better than his peers towards the lower end of the…
Do you know that feeling when you just need to show off that new trick with Expressions or generalize three different procedures? This does not have to be on Architecture Astronaut scale and in fact may be helpful but I can't help but notice someone…