Most of my uses of reflection were before 'it mattered', i.e., as a student or as a hobbyist. I often feel lucky to have had ample time to screw up before getting into industry. Not that I won't screw up now, but hopefully I spot it quickly these days.
The uses of reflection I see at work are a) terrible b) hard to remove safely; in some cases the name of a class is not mentioned in code directly but actually built up in a StringBuilder. I think it's reasonable to ban it but with the understanding that it could be allowed if the team agreed that it was warranted. As for enforcement, if necessary I'm sure some CheckStyle rule could be created for that. Code review can catch a lot, but it's easy to miss something. I reviewed but completely missed the fact that 60 new lines of code were a direct copy from another class until 3 months later playing with IDEA's duplicates finder. Blame might be nice, but when the guy's gone, his boss has gone, the guy who hired his boss has gone and you're left with the shavings blame doesn't really help all that much. What does help is to remove the reflective code where possible and to introduce tests that will fail if the reflection gets screwed up otherwise. You might argue that the tests should be there first, but I'm sure you can appreciate that it's easier to add tests to code written with testing in mind than to a steaming pile. On Tue, Dec 7, 2010 at 11:53 PM, Liam Knox <[email protected]> wrote: > I would blame the interviewee process, training and the level of code > reviews and not globally cripple the use of a language based on the > improvement requirements. > > Not sure how they would enforce it anyway. > > > > On Wed, Dec 8, 2010 at 8:47 AM, Ricky Clarkson > <[email protected]>wrote: > >> I have, yes, but most if not all of mine were dumb and all the ones I >> encounter at work are worse. (not an insult to a co-worker, but to a guy I >> replaced). >> >> On Tue, Dec 7, 2010 at 11:45 PM, Liam Knox <[email protected]> wrote: >> >>> Never had a use for Reflection ? >>> >>> Bizarre. >>> >>> 2010/12/8 Cédric Beust ♔ <[email protected]> >>> >>> I was going to say the same thing... I don't find these guidelines >>>> shocking. >>>> >>>> -- >>>> Cédric >>>> >>>> >>>> On Tue, Dec 7, 2010 at 3:35 PM, Ricky Clarkson < >>>> [email protected]> wrote: >>>> >>>>> Sounds reasonable to me. >>>>> >>>>> >>>>> On Tue, Dec 7, 2010 at 11:22 PM, Liam Knox <[email protected]>wrote: >>>>> >>>>>> I have heard from several candidates that I have interviewed that >>>>>> Credit Suisse, on Java, forbid any use of Reflection by their developers >>>>>> and >>>>>> are anti-Spring. I really hope that this is not really a company wide >>>>>> policy >>>>>> for any company on the JCP. >>>>>> >>>>>> On Tue, Dec 7, 2010 at 10:56 PM, Miroslav Pokorny < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> How did Credit Suisse become a member of the JCP ? I assumed from >>>>>>> their name they are a bank, and as such produce a lot of inhouse custom >>>>>>> software but very little software for everyone else. For me this should >>>>>>> disqualify them, as their motives become purely selfish while a company >>>>>>> or >>>>>>> group, doing foss or selling software is actually part of the >>>>>>> mainstream and >>>>>>> not so focused. >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "The Java Posse" group. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> To unsubscribe from this group, send email to >>>>>>> [email protected]<javaposse%[email protected]> >>>>>>> . >>>>>>> For more options, visit this group at >>>>>>> http://groups.google.com/group/javaposse?hl=en. >>>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "The Java Posse" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]<javaposse%[email protected]> >>>>>> . >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/javaposse?hl=en. >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "The Java Posse" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]<javaposse%[email protected]> >>>>> . >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/javaposse?hl=en. >>>>> >>>> >>>> >>>> >>>> -- >>>> Cédric >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "The Java Posse" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]<javaposse%[email protected]> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/javaposse?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "The Java Posse" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]<javaposse%[email protected]> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/javaposse?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "The Java Posse" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<javaposse%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/javaposse?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<javaposse%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
