3 ms·
And the new dynamic support in C# gives it a direct equivalent to method_missing.
by city41 16y ago
And the new dynamic support in C# gives it a direct equivalent to method_missing.
- nusco 16y agoFrom 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?
- jfager 16y agoI haven't seen them used much in any of the open source Java projects I'm familiar with, I agree. We used them fairly extensively at my previous job, though, for implementing a mix-in pattern for boilerplate-free service endpoints, and they worked nicely. Outside of that, I use them al the time during development to add quick-and-dirty method call tracing when I'm trying to debug something. I personally think that they're very much underused, and having based an interview question on them for a while, not well-known at all.