From: Panayotis K. <pan...@pa...> - 2011-05-26 16:11:16
|
On May 25, 2011, at 5:55 PM, Paul Poley wrote: > I'm going to go off on a tangent here, not really directed at this conversation, but somewhat relevant. > > My opinion is that reflection is a necessary evil that should be avoided whenever possible. One of the key words in that is "necessary." A great use of reflection is for web services or other generated code. And that equivalent is appropriately used in XMLVM. I believe it is okay in this type of situation because all parts using reflection are generated & not typed by hand. E.g. a web service is generated & a client is generated, so if an update occurs, we just regenerate. > > The "evil" part, in my opinion, comes when developers are manually typing method names & class names into Strings, thus avoiding the compiler. This is unfortunately not a rarity in the real world, such as in configuration files. My hope is that as annotations gain muster, they will help squash that practice where they can. > > I realize there are exceptions to what I just said, but I still try to avoid it at all costs. Since reflection is learned at a more advanced stage, it seems it is sometimes considered advantageous & advanced to use it, but I believe that to be a misconception. > > Anyways, I am not trying to contradict anything in this email chain, but rather just get on my soapbox about "evil" reflection & have a conversation in general. I'm interested if anyone has some other thoughts on this. > > Paul Exactly, this is the spirit of this change - to get rid of reflection. :) |