Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
4 11
~6k people reached

comment Will a computer attempt to divide by zero?
For floating point numbers, actually, only 0/0 (or NaN/0) gives NaN, x/0 for other x gives positive or negative infinity.
comment Should we avoid language features that C++ has but Java doesn't to increase maintainability?
And Java-Programmers wouldn't use delete either.
comment Why are self-hosting compilers considered a rite of passage for new languages?
Decent Unicode support is not really needed to write a compiler, though.
comment Is a large static initializer a code smell?
What about a factory method/function?
comment Is there anything that can be done with recursion that can't be done with loops?
A naive recursive implementation of Fibonacci numbers with recursion will run "out of time" before it runs out of stack space. I guess there are other problems which are better for this example. Also, for many problems a loop version has just the same memory impact as a recursive one, just on the heap instead of the stack (if your programming language distinguishes those).
comment Is client-side validation really all that important, always?
@samuelmr What is their justification for that?
comment Bad practice to define constants based on a function call?
@JAB the JLS has a definition which says which expressions are compile-time constant. When there is a method call in there, it is not one.
comment Maintain hundreds of customized branches over master branch
@Jake you should have all your config files for the different customers somewhere under version control, though. Doesn't have to be the same repository, and shouldn't be 500 branches in one, certainly.
comment Is it normal to spend as much, if not more, time writing tests than actual code?
"long enough" → "too long" (in point 4)?
comment Is a memory of all possible permutations of a kilobyte block and pointers possible?
Storing all blocks smaller than 1 KB in addition will not take that much more space. Assuming only byte-sized blocks, the size of the smaller blocks together is just slightly over 1/256 of the size of the 1-KB-blocks. Assuming bit-sized blocks, you add about the same size again.
comment Is there a need to keep tests for simple (self-contained) functions?
In this case, there already was a test, so the question is not whether to write them, but whether to commit them and run them with each build or release or whatever schedule there is for running all the tests.
comment Maintaining separation of concerns
@DavidArno if the cards can be played at locations in a rectangular grid, how should the player indicate at which of those to play them, if not by coordinates? (Those are not screen coordintes, but grid coordinates.)
comment Why do programs use call stacks, if nested function calls can be inlined?
If your first example is meant to define the Fibonacci series, it is wrong. (It is missing a fib call.)
comment Should we define types for everything?
In the case of money, make sure the currency is either included in the Money object, or your whole program uses the same one (which then should be documented).
comment Is it a bad practice to separate the unit tests for a class?
Actually, you might want to look at a test even if no requirements change – just to understand how the tested class is meant to be used, for example.
comment Does path coverage guarantee finding all bugs?
@MSalters I'm talking about code which (by specification) should not throw any exception, regardless of input. If it throws any, that would be a bug. Of course, if you have code which is specified to throw an exception, that should be tested. (And of course, as Jörg said, just checking that the code doesn't throw an exception is usually not enough to make sure it does the right thing, even for non-throwing code.) And some exceptions can be thrown by a non-visible code path, like for null pointer dereference or division by zero. Does your path coverage tool catch those?
comment Does path coverage guarantee finding all bugs?
It could make sure that there is no exception when calling the tested code (with the parameters in the test). This is slightly more than nothing.
comment When is it a good idea to force garbage collection?
For the latency control case, I guess instead of doing this periodically, you could also do it by need (i.e. when the memory usage grows over a certain threshold).
comment How to monitor code review efficiently?
Yes, it helped a bit by allowing the merge only for a limited set of people, who had the task to check if the actual review was done right.
comment How to monitor code review efficiently?
Even with such a process (which I supposed actually happens from the description in the question), you sometimes have developers thinking "ah, I trust my colleague enough and have too much to do myself, so I'll just merge it without actually reading the details, or even commenting on it". (We have a similar process in our team, with two approvals needed (from people other than the PR author), before it can be merged. Still sometimes changes go through without a thorough review.)