Refactoring Log - CMPUT301W13T03/classproject GitHub Wiki
Many of jdeodorant's suggestions were obviously incorrect. For example, in feature envy, it suggested moving the code for initializing a button into Recipe.java. Suggestions like these were easy to disregard.
There were also changes that seemed trivial, such as splitting the functionality of Camera.java so that one class would have the code for generating a bitmap and one class would have the code for sending a photo generating intent. For cases like these, we felt that splitting was unjustified because it created more complication for no significant reason.
##Our changes
- Split the long onCreate method for AddRecipeActivity into smaller methods. This should make it easier to find specific button code.
- Split the ingredientMatch method in RecipeManager into two smaller methods, and changes some variable names. This was done to make it easier to understand what the method does and how it works.
- Split the generateID method into two methods. This was done to help distinguish between how the ID is generated (using the current date), and the act of converting it to an int.
- Moved the attachPhotoFileToRecipe method from RecipeManager to recipe. It seems more sensible and simple for a Recipe to know how to convert a file to a RecipePhoto and then attach it to itself. It wasn't like this before because originally the method had to be able to order a save, but due to our new database system this is no longer necessary.