On my personal project, I'm starting to use tons of interfaces and I got to thinking how nice it'd be to know which of my class' members serve which of its interfaces. For instance, my class might implement 5 different interfaces, but I only want to see the members that play a role in 1 of those.
Asked
Active
Viewed 87 times
0
-
What language are you using? Visual Studio has a code folding feature that can help with that as do others editors (notepad++). What platform are you using? – Oded Mar 08 '11 at 17:07
-
1That might be a call for redesign - too many responsibilities & collaborations in 1 class. CRC card should fit on one yellow sticker. Code sample would help to get a specific advice. – Victor Sergienko Mar 23 '11 at 09:38
-
I'd personally just group the IEat functions together and maybe put them between JavaDoc style comments if I wanted to remember which ones were part of that specific interface. – Adam Smith May 22 '11 at 21:38
3 Answers
1
I am not an Actionscript Expert and may tell complete nonsense, but from my Java experience most often gui classes implement hundreds of Listeners and Callbacks and many books teach to implement all these interfaces in your gui class. I prefer to implement these aspects in inner classes, so I can immediately see the methods called by that listener and methods do not get mixed up. Sorry that I cannot provide specific ActionScipt samples.

rurouni
- 2,315
- 1
- 19
- 27
-
1@Pup: That's exactly what you can do. ActionScript 3 does have [private classes](http://stackoverflow.com/questions/3594013/inner-class-in-as) (which are more less the equivalent of inner classes in Java). However unlike in Java, you don't need to implement an interface to listen for an event, because AS3 solves this with first order functions (somewhat like C#, only weakly typed (god knows why)). – back2dos May 24 '11 at 15:37
-
@back2dos: I don't understand how I could do this in ActionScript or even what the Java implementation would look like. I've opened up a new thread asking for an example here: http://stackoverflow.com/questions/6126636/example-of-inner-classes-used-as-an-alternative-to-interfaces – Pup May 25 '11 at 15:06
0
Flash Builder 4 has these purplish triangles in the left margin that will highlight interface implementations for you, but not filtered on any specific interface. You will get a tooltip on hover showing you the interface. Probably not good enough for your needs though.

frankhermes
- 4,720
- 1
- 22
- 39
-
This seems to be the closest popular feature on the market. IntelliJ also has a similar feature. – Pup May 23 '11 at 15:31
-
There are also other comparable features in many editors that help solve the same problem -- managing complexity of inheritance hierarchies. Things like UML diagram generation, and viewing a class' "outline" or "structure" as a list of methods and variables. – Pup May 23 '11 at 15:55