-
Notifications
You must be signed in to change notification settings - Fork 6
Refactoring
ethanmykytiuk edited this page Apr 2, 2013
·
13 revisions
Running JDeodorant on our project gave us only one refactoring suggestion. This could have been due to the difference in the structure of our app (eclipse was showing lots of errors as well - likely due to missing libraries that we got from maven).
Some of the big refactoring we did :
- We made an AbstractRecipeActivity class. This class simply displays a recipe to the user. It's concrete implementations control whether the recipe is editable or simply viewable.
- Similarly we made an abstract RecipeGridFragment. It is re-used to display recipes from the network by NetworkGridFragment and recipes that are stored locally in LocalGridFragment.
- ImagepagerAdapter is now a super class that displays images in a view pager. It's subclass EditableImagePagerAdapter allows the user to add more images to the view pager.
- A util package that wraps logic used by multiple classes. Some of this includes BitmapUtils (to work with bitmaps).
- Abstract AsyncTasks are used extensively when model communicates with the view and controller. When the view request data from the model, the model returns a cached version and kicks of an async task to update the view. Extensions of this AsyncTask are also triggered when the controller updates the model, so views are automatically notified on new content, without writing any repeated code.