Posts

Showing posts from April, 2023

Scout Refactor & Complex Tramp Data

Image
   Scouts' Rule The Scouts have a rule, "Leave a place at least as clean as you found it."  The Scout Rule as adopted to refactoring applies this principle to code, if you touch the code and there's an opportunity to fix something, even if beyond the scope of your assignment, fix it. Some simple examples (focused on improving encapsulation): if a clause, method, or class isn't used or is used only be a unit test, delete it if a clause, method, or class is used only by another class, move it to that class and mark it private if a clause, method, or class is used only by another package, move it to that package and mark it protected Tramp Data One code smell that's somewhat common is Tramp Data .  Tramp Data is a when a method argument is simply passed to a sub-method without being directly visited or used.  When this happens several levels deep, it creates undue cognitive load as the developer has to hold onto the full call stack before identifying why/how the ...