3 ms·
I think that's exactly what the author tries to say. I've also joked expressing it as "you don't refactor your twins." I'm curious (and I think it can be a use
by Jare 14y ago
I think that's exactly what the author tries to say. I've also joked expressing it as "you don't refactor your twins."
I'm curious (and I think it can be a useful sub-topic) what you think made Java worse for DRYing. The rigid type system? Added verbosity?
- pjungwir 14y agoOne easy example: no higher-order functions like `map`, `select`, and `inject` because of no lambdas, so I wind up repeating the same looping code all over the place. I took a look at a few "functional programming in Java" libraries, but their solutions were still pretty verbose, and it didn't seem worth adding a dependency for a tiny smartphone app.
- pjungwir 14y agoEDIT: After thinking about it some more, there are several places where two methods are almost the same except for one line stuck in the middle. I don't know how to turn them inside-out in Java without spawning a bunch of tiny classes, and it's just not worth it. But with Ruby I could turn them into a single method, throw a yield in the middle, and then call it with a block. So again it comes down to no lambdas. (Hmm, this was supposed to be an edit, but somehow I did a reply instead.)