13,476 reputation
43760
bio website
location Minneapolis, MN
age
visits member for 4 years, 7 months
seen 6 hours ago

Dec
17
comment Are all magic numbers created the same?
@NathanCooper: I know it's an example, but when discussing nuanced topics that are context-sensitive judgment calls, your choice of example is important.
Dec
17
awarded  Nice Answer
Dec
17
comment Are all magic numbers created the same?
@NathanCooper: your preferred e^i*pi = -1 is better in that instance, because your alternative isn't correct. e is not 2.718. And while specs change a lot, they also have a habit of changing only in unexpected ways where you can't just change a single #define and run with it.
Dec
17
comment Are all magic numbers created the same?
@user61852: named constants aren't always more readable. They often are, but not always.
Dec
17
comment Are all magic numbers created the same?
@user61852: Like just about everything else in software, it boils down to judgement calls specific to your context. In some cases 9.8 would be appropriate in-line, in others it would not be. Using a constant for acceleration due to gravity can be dangerous because g is not constant everywhere, nor is standard g 9.80000. Using a constant defined elsewhere makes errors in your usage of the value less obvious.
Dec
17
answered Are all magic numbers created the same?
Dec
17
comment What is a good word for the current “state” of a state machine?
I've seen plenty of state machines over the years that just call the variable "State". Never been confused.
Dec
16
comment Math model for a webpage layout?
Generating "bullet proof" html/css to do just about anything beyond hello world is serious undertaking. You underestimate how quirky browsers are.
Dec
10
comment Is there ever a reason to use an array when lists are available?
Rarely? Not everyone works on super-complicated ultra-configurable enterprise monstrosities.
Dec
8
comment Hardware accelerated text processing
Also reversal is not a basic string operation in the 21st century.
Dec
8
comment Hardware accelerated text processing
It already exists and it is already implemented in various forms in common desktop processors. String operations have been commonplace on computers since nearly day 1, and many architectures have had many different instructions catering to particular string handling schemes.
Dec
8
comment Adding non distinct elements to a dictionary
While I agree exceptions shouldn't be used for flow control, option 1, in multiple thread situations along with bad luck, can lead to a race condition resulting in an unhandled exception. There are scenarios where 2 is more appropriate.
Dec
6
comment Efficiency of C# dictionaries
Your quote says "Retrieving a value by using its key is very fast, close to O(1), because the Dictionary class is implemented as a hash table.", so the OP could confuse the two concepts. In otherwords, I wanted to make it clear that big O does not tell the whole story concerning "speed".
Dec
6
comment Efficiency of C# dictionaries
O(1) isn't necessarily "fast". Looping through a list could still be quicker than a hashtable for the collection sizes the application is dealing with.
Dec
4
comment Is “White-Board-Coding” inappropriate during interviews?
Whiteboards are immutable? You just wipe something off and rewrite it on a whim, that's what makes them useful, especially teaching. You must live in an alternate universe.
Dec
4
comment Testing vs Don't Repeat Yourself (DRY)
If a test fails unexpectedly, whether you have one assert or many, you're going to have to fire up the debugger to fix why the test failed either way.
Dec
3
revised Various methods manipulating same member variable versus each takes inputs and provides output
added example.
Dec
3
comment Various methods manipulating same member variable versus each takes inputs and provides output
@Ahmad: a lot of them also maintain their own state.
Dec
3
answered Various methods manipulating same member variable versus each takes inputs and provides output
Dec
3
comment What can C++ do that Python cannot?
Run on the bare metal.