Re: Ambiguous Refactoring Solution
Hitesh Sajnani <[email protected]>
| Newsgroups | gmane.comp.programming.refactoring |
|---|---|
| Message-ID | <OF25FEE3D8.207D9A44-ON65257639.00228CF9-65257639.0022FEEE@tcs.com> |
Bryan, Re-factoring may be done for different motivation. Ofcourse, reuse is one of them. I definitely see a motivation in splitting a 613 lines of code. The motivation is the obvious ease in maintenance that will result because of the small class. I do understand that smaller size doesn't mean a compact functionality, but when you extract a class, the remaining code and extracted class itself are little more cohesive than they were before. Hitesh Sajnani "bryanedds" <[email protected]> Sent by: [email protected] 09/22/2009 11:38 AM Please respond to [email protected] To [email protected] cc Subject [refactoring] Ambiguous Refactoring Solution My issue is that I have a class that is 613 lines of C++ code. This is a very fat class, but it's moderately cohesive. I would like to refactor it to address the size issue. The problem is that I don't have a specific enough problem that the refactoring will solve. This seems to ambiguate the refactoring solution. For example, I could do an extract subclass. That would be a simple solution. Or, I could extract a strategy class that the original class delegates to. This is more complex, but will probably be more future proof. Or, I could extract a mediator class. There are many choices. Now, usually I have an immediately pressing context from which to derive a refactoring solution. That context is usually of reuse. I can ask myself, "how do I refactor this class in order to best facilitate reuse of its key elements?" The refactoring solution often very neatly falls out of the reuse context. Such a context is absent here. I could sit and theorize about what I would do in a future reuse context. But that seems to be irresponsibly speculative. Any one have any ideas on how to refactor when the usual driving forces are absent? - Bryan ForwardSourceID:NT0001B9FE =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you [Non-text portions of this message have been removed] ------------------------------------ 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: mailto:[email protected] mailto:[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/