2,679 reputation
1127
bio website
location Argentina
age 37
visits member for 3 years, 2 months
seen 7 hours ago

Software developer and science fiction fan.


Jan
25
comment Is Ken Thompson's compiler hack still a threat?
Or, since most people don't compile anything from source (say, on Windows) your average trojan will suffice :) (I'm agreeing that a compromised compiler is way overkill)
Jan
24
comment I've been told that Exceptions should only be used in exceptional cases. How do I know if my case is exceptional?
+1 "exceptions should be exceptional" is a terrible rule of thumb. Well said! That's one of those things people just repeat without thinking about them.
Jan
24
comment Why is Today() an example of an impure function?
@Brad count() on most programming languages is definitely pure. It has an explicit input value: the collection whose count you want. Don't be confused by a syntax such as myCollection.count(); that's just sugar for count(myCollection).
Jan
21
revised Emphasize negation
code formatting
Jan
21
suggested suggested edit on Emphasize negation
Jan
21
comment How can “hash functions” be used to implement hash maps at all?
Question asked an answered in stackoverflow
Jan
21
comment How can “hash functions” be used to implement hash maps at all?
Have you looked in stackoverflow?
Jan
21
comment Java memory management (thunks/lazyness)
The OP is likely talking about functional-style recursive/infinite lists. These are definitely possible in functional languages with lazy evaluation. I guess what he is asking is how to do the same in Java.
Jan
21
comment Java memory management (thunks/lazyness)
Luke, can you post (or link to) a minimal snippet of working Java code? I suspect what you're trying to do cannot be done in Java :) Your examples seem to be Groovy, not Java.
Jan
21
comment How can “hash functions” be used to implement hash maps at all?
No. telephone in your example is unrelated to this discussion. Forget about linking A and B; all a hash function does is map a value x to a value y. You normally do not "convert" the hash into anything else. I suspect you are also confusing hash functions as a way to store values in a table (one possible use) to hash functions in cryptography (another, different usage).
Jan
21
comment How can “hash functions” be used to implement hash maps at all?
@ManojR It doesn't give 2 different values. f(x) = 0 is a valid hash function; one that maps every input value to the same bucket. The only true constraint for a hash function f is that x == y --> f(x) == f(y). Note that any constant function satisfies this condition. Not saying this is a good choice of hash function, though ;)
Jan
21
comment How can “hash functions” be used to implement hash maps at all?
-1 Property 2 is definitely not a property of hash functions. Any constant function is a valid hash function (though not a very useful one).
Jan
18
comment Replacement for instanceof Java?
It's not that the keyword instanceof is wrong; trying to find the class of an object is usually the problem. Not always wrong, but probably in your case it is. Maybe if you tell us what you're trying to accomplish, we can suggest a solution using polymorphism.
Jan
11
comment Effectiveness of FizzBuzz and Beyond
@MSalters You cannot assume lex specialis is what the author of the requirement wanted, because it's not a reasonable assumption in the real world. Therefore this exercise cannot be completed without asking questions about the apparent contradictions. Someone completing the test without asking questions simply got it wrong.
Jan
11
comment Effectiveness of FizzBuzz and Beyond
@GradeinarPfeffernüsse How can the candidates who didn't ask any question have completed this test successfully? It's impossible because the requirements are contradictory; without clarification this exercise simply cannot be done!
Jan
11
comment Why is it often said that the test cases need to be made before we start coding?
Another disadvantage is that, while proponents of TDD often tout it as a "design methodology", it has serious shortcomings as a design tool (e.g. the assumption that it's reasonable to expect a solution to grow organically out of a bunch of tests). Google the infamous Sudoku TDD affair!
Jan
4
comment What is the difference between “recursion” and “self-reference”?
@Caleb Oops, sorry. If you are saying they are very close in meaning, then we agree and I misunderstood you!
Jan
4
comment What is the difference between “recursion” and “self-reference”?
@Caleb This is not a particularly good example, because List is a recursive data type. So you are actually showing another example of recursion!
Dec
28
comment What discipline does Computer Science belong to?
@red-dirt That's not true. There is scientific method in CompSci; you have experiments, formal proofs, etc. Most hardcore computer scientists are into Math and formal logic (see: lambda calculus, the halting problem, etc, etc), and publish papers in peer-reviewed journals. Don't confuse them with people who invent "methodologies", which are not scientists by any definition of the word.
Dec
24
comment Should a programmer take writing lessons to enhance code expressiveness?
What is "code expressiveness"? I take it it's something other than a programming language's expressiveness, because no amount of writing lessons is going to change that...