2,773 reputation
1230
bio website
location Argentina
age 38
visits member for 3 years, 11 months
seen 2 hours ago

Software developer and science fiction fan.


2d
comment Leaving intentional bugs in code for testers to find
+1 It reminded me of that DailyWTF post too!
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Fuhrmanator A customer can still write one-line user stories and business rules regardless of whether you use OOP and FP. I don't expect customers to understand higher-order functions any more than I expect them to understand inheritance, composition or interfaces.
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Doval That's how a Haskeler friend told me to start working on a Haskell function: sprinkling "undefined"s wherever I don't have an implementation yet :) It seems top-down to me.
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Fuhrmanator But you do know where to find a function. And there is only one function, not multiple functions with the same name, defined for each datatype (again, see the "Expression Problem"). For example, for Haskell library functions (which you're encouraged to use, instead of rediscovering the wheel or making a slightly less useful versions of said functions), you have wonderful discovery tools such as Hoogle, which is so powerful it lets you search by signature (try it! :) )
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Den I can't tell what either of those functions do. However, I can tell you if the first function in FP was a sort or a filter, it would be named filter or sort, not func (just like you named it IFilter, etc). In general, in FP you'd name it func or f when either sort or filter is a valid choice! For example, when writing a higher-order function that takes func as a parameter.
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Den The popularity you describe is, I'm afraid, an accident of history. I use Scala at work, and it's a complex beast due to the way it attempts to mix FP and OOP. Switching to a true FP language like Haskell feels like a breath of fresh air -- and I'm not talking from an academic perspective either!
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@BenAaronson That's a very OOP point of view :) With FP, you tend to generalize traversals over stuff, and pass the specific work as a function parameter. In this way, you tend to reduce duplication: there are no multiple ways to do similar things spread over Student, Course, and/or their helpers. AOP seems like a solution to an OOP problem.
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Fuhrmanator True, in the sense you're talking about, both OOP and FP are low-level. But how does this relate to the "representational gap"?
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Den See also Erik Meijer's "'Mostly Functional' programming doesn't work", which argues against the hybrid approach and for going full "fundamentalist" FP.
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Den Hybrid approaches have their merits. It's not true, however, that the distinction is artificial. There are lots of compromises Scala had to make in order to fit OOP and FP (less powerful type inference is one. Complexity is another: yes, a language that mixes OOP and FP tends to be more complex -- as in "hard to use and understand" -- than one of its purer brothers on the two extremes).
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@BenAaronson I find FP more reusable/composable than OOP. Instead of an ad hoc method on a Student class, you have general functions performing general computation whenever you can. Doing some work on a list of Students and returning a filtered result is a typical FP computation that can be applied to almost anything. Why put it in a Student class, unnecessarily constraining yourself? And what if you don't need to give a name to the work you're doing on the Student? Why have a method at all?
Jan
26
comment Does functional programming increase the 'representational gap' between problems and solutions?
@Hey Giorgio is likely referring to the so-called Expression Problem. "Adding new formats" means "adding new constructors (aka 'cases') to a datatype".
Jan
23
comment Enum as singleton or fully functional class
@Heisenberg It doesn't matter what enum's original purpose was. This is something that was found afterwards: that it's the safest way to write singletons. All other ways are error-prone or bugged in subtle ways.
Jan
19
comment When does pair programming work? When to avoid it?
@Giorgio Agreed. I actually support partial Pair Programming: tackling some hard problems in pairs. But some advocates think it should be used most of the time for most programming tasks, which I disagree with.
Jan
16
comment How to do Test Driven Development
@JörgWMittag Correct me if I misunderstood you, but are you saying that Ron Jeffries was doing "pseudo-TDD"? Isn't that a form of the "no true Scotsman" fallacy? (I agree with you about the need for more scientific studies; the blog I linked to is just a colorful anecdote about the spectacular failure of a specific instance of TDD usage. Unfortunately, it seems as if the TDD evangelists are too loud for the rest of us to have a real analysis of this metholody and its alleged benefits).
Jan
16
comment How to do Test Driven Development
You could also look into doing automated unit/integration testing without doing TDD. The two are often confused, but they are not the same thing.
Jan
16
comment How to do Test Driven Development
+1 The answer is good in that it correctly describes TDD. However, it also shows why TDD is a flawed methodology: careful thought and explicit design is needed, especially when faced with algorithmic problems. Doing TDD "in the blind" (as TDD prescribes) by pretending not to have any domain knowledge leads to needless difficulty and dead-ends. See the infamous Sudoku solver debacle (short version: TDD cannot beat domain knowledge).
Jan
9
comment What is idiomatic way in f# to express sequence of if statements with overlapping conditions
Sorry, I can resist to nitpick (and I do get the point of your answer), but please add a footnote that states the cleanest way to write the last snippet is return cond; (or simply cond in an ML-like functional language). Because the rest of your answer makes sense, I'm pretty sure you got confused while translating the first snippet to the second and you probably meant to return something else...
Dec
28
comment Is every language written in C?
@DavidWallace We've been through this already. "Every language" is newbie-speak for "every implementation of a language". "Languages" are specs, which may be implemented as a compiler/interpreter/etc (though it's typical of novices to conflate the two; almost everyone of us made this mistake at least once). With this in mind, it's clear the OP is asking whether every implementation is written in C. Feel free to edit the question if you feel it would make it clearer, you have enough rep. Other than that, suit yourself: downvote, don't downvote, whatever.
Dec
28
comment Is every language written in C?
@DavidWallace "Every" means "every", what's ambiguous about that?