2,764 reputation
1230
bio website
location Argentina
age 37
visits member for 3 years, 10 months
seen yesterday

Software developer and science fiction fan.


1d
comment How to define “or” logically
@sapi True, but I prefer to work with languages with sane boolean operators (aka "the actual boolean operators")
Dec
12
comment Why use arg type `class Object` instead of `Comparable[]`?
Nitpick: yo do not need to explicitly cast an object to Object in order to use methods of class Object.
Nov
30
comment Inheritance in imperative programming
I just found the talk which has the slide Uncle Bob was ranting against. It's interesting. If I were a software engineering guru and published author like Uncle Bob, I would have taken the effort to find the talk and see what it has to say. Maybe, just maybe, he's just mistaken about FP because he's unfamiliar about it. But he gives no indication in his post he did so, which doesn't surprise me...
Nov
29
comment Inheritance in imperative programming
It drives me mad that Uncle Bob feels confident enough to write about the differences/similarities between OOP and FP when he clearly is familiar with only one of the two!
Nov
29
comment Inheritance in imperative programming
The more I read Uncle Bob's posts, the less I respect him. The guy has no idea whatsoever about what FP is. No shame in that; there's plenty I don't know either, but I least I try not to rant about it as if I did. Examples of things he gets wrong: he speaks of polymorphism as if naturally belonged to OOP or FP didn't use it (wrong), he ignores higher-order functions as the natural way to do what he calls "source inversion", "too many parenthesis" is not something found in FP (maybe he got confused with Lisp?), "true functional programming has no assignment" (oversimplification), etc.
Nov
29
comment Inheritance in imperative programming
Please note that "OOP" is a subset of "imperative programming", so I think your question is imprecise. Also, I'm confused: you say "inheritance", but I suspect your question is about code reuse and/or polymorphism and/or subtyping. Is that so? Because there are many ways to reuse code outside OOP. (In other words: you're looking for a way to do inheritance. Why? What actual problem do you hope to solve with inheritance?)
Nov
5
comment Using public final rather than private getters
@ThomasJung Private field names are an internal implementation detail and shouldn't be exposed (as a general rule; there may be exceptions). It's not necessary (except for the godawful Java bean convention) to have a getter/setter for every field. One of the points of OOD is to avoid locking clients to your internals. Unfortunately a lot of common Java practices do not follow OOD principles.
Oct
24
comment Testing for object equality by comparing the toString() representations of objects
@supercat It sounds as if you really want to write an answer instead of commenting in mine :)
Oct
24
comment Testing for object equality by comparing the toString() representations of objects
@supercat I'm sorry, I don't even understand your example anymore, or how it relates to the original question. This would probably something for us to discuss in another place. Feel free to write your own answer if you disagree with my advise that no, in general you shouldn't rely on toString to compare Objects!
Oct
24
comment Testing for object equality by comparing the toString() representations of objects
@supercat I'm familiar with the limitations of Java's type system. Your example seems very contrived, and I doubt you'll gain much by using Object instead of a different, more useful type. What happens when I put a value in that map that isn't a String or a String[]? Ah, yes: I should have read the javadoc! If only there was a way to somehow tell the compiler that I cannot put an instance of Integer in the map! ... I hope you get my point :)
Oct
23
comment Testing for object equality by comparing the toString() representations of objects
@supercat I know; that's one of its limitations. As a general rule though, and unless you have very specific reasons not to, you should avoid passing Object to Java methods if they will only work with some subclasses (aka "avoid writing partial functions whenever possible"). Of course, lots of existing Java libraries work that way; let us learn from their horrible mistakes :)
Oct
23
comment Testing for object equality by comparing the toString() representations of objects
@supercat To put it another way, whenever it's possible to encode the property "the passed-in Map meets certain criteria" as a type in a statically typed language, please do so!
Oct
22
comment Testing for object equality by comparing the toString() representations of objects
@supercat That would be a poor use of Java's type system. In some cases its limitations make this unavoidable, but whenever possible use real types and avoid the "javadocs-as-types" as you suggest, which is a bad practice. If the method doesn't work correctly for all Objects, then for heaven's sake, don't pass it an Object. Anything else is not taking full advantage of the type system, which you must not do unless you have a good reason. I suppose you could program in Java as if it were Python, but what would be the point? :)
Oct
9
comment Why does java.util.ArrayList allow to add null?
@casablanca That is indeed a bad use of nulls, but one that is often used in practice in Java-land.
Oct
9
comment Why does java.util.ArrayList allow to add null?
This answer is plain wrong. This is just unsupported guesswork about nulls being allowed in a list implementation. Here is a roundup of Java collections allowing/disallowing nulls; notice how it has nothing to do with similarity to arrays.
Oct
3
comment Alternative to language purity
BTW, I doubt people are claiming Haskell is impractical because of its I/O.
Oct
3
comment Alternative to language purity
I'm note sure what the big difference is with the IO monad. Instead of "IO" you say "impure", then everything else is pretty much the same: "tainting" callers, purity by default, etc.
Sep
26
comment Is there a good reason to make pure functions non-public?
To clarify, I'm agreeing with this answer.
Sep
26
comment Is there a good reason to make pure functions non-public?
@Telastyn I think integer "less than" is not a good example, since it's a function that everyone agrees is part of the "public API" of integer numbers. In the general case, when you make something public it's harder to remove it later; private/public is more about "things that I can freely change with impunity" vs "things that are difficult to change". No-one would dream of removing integer "less than", but when you're coding anything else, you have to think about whether it's likely to change and/or disappear, and this is orthogonal to its "purity" (in the sense of the original question).
Sep
26
comment Is there a good reason to make pure functions non-public?
What was your opinion? I don't think the purity of the function is related to whether it belongs in the public API.