Skip to content
jesseDtucker edited this page Dec 3, 2013 · 1 revision

Jacob

All of these refactors were done by hand, except for interface extraction. I did not use JDeoderant because I prefer to refactor by hand, did not need to do much refactoring in the first place, and didn't even know what JDeoderant was (didn't go to the class or labs it was mentioned in).

  • Created Image object to handle bitmaps, then refactored all objects using bitmaps to use Image object.
  • Refactored WebStorage to use const String's for its queries. Allowed me to remove ElasticSearch library.
  • Extracted interfaces from WebStorage and StoryDb
  • Extracted index from ES.Client and moved it into WebStorage

Jesse

Views:

  • WebView: Originally implemented as a single class with multiple inner classes. As the WebView grew larger this became unmanageable so the WebView was migrated to a separate project and all the class were expanded out into their own files. This proved advantageous as the scope of the WebView increased it was easy to keep its code isolated from other view systems which did not interact with it.
  • FragmentView: Originally an activity; the view elements were re factored into an android fragment which was then shared between the author views and the browse views. Now the preview in the author view shares the full feature set of the view that will be seen by the reader.
  • ConnectionPlacer: The connection placer contains a general purpose A* pathfinding algorithm. However, to facilitate the building of multiple path types the construction of a path as well as the evaluation of whether or not the destination has been reached was re factored out to a general interface and different PathBuilders could be supplied. Each PathBuilder could have unique properties in how it evaluates a path between points.

Jdeodorant

JDeodorant was ran against our code base to analyze re factoring opportunities such as god classes and long methods. The results it produced were less than satisfactory. The tool incorrectly identified several data classes (most with only 100-200 lines, including imports and licence info) as god classes but missed a class (StoryManager) which could be considered to be a god class as it is responsible for all delegation of operations on the model. The long methods correctly identified longer methods but did not propose a satisfactory re factoring solution, and again suffered from inaccuracy as it identified many short methods (10 - 20 lines) as requiring re factoring. In several cases the boiler plate required to write the function signature would result in more code than leaving the methods as is. Overall the results produced by the tool were underwhelming and not helpful. A code review of the architecture and implementation would have produced much more helpful results.

Clone this wiki locally