Better HN
topnewbestaskshowjobs
Log inSign up

nusco

5 karma · joined Aug 20, 2010 (16y ago) · 5 submissions

Submissions

comment 16y ago · link · parent

From the OP: I considered changing the names because I had the same concern, but in the end I figured that the current name was good enough for a toy example. In hindsight, you're probably right I should have used other names (although your sneering tone is not really necessary).

comment 16y ago · link · parent

From the OP: I used dynamic proxies in both Java and C#. For example, I wrote the annotations introspector for Hibernate Annotations, and a memcached wrapper for a C# project. Both are proxy-based.

However, using dynamic proxies in Java feels like going against the grain of the language: strong typing and dynamic calls don't really like each other. As a result, you usually resort to Java/C# dynamic proxies only when you have no other option. I've yet to see anyone using a dynamic proxy just to remove duplication in a Java class.

C# dynamics might make dynamic proxies less clumsy in that language. Will try. Do you have experience with them already?

comment 16y ago · link · parent

From the OP: I agree with you guys (or gals) on both calling super and redefining respond_to?(). Those are two of the "caveats" I mentioned at the end of the original post. I considered mentioning them explicitly, but the post is long enough already.

comment 16y ago · link · parent

(From the original poster): You're right that I mischaracterized the diamond problem. I edited the post to fix that. My C++ mind model has been slipping away fast in part years. Definitely not like riding a bicycle.

comment 16y ago · link · parent

(From the OP): jknupp, I agree about that. I think that code reuse is one of the two reasons why people use inheritance in Java, but I don't think it's a very valid reason in general. Upcasting, on the other hand, definitely is. My point in the original post is that because Ruby doesn't have upcasting, then inheritance in Ruby becomes pretty marginal.