2,757 reputation
1230
bio website
location Argentina
age 37
visits member for 3 years, 8 months
seen 8 hours ago

Software developer and science fiction fan.


Apr
16
comment Is Haskell/Clojure actually unsuited for dynamic systems such as particle simulation?
In addition, I'd also disregard the answer that starts with "A pure functional approach is not a good fit for games ..." unless the author proves he has actually tried writing a functional program. Otherwise, he is just guessing what he thinks the problems may be.
Apr
16
comment When to use DAG (Directed Acyclic Graph) in programming?
A loop cannot exist in a DAG, as per this definition: "a directed graph with no directed cycles". So I'd say a program in general is not a DAG (an example of a structure which does correspond to a DAG is a binary tree, for example). Specific programs may be DAGs, though.
Apr
16
comment When to use DAG (Directed Acyclic Graph) in programming?
Is this imperative program a DAG in your opinion: while (true) { print("hi"); } ? Maybe you want to exclude non-terminating programs?
Apr
16
comment Teaching `class`es and objects in C++ to university students
Fair enough. But then, like @Caleb says, your problem is unrelated to 'classes' and 'objects'. Maybe you should retitle your question to "teaching low-level memory management to Java programmers".
Apr
16
comment Is Haskell/Clojure actually unsuited for dynamic systems such as particle simulation?
Who told you they were unsuitable? Link to answer/comment?
Apr
16
comment Teaching `class`es and objects in C++ to university students
Why would you want to pick between C++ and Java when teaching classes and objects? For this goal they are essentially the same. If true object orientation is your goal, you'd better pick something like Smalltalk. If not -- which is what I'm guessing -- then stick to Java. Nothing to "unlearn" when moving from Java to C++; don't assume your students are idiots :)
Apr
15
comment How to determine most challenging test-cases to test any algorithm?
Agreed, I think several complementary approaches are needed. And yes, nothing beats actually understanding how the algorithm works and what its special cases are (which is why TDD is hopelessly inadequate for this task)
Apr
15
comment How to determine most challenging test-cases to test any algorithm?
+1 The random approach you suggest (verifying properties against randomly generated samples) actually exists! See tools such as QuickCheck (for Haskell) or Scalacheck for Scala :)
Apr
15
comment How to determine most challenging test-cases to test any algorithm?
Maybe I'm being a nitpicker, but your most relevant answer is the last line (about Pex). Why not move it to the top, since it's the actual answer? The rest is either wrong (the tongue-in-cheek part) or incomplete ("design your programs in such a way..."). Partitioning the test space is usually at least a whole chapter in software engineering books, and there are published papers about it. Obviously "design your algorithms well" is not the complete answer, but only one side of the equation!
Apr
15
comment How to determine most challenging test-cases to test any algorithm?
I don't understand why you started your answer with a misleading paragraph, which you later acknowledge to be "tongue in cheek"? Shouldn't you remove it, or at least move the relevant part of your answer to the top? (that TDD isn't the answer to input space partitioning is a given)
Apr
13
comment Why do some of object oriented languages let programmer use primitive types?
Um, isn't Double in C# not a primitive type, just like Decimal? In which case, the performance increase had to do with the differences between both abstract types, rather than with primitive vs non-primitive. Double is an example of a performant non-primitive type.
Apr
13
comment Why do some of object oriented languages let programmer use primitive types?
@tgkprog Why would a primitive be handy for a simple "next loop"? I assume we are not coding in assembly language here, but a high-level OO language.
Apr
8
comment Immutable vs mutable object as returned parameter for class method
Immutable objects are not only about multi-threading, like Jimmy Hoffa correctly pointed out. Making an object immutable also makes it simpler to reason about single-threaded code: for example, if I see x mentioned somewhere, more code follows, then x again, I know it represents exactly the same value or object state as before; I don't even have to look at the function calls in between.
Apr
8
comment In Unit Testing, why would I create a Repository twice?
@Theomax Depends on the context: if you are unit testing a software component which is not your ExampleRepository, then it's best to use a mock. The justification being that you are not unit-testing the repository but something else.
Apr
6
comment How important is it to reduce the number of lines in code?
By definition, if a task absolutely requires N lines of code to accomplish (which is something hard to determine in the first place), then it cannot be done in less than N lines. So your 10,000-line task cannot be done in 2,000, period. I guess the OP is talking about the cases where there is some leeway, i.e. "the requirement can be fully accomplished either way, so which one is better?"
Apr
6
comment How important is it to reduce the number of lines in code?
Your second example is especially good, because it's not only simpler, it also makes it more clear this is an assignment of one of two options, with no side effects. The if-then-else obscures this; for example, it's all too easy to assign to a different variable in each branch of the if (which may or may not be a mistake, but it's hard to spot).
Apr
5
comment About Artificial Intelligence
Why is object orientation needed for AI?
Apr
5
comment How should you deal with a popular project that you no longer want to maintain?
Out of curiosity, what is the project? Link? (assuming it's open source)
Mar
27
comment In Java, would you sacrifice type safety for a nicer programming interface
If you want to sacrifice type safety, why are you using Java? You end up with the worst of both worlds! :)
Mar
26
comment Why do some big projects, like Git and Debian, only use a mailing list and not an issue tracker?
Great answer! Email is better known than issue trackers, and easier to understand (which is not to say everyone "gets" email :P )