Menu

#8 Feature envy and inner/anonymous classes

open
nobody
5
2009-03-12
2009-03-12
Anonymous
No

The "feature envy" counts can either take into account or not, thanks to a checkbox, access to one's superclass data.

I would like to see similar checkboxes for when an inner class or an anonymous class access data from its outer class.

The rationale is that most anonymous classes do nothing but use their outer class's data. They most often don't have fields of their own, and if they have more than one field they should probably not be anonymous. So I think the current "feature envy" warnings for anonymous class are misleading: this is actually good design.

For inner but non-anonymous classes, I'm not so sure -- but with a checkbox it should be easy enough to try both for a while and decide whether the warnings are justified or not.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.