Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan...

35
Software Reuse & Software Reuse & Refactoring Refactoring By: Matthew Merricks By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    234
  • download

    0

Transcript of Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan...

Page 1: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software Reuse & RefactoringSoftware Reuse & RefactoringBy: Matthew MerricksBy: Matthew Merricks Brian SmithBrian Smith Ryan WaggonerRyan Waggoner

Page 2: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Overview of PresentationOverview of Presentation

IntroductionIntroduction Software ReuseSoftware Reuse Software RefactoringSoftware Refactoring Benefits and Problems with Benefits and Problems with

Software Reuse and RefactoringSoftware Reuse and Refactoring ConclusionConclusion

Page 3: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

IntroductionIntroduction

Increase in demand for software Increase in demand for software = Need for quicker and more = Need for quicker and more cost effective strategies for cost effective strategies for software developmentsoftware development

Page 4: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software ReuseSoftware Reuse

Opportunistic Reuse – Unplanned Opportunistic Reuse – Unplanned Reuse that is realized to be beneficial Reuse that is realized to be beneficial once a project has started.once a project has started. Internal Reuse – When programmers Internal Reuse – When programmers

reuse their own code.reuse their own code. External Reuse – When programmers External Reuse – When programmers

make use of code others have written.make use of code others have written. Planned Reuse – When code is Planned Reuse – When code is

written with intention to be used in written with intention to be used in the future.the future.

Page 5: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Types of Software ReuseTypes of Software Reuse

Abstraction - describes initial Abstraction - describes initial methods and definitions for the methods and definitions for the programmers to be able to build programmers to be able to build upon to achieve their objectives.upon to achieve their objectives.

Software Product Line - analyzes Software Product Line - analyzes the objectives and plans for the the objectives and plans for the code to be functional as well as code to be functional as well as adaptable and capable of adaptable and capable of evolution.evolution.

Page 6: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Types of Software ReuseTypes of Software Reuse

Cut-and-Paste Programming - Cut-and-Paste Programming - code is simply taken directly code is simply taken directly from one program and copied from one program and copied straight into another program.straight into another program.

Generic Programming - Generic Programming - deliberately writes fairly deliberately writes fairly ambiguous code that can be ambiguous code that can be adjusted by the programmer to adjusted by the programmer to suit their intentions.suit their intentions.

Page 7: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Benefits of ReuseBenefits of Reuse

Saves time, money, resources.Saves time, money, resources. Allows for the growth and Allows for the growth and

maximization of code. maximization of code. Code can be analyzed and Code can be analyzed and

improved when time comes to improved when time comes to be re-written.be re-written.

Popular method used in Popular method used in marketing and can be profitable marketing and can be profitable for businesses.for businesses.

Page 8: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software RefactoringSoftware Refactoring

Invented by Martin Fowler:Invented by Martin Fowler:

Page 9: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software RefactoringSoftware Refactoring

Fowler says, “Refactoring Fowler says, “Refactoring is a disciplined technique is a disciplined technique for restructuring an for restructuring an existing body of code existing body of code altering its internal altering its internal structure without structure without changing its external changing its external behavior.”behavior.”

Page 10: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software RefactoringsSoftware Refactorings

Extract Method – takes a clump Extract Method – takes a clump of code and turns it into a of code and turns it into a methodmethod

Inline Method – takes a method Inline Method – takes a method and replaces it with a body of and replaces it with a body of codecode

Inline Temp – replaces all Inline Temp – replaces all instances of a temp method instances of a temp method with the original methodwith the original method

Page 11: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software RefactoringsSoftware Refactorings

Introduce Explaining Variable – Introduce Explaining Variable – places a complicated expression places a complicated expression in a temporary variablein a temporary variable

Split Temporary Variable – Split Temporary Variable – renames a variable that is renames a variable that is assigned more than onceassigned more than once

Remove Assignment Parameters Remove Assignment Parameters – assigns parameters to a – assigns parameters to a temporary variabletemporary variable

Page 12: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software RefactoringsSoftware Refactorings

Replace Method with Method Replace Method with Method Object – turns a method into an Object – turns a method into an object so that the object can be object so that the object can be decomposed into different decomposed into different methodsmethods

Substitution Algorithm – Substitution Algorithm – substitutes an algorithm with a substitutes an algorithm with a clearer algorithmclearer algorithm

Page 13: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Time Performance Break Time Performance Break DownDown

Perf[Architecture]

Perf[Algorithm]

Perf[Coding]

Perf[Storage]

Perf[Processor]

More CPU[Processor]

Deeper pipeline[Processor]

Faster CPU frequency

[Processor]

Perf [Main Memory]

Perf[Cache]

Larger cache line[Cache]

More set associativity

[Cache]

Larger cache size[Cache]

Page 14: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Soft Goal ExampleSoft Goal Example

Soft Goal A

Soft Goal B

Soft Goal C

Soft Goal D

Soft Goal E

Soft Goal F

Soft Goal H

Soft Goal I

Soft Goal G

Soft Goal J

Soft Goal K

Soft Goal N

Soft Goal Q

Soft Goal R

Soft Goal P

Soft Goal O

Soft Goal L

Soft Goal M

Page 15: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Soft Goal ExampleSoft Goal Example

Soft Goal A

Soft Goal B

Soft Goal C

Soft Goal D

Soft Goal E

Soft Goal F

Soft Goal H

Soft Goal I

Soft Goal G

Soft Goal J

Soft Goal K

Soft Goal N

Soft Goal Q

Soft Goal R

Soft Goal P

Soft Goal O

Soft Goal L

Soft Goal M

Page 16: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Soft Goal ExampleSoft Goal Example

Soft Goal A

Soft Goal B

Soft Goal C

Soft Goal D

Soft Goal E

Soft Goal F

Soft Goal H

Soft Goal I

Soft Goal G

Soft Goal J

Soft Goal K

Soft Goal N

Soft Goal Q

Soft Goal R

Soft Goal P

Soft Goal O

Soft Goal L

Soft Goal M

Page 17: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Soft Goal ExampleSoft Goal Example

Soft Goal A

Soft Goal B

Soft Goal C

Soft Goal D

Soft Goal E

Soft Goal F

Soft Goal H

Soft Goal I

Soft Goal G

Soft Goal J

Soft Goal K

Soft Goal N

Soft Goal Q

Soft Goal R

Soft Goal P

Soft Goal O

Soft Goal L

Soft Goal M

Page 18: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Soft Goal ExampleSoft Goal Example

Soft Goal A

Soft Goal B

Soft Goal C

Soft Goal D

Soft Goal E

Soft Goal F

Soft Goal H

Soft Goal I

Soft Goal G

Soft Goal J

Soft Goal K

Soft Goal N

Soft Goal Q

Soft Goal R

Soft Goal P

Soft Goal O

Soft Goal L

Soft Goal M

Page 19: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Soft Goal ExampleSoft Goal Example

Soft Goal A

Soft Goal B

Soft Goal C

Soft Goal D

Soft Goal E

Soft Goal F

Soft Goal H

Soft Goal I

Soft Goal G

Soft Goal J

Soft Goal K

Soft Goal N

Soft Goal Q

Soft Goal R

Soft Goal P

Soft Goal O

Soft Goal L

Soft Goal M

Page 20: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Soft Goal ExampleSoft Goal Example

Soft Goal A

Soft Goal B

Soft Goal C

Soft Goal D

Soft Goal E

Soft Goal F

Soft Goal H

Soft Goal I

Soft Goal G

Soft Goal J

Soft Goal K

Soft Goal N

Soft Goal Q

Soft Goal R

Soft Goal P

Soft Goal O

Soft Goal L

Soft Goal M

Page 21: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Visual WorksVisual Works

Smalltalk IDE produced by Smalltalk IDE produced by CincomCincom

Features Smalllint, a style Features Smalllint, a style checker and bug detectorchecker and bug detector

Support continuous Support continuous modificationsmodifications

Can roll back to its initial stateCan roll back to its initial state

Page 22: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Visual WorksVisual Works

High degree of safety due to High degree of safety due to dynamic checking and user dynamic checking and user inputinput

Low effort tool because it can Low effort tool because it can automate the modifying of codeautomate the modifying of code

Does not include metrics of any Does not include metrics of any kindkind

Page 23: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

EclipseEclipse

Uses a Java Development Tool Uses a Java Development Tool (JDT)(JDT)

Uses partial recompilationUses partial recompilation Supports continuous changesSupports continuous changes A local applicationA local application Uses repositories to update codeUses repositories to update code Partially automated with the use Partially automated with the use

of the Refactoring Wizardof the Refactoring Wizard

Page 24: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

GuruGuru

Developed by Ivan Moore for the Developed by Ivan Moore for the SELFSELF

Used for restructuring Used for restructuring inheritance hierarchies and inheritance hierarchies and refactoring methodsrefactoring methods

Automatic tool with no user Automatic tool with no user interaction neededinteraction needed

Automatically generated object Automatically generated object and method namesand method names

Page 25: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

GuruGuru

Very low effort toolVery low effort tool Highly invasiveHighly invasive Global applicationGlobal application

Page 26: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Together Control CenterTogether Control Center

Created by TogetherSoftCreated by TogetherSoft Uses a refactoring menu Uses a refactoring menu Is a refactoring tool and a Is a refactoring tool and a

development environmentdevelopment environment Local applicationLocal application Offers versioning and undo Offers versioning and undo

capabilitiescapabilities Low effort toolLow effort tool

Page 27: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Facet Visual Works Eclipse Guru

Control Center

Time of Change T2, T3

Before T1 or T2 After T3

Before T1 or T2 After T3

Before T1 or T2 After T3

Change History Irrelevant

Parallel / Asynchronous

Unversioned Versioned

Frequency

Continuously

Continuously

Occasionally

Continuously

Distribution Local Local Local Local

Page 28: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Facet Visual Works Eclipse Guru

Control Center

Automation

Semi-Automatic

Semi-Automatic

Fully Automated

Semi-Automatic

Effect Alteration Any Alteration Any

Invasiveness

Non-Invasive Non-Invasive

Highly Invasive

Non-Invasive

Effort Low Effort Low EffortVirtually No Effort Low Effort

Page 29: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software Reuse: BenefitsSoftware Reuse: Benefits

Increased DependabilityIncreased Dependability Reduced Process RiskReduced Process Risk Effective Use of SpecialistsEffective Use of Specialists Standards ComplianceStandards Compliance Accelerated DevelopmentAccelerated Development

Page 30: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Software Reuse: ProblemsSoftware Reuse: Problems

Increased Maintenance CostsIncreased Maintenance Costs Lack of Tool SupportLack of Tool Support Not-Invented-Here SyndromeNot-Invented-Here Syndrome Creating and Maintaining a Creating and Maintaining a

Component LibraryComponent Library Finding, Understanding and Finding, Understanding and

Adapting Reusable ComponentsAdapting Reusable Components

Page 31: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Refactoring: BenefitsRefactoring: Benefits

Improves Design of SoftwareImproves Design of Software Makes Software Easier to Makes Software Easier to

UnderstandUnderstand Helps in Finding BugsHelps in Finding Bugs Helps to Program Faster (in the Helps to Program Faster (in the

long term)long term)

Page 32: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Refactoring: ProblemsRefactoring: Problems

Lack of Software Quality Lack of Software Quality ImprovementImprovement

Unreliability of Refactoring ToolsUnreliability of Refactoring Tools

Page 33: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

ConclusionConclusion

Use Software Reuse and Use Software Reuse and RefactoringRefactoring

But not BLINDLY!But not BLINDLY!

Page 34: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Works Cited IWorks Cited I Fowler, Martin. Fowler, Martin. Refactoring: Improving the Design of Refactoring: Improving the Design of

Existing CodeExisting Code. Boston, MA: Addison-Wesley, 2000.. Boston, MA: Addison-Wesley, 2000. Fowler, Martin. “What is Refactoring?” Fowler, Martin. “What is Refactoring?” Refactoring Refactoring

HomeHome. 1 Nov. 2007 <http://www.refactoring.com/>.. 1 Nov. 2007 <http://www.refactoring.com/>. Glynn, Erica, Strooper, Paul. “Evaluating Software Glynn, Erica, Strooper, Paul. “Evaluating Software

Refactoring Tool Support” In Refactoring Tool Support” In Software Engineering Software Engineering Conference. Conference. 18-21 April 2006. Melbourne, Vic.18-21 April 2006. Melbourne, Vic.

Jacobson, Ivar and Griss, Martin and Johsson, Patrik. Jacobson, Ivar and Griss, Martin and Johsson, Patrik. "Software Reuse: Architecture, Process and "Software Reuse: Architecture, Process and Organization for Business Success." Addison-Wesley Organization for Business Success." Addison-Wesley Professional(1997). Professional(1997).

Lim, Wayve C. "Managing Software Re-Use." Prentice Lim, Wayve C. "Managing Software Re-Use." Prentice Hall PTR(1998).Hall PTR(1998).

Mealy, E., Carrington, D., Strooper, P., Wyeh, P. Mealy, E., Carrington, D., Strooper, P., Wyeh, P. 2007. “Improving Usability of Software Refactoring 2007. “Improving Usability of Software Refactoring Tools” In Tools” In Software Engineering Conference. Software Engineering Conference. 10-13 10-13 April 2007. Melbourne, Vic. 307-318.April 2007. Melbourne, Vic. 307-318.

Page 35: Software Reuse & Refactoring By: Matthew Merricks Brian Smith Brian Smith Ryan Waggoner Ryan Waggoner.

Works Cited IIWorks Cited II Mens, Tom, and Tourwe, Tom. “A Survey of Software Mens, Tom, and Tourwe, Tom. “A Survey of Software

Refactoring.” IEEE Transactions on Software Refactoring.” IEEE Transactions on Software Engineering Vol. XX No. Y (2004) 1-3.Engineering Vol. XX No. Y (2004) 1-3.

Mili, Hafedh and Mili, Ali and Yacoub, Sherif, and Addy, Mili, Hafedh and Mili, Ali and Yacoub, Sherif, and Addy, Edward. "Reuse-Based Software Engineering: Edward. "Reuse-Based Software Engineering: Techniques, Organizations, and Controls." Wiley-Techniques, Organizations, and Controls." Wiley-Interscience(2001).Interscience(2001).

Mylopoulos, John, and Yu, Eric, and Yu, Yijun. “Software Mylopoulos, John, and Yu, Eric, and Yu, Yijun. “Software Refactoring Guided by Multiple Soft-Goals.” Not Refactoring Guided by Multiple Soft-Goals.” Not available. available.

Simmonds, J. and T. Mens, A comparison of software Simmonds, J. and T. Mens, A comparison of software refactoring tools, Technical Report vub-prog-tr-02-15, refactoring tools, Technical Report vub-prog-tr-02-15, Programming Technology Lab (2002).Programming Technology Lab (2002).

Sommerville, Ian. Sommerville, Ian. Software EngineeringSoftware Engineering. 8th ed. New . 8th ed. New York: Addison-Wesley, 2007. 63-91.York: Addison-Wesley, 2007. 63-91.

Spinellis, Diomidis, and Stroggylos. Konstantinos. Spinellis, Diomidis, and Stroggylos. Konstantinos. “Refactoring – Does it Improve Software Quality?” Fifth “Refactoring – Does it Improve Software Quality?” Fifth International Workshop on Software Quality (2007) 1-4. International Workshop on Software Quality (2007) 1-4.