I’ve already written about the problem of code duplication when you don’t refactor Rails. A similar problem I see all the time is test duplication. Test Duplication As Rubyists, we are lucky to have unit testing deeply ingrained in our community. Many developers write tests, some even writing the tests first. But a big problem …
Tag: refactoring
Redmine Refactor #89: Extract Controller: IssueMovesController
With #move and #perform_move separated in the IssuesController, I can now see a clear path to using extract controller to move them to a new controller. (Extract controller is a Rails specific refactoring that is based on extract class). Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …
Redmine Refactor #88: Extract Method from move and perform_move
Now that #move and #perform_move are separated, I can start to refactor the duplication they share. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 class IssuesController false if …
Problems when you don’t Refactor Rails: Code Duplication
I’ve written about refactoring Redmine here but I feel I haven’t explained why refactoring is important. The most common reason is to remove code duplication. Code Duplication Code duplication occurs when an application has two sections of code that are identical or almost identical. Sometimes this happens because the application requires the duplication but most …
Redmine Refactor #87: Extract Method Body to IssuesController#perform_move
With this refactoring I start making some major changes to IssuesController#move and #peform_move. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 class IssuesController params, :issue => issue, :target_project => @target_project, :copy => !!@copy }) if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes …