-
Notifications
You must be signed in to change notification settings - Fork 4
JDeodarant Refactoring
varsis edited this page Dec 2, 2013
·
31 revisions
-
Move Method com.uofa.adventure_app.controller.WebServiceController::httpWithType(com.uofa.adventure_app.controller.http.HttpObject):java.lang.String com.uofa.adventure_app.controller.http.HttpObject
- This method does not belong in an object. It uses the object to load from the internet, but an object should not be aware of how it is used. -
Move Method com.uofa.adventure_app.activity.StoryActivity::openFragement(com.uofa.adventure_app.model.Fragement):void com.uofa.adventure_app.model.Fragement
- Open Fragement is used in an activity, it has nothing to do with the object. -
Move Method com.uofa.adventure_app.controller.http.HttpObjectStory::publishObject(com.uofa.adventure_app.model.Story):com.uofa.adventure_app.controller.http.HttpObject com.uofa.adventure_app.model.Story
- A object Story should not have to know how to publish an object -
Move Method com.uofa.adventure_app.activity.BrowserActivity::fetchStory(com.uofa.adventure_app.model.Story):void com.uofa.adventure_app.model.Story
- This has nothing to do with the object.
- com.uofa.adventure_app.activity.StoryActivity public void helpToast() helpText B1 0/8
- Long due to setting static text, can't do much about it. - com.uofa.adventure_app.activity.EditFragementActivity protected void onCreate(android.os.Bundle) authors B3 0/7
com.uofa.adventure_app.activity.EditStoryActivity protected void onCreate(android.os.Bundle) authors B3 0/7
- Implemented Created new Method authorString() that reduces the size of the Method. Put in AdventureActivity.java - com.uofa.adventure_app.model.Story public com.uofa.adventure_app.model.Story localCopy() c B7 0/7
- Long method due to Deep Copy, Extracting method would cause more issues, and moves algorithm code around making it harder to understand. - com.uofa.adventure_app.activity.EditFragementActivity public void save() currentFragement B1 0/5
- is already a method, JDeodarant highlighted entire method. - com.uofa.adventure_app.activity.BrowserActivity public void newStory() newFragement B1 0/3
- Specific to the Activity, and creates a new story and sets the activity textView. Extracting moves specific lines of code to another method and make it harder to read. - com.uofa.adventure_app.activity.FirstRunOnlyActivity public void okClicked(android.view.View) username B1 0/3
- Implemented. Move Username to a getter method. - com.uofa.adventure_app.activity.AnnotateActivity public void saveAnnotation() newAnnotation B1 0/2
- This creates a new Annotation for the Next Cycle. Creates more and less readable code. 2 Lines of code only called once. - com.uofa.adventure_app.activity.EditFragementActivity public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo) counter B1 1/8
- Implemented Moved looping to it's own method. void addFragmentsToMenu() in EditFragementActivity. - com.uofa.adventure_app.adapter.StoryGridAdapter public android.view.View getView(int, android.view.View, android.view.ViewGroup) authors B1 3/10
- Implemented Moved author string generate method authorString in StoryGridAdapter() - com.uofa.adventure_app.activity.FirstRunOnlyActivity public void okClicked(android.view.View) id B1 5/12
- Implemented Extracted to getUserId() in FirstRunOnlyActivity. - com.uofa.adventure_app.activity.AnnotateActivity protected void onActivityResult(int, int, android.content.Intent) newAnnotation B1 3/16
- Attempted Try catches are different and was causing more issues. Makes more sense to leave them seperate, since they perform different Tasks. - com.uofa.adventure_app.adapter.CustomListViewAdapter public android.view.View getView(int, android.view.View, android.view.ViewGroup) holder B1 1/4
- Not sure what the problem is? - com.uofa.adventure_app.activity.BrowserActivity public boolean onOptionsItemSelected(android.view.MenuItem) helpText B5 2/7
- Implemented Extracted Method to toastHelp(). - com.uofa.adventure_app.model.Media public static android.graphics.Bitmap resizeImage(android.graphics.Bitmap) scale B1 1/3
- Not useful to extract method. - com.uofa.adventure_app.activity.EditFragementActivity public boolean onOptionsItemSelected(android.view.MenuItem) helpText B4 2/6
- Implemented Extracted Method to toastHelp(). - com.uofa.adventure_app.activity.EditStoryActivity public boolean onOptionsItemSelected(android.view.MenuItem) helpText B3 2/5
- Implemented Extracted Method to toastHelp(). - com.uofa.adventure_app.activity.AnnotateActivity protected void saveTextForView(android.view.View, java.lang.String) newAnnotation B1 2/4
- Does not make sense. - com.uofa.adventure_app.activity.StoryActivity public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo) counter B1 2/4
- Counter used below, and will complicate code. - com.uofa.adventure_app.activity.BrowserActivity public void dataReturn(ArrayList<com.uofa.adventure_app.model.Story>, java.lang.String) currentStory B1 7/10
- Implemented Extracted methods from if statements in data return. Created getFragementData() and getStoryData().
Most items returned was a Activity and was asking to remove functionality from the view.
Nothing returned.