Reputation
2,585
Top tag
Next privilege 3,000 Rep.
Cast close & reopen votes
Badges
13 17
Newest
 Yearling
Impact
~221k people reached

Apr
19
comment Declaring functions in order to avoid explicit nested loops
O(n^6) Wow! I'd like to see how someone managed to accomplish that! I've once written an O(n^8) but I had no choice--I was validating a dataset to ensure there were no dead ends. Given the sparseness of paths through it it only took overnight.
Mar
23
comment Why can't we just use variables instead of constants?
Language features like "const" are there to protect you from human fallibility. If you think you're an infallible I've got two words for you: "You're fired!"
Jan
18
comment What does 'upper bound' mean in context of BigO?
Upper bound: What happens when Professor Moriarty gets to arrange your data to slow you down.
Jan
3
comment Shipping test code. Why wouldn't you?
@JonChesterfield I have a hard time picturing a unit test failing on most of those causes. Integration tests are another matter, though--I can see merit in shipping them if it can be done without too much extra stuff.
Dec
7
answered Why do we need both Priority and Severity?
Nov
15
comment Is it always a best practice to write a function for anything that needs to repeat twice?
Using a GREET_OPENING constant assumes all possible greetings are in the same order. Being married to someone whose mother tongue does almost everything opposite of English makes me leery of this assumption.
Oct
17
awarded  Yearling
Oct
12
comment Will hand-written assembly disappear?
In addition to the cases mentioned there are times when you know something about the data that the compiler doesn't and can thus outperform it.
Oct
10
comment Best approach to implement multiple levels of difficulty to a minimax AI
I've tackled this in two ways in the past: Adjusting the depth of search and switching on/off parts of the evaluation.
Oct
10
comment Does C# 6.0's new null-conditional operator go against the Law of Demeter?
a?.Foo is not quite equivalent to a == null ? null : a.Foo. The former evaluates a only once, the latter evaluates it twice. That could matter if a were an iterator.
Oct
9
comment Why would you not use the 'using' directive in C#?
Microsoft is guilty of a namespace collision. It was long enough ago that I forget what it was but it was quite surprising when I realized what was up. Both units are common units.
Sep
23
comment Writing your test assertions in your function comments (just before the code)?
@gnat I don't see that this is a question of what's the best software, but rather a question of whether anything of the sort exists. It's a feature I have long wanted, put the code and it's tests together.
Sep
23
comment Writing your test assertions in your function comments (just before the code)?
I did that once in school. We were in teams, I finished the real code, my partner's test code wasn't ready. I ran my code against the test engine that would be used to turn it in to see what would happen (I was intending to use it as a rather uninformative debugger)--it passed. Zero bugs isn't proof the method is bug free!
Sep
11
comment Why isn't there a true “Date-Only” data type?
Store your times as UTC, no date issues, no time zone issues.
Sep
10
comment Is there a benefit to unit testing code whose sole purpose is to generate non-human-readable code in another language?
As far as I'm concerned you have found one of the many cases where our current obsession with unit testing is a bad idea.
Aug
20
answered Is it ok if a method returns a new instance of the class it's in?
Aug
13
answered Simplifying Some Probabilistic If-Then Spaghetti Code
Aug
13
comment Is code like this a “train wreck” (in violation of Law of Demeter)?
I don't think the Law of Dementer should even apply in a case like this--configuration is basically a container. In every API I have ever worked with looking inside containers is normal and expected behavior.
Jul
30
awarded  Explainer
Jul
30
answered Is this a valid situation for returning rather than throwing an exception?