Because I blew a few code smell name quiz questions yesterday, I'm going to do a code smell name a day in the order they are listed in the "Bad Smells in Code" chapter of Fowler's refactoring book. #CodeSmellReview
1) Duplicated code: "Number one in the stink parade" 😂 Whether it's the same expression in the same method, the same class, related subclasses or totally unrelated classes, there are various ways to refactor and encapsulate that duplicate code. (p.77) #CodeSmellReview
2) Long method: As @jbogard described last night in his refactoring presentation for http://meetup.com/indysa , if you're scrolling & scrolling, it's time to break that method apart. MANY ways to refactor & he proved @resharper is truly up to the task! (p.77-78) #CodeSmellReview
3) Large class: Another maybe obvious one. One interesting red flag: too many instance variables. Long class can also lead to duplicate code. Some refactorings for this are extract class, extract sub-class or even an interface. (p.78) #CodeSmellReview
4) Long parameter list: me looking at my 20+ year old VB6 app! That's how we did it back in the day. Uggh. In many cases, creating a DTO (data transfer object) to encapsulate that data is a great option. Just be wary of coupling & make an explicit choice. (p.78) #CodeSmellReview
5) Divergent changes: That 1 area of your app that's constantly evolving & for every change u have to hunt across your solution to find the same 7 classes that need to be tweaked! This is a code smell - an invitation to consider how the logic is organized. (p.79 #CodeSmellReview)
(update...I'm not doing this once a day as planned. Surprise! But I will eventually get them all on this thread! ) #codeSmellReview
You can follow @julielerman.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.