Sat May 23 12:22:23 HKT 2020
Refactoring to Patterns Catalog - http://www.industriallogic.com/xp/refactoring/catalog.html
Article talk about the book: http://www.oreillynet.com/ruby/blog/2006/03/transformation.html
Catagories smell into "smell in class" and "smell between class" - http://www.codinghorror.com/blog/archives/000589.html
Known but good to remind http://www.thecodejunkie.com[..]10/01/6-steps-to-master-refactoring.html
An experience sharing - http://www.javacodegeeks.com[..]m/2011/05/refactor-hudson-god-class.html http://www.peterprovost.org[..]treme-Refactoring-with-Brian-Button.aspx
Refactoring should not introduce bug... - http://jchyip.blogspot.com[..]01/so-why-are-you-refactoring-again.html
A way to have formal refactoring, through Feature Clustering, Rapid Scratch Refactoring and Twisting Classes - http://www.thekua.com[..]rom-michael-feathers-brutal-refactoring/
Not all code change is refactoring - http://parlezuml.com/blog/?postid=850 , and
Some common issues about refactoring code in a team - http://www.rickylui.com[..]/2008/01/28/dont-be-a-refactoring-bigot/ http://blog.joepoon.com[..]01/dangers-of-premature-refactoring.html , beware taking the balance - http://www.makinggoodsoftware.com[..]ith-beautiful-code-the-refactor-syndrome
Refactory if needed - http://dreamhead.blogbus.com/logs/24874404.html
Refactoring, when start, when stop? - http://martinfowler.com/bliki/OpportunisticRefactoring.html
Refactoring metric - http://www.grahambrooks.com[..]rics-based-refactoring-for-cleaner-code/
Getting rid of util class
1) If the family of methods uses different parameters, depending on optional input or representations of the same input, then consider transforming the Helper via a fluent interface using the Builder pattern: from a collection of static methods like Helper.calculate(x), calculate(x, y), calculate(x, z), calculate(y, z) we could easily get to something like newBuilder().with(x).with(y).calculate(). The helper class would then offer behaviours, reduce its list of business methods and provide more flexibility for future extensions. Callers would then use it as internal field for reuse or instantiate it where needed. The helper class (as we knew it) disappeared.
2) If the helper class provides methods which are actually actions for different inputs (but, at this point, for the same domain), consider applying the Command pattern: the caller will actually create the required command (which will handle the necessary input and offer a behaviour) and an invoker will execute it within a certain context. You may get a command implementation for each static method and your code would move from an Helper.calculate(x, y), calculate(z) to something like invoker.calculate(new Action(x, y)). Bye bye helper class.
3) If the helper class provides methods for the same input but different logics, consider applying the Strategy pattern: each static method may easily become a strategy implementation, vanishing the need of its original helper class (replaced by a context component then).
4) If the given set of static methods concerns a certain class hierarchy or a defined collection of components, then consider applying the Visitor pattern: you may get several visitor implementations providing different visit methods which would probably replace partially or entirely the previously existing static methods.
5) If none of the above cases met your criteria, then apply the three most important indicators: your experience, your competences in the given project and common sense.
Converting forloop to streaming - http://martinfowler.com/articles/refactoring-pipelines.html
code-refactoring-dos-donts - https://jaxenter.com/code-refactoring-dos-donts-135960.html
Let clean code guide you. Then let it go. - https://overreacted.io/goodbye-clean-code/ https://www.infoq.cn/article/dNO484YEeumvC6b6ZNWL
(google search) (amazon search)