Bad smells, Design Patterns, and Refactoring Michael Weiss 322005 - PowerPoint PPT Presentation

About This Presentation
Title:

Bad smells, Design Patterns, and Refactoring Michael Weiss 322005

Description:

'Bad smells', Design Patterns, and Refactoring. Michael ... 'Bad smell': how not to do it. Design Pattern: how to do it. Refactoring: getting from (a) to (b) ... – PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 7
Provided by: micha497
Learn more at: https://www.cs.umb.edu
Category:

less

Transcript and Presenter's Notes

Title: Bad smells, Design Patterns, and Refactoring Michael Weiss 322005


1
Bad smells, Design Patterns, and
RefactoringMichael Weiss3/2/2005
2
Three related topics
  • Common problems in programming
  • Bad smell how not to do it
  • Design Pattern how to do it
  • Refactoring getting from (a) to (b)

3
Duplicated Code
  • Bad smell Fowler, p. 76.
  • Design patterns (Jia, p.253 256)
  • Method invocation
  • Inheritance
  • Delegation
  • Refactoring
  • Extract method (Fowler p.76, and Eclipse)
  • Pull up method (Fowler p. 322, and Eclipse)
  • Extract class (Fowler p. 149 Eclipse)

4
Duplicated Code ? Method
  • class A

method1 compute1 compute2 compute3
method2 compute1 compute2 compute3
problem local variables
5
Duplicated Code ? Inheritance
  • class A

method1 compute1 compute2 compute3
class B
method2 compute1 compute2 compute3
6
Duplicated Code ? Delegation
class A
method1 helper.computeStuff()
class Helper
computeStuff compute1 compute2 compute3
helper
class B
method2 helper.computeStuff()
helper
Write a Comment
User Comments (0)
About PowerShow.com