Re: Chatting about Extract Class
"K. Cassell" <[email protected]> Thu, 18 Mar 2010 20:05:41 -0000
| Newsgroups | gmane.comp.programming.refactoring |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], J Arrizza <cppgent0@...> wrote: > > Three basic ways: > > 1) ... look for associations between a subset of methods and > one (or perhaps a few) instance variables. ... > 2) Look for commonality in the method signatures... > 3) Sheer luck. I see a pattern in the names of the methods, or some > commonality in how they behave, or a commonality in the instance variables,... I like your list and explanation. These (especially 1) also correspond well with certain OO cohesion metrics. In addition to these, I can think of the following: 4) Parts of my class make calls out to a small set of external methods. For example, if only certain methods call methods in java.io.*, maybe these should be extracted. 5) External classes appear to call certain subsets of my class. Of these, I probably do 1, 3, and 4 the most. Of course, there is overlap, and this makes things easier. If you have methods with "write", "file", etc. in the names, and they have File arguments, and they make calls to java.io, and they all interact, and they all have comments "//TODO extract me into a new class" ;^) ..., then maybe extracting a class would be an especially good idea. ------------------------------------ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/refactoring/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/refactoring/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/