on experimenting refactoring tools to remove code smells xp 2015 workshop

25
On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Upload: emery-little

Post on 18-Jan-2018

218 views

Category:

Documents


0 download

DESCRIPTION

Experiment  Masters students to Refactor Project in qualitascorpus   4 refactoring tools

TRANSCRIPT

Page 1: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

On Experimenting refactoring tools to remove code smellsXp 2015 workshop

Page 2: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Introduction

Refactor = reusability, maintainability and readability

PG reluctant to refactor Does Tools helps?

Page 3: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Experiment

Masters students to Refactor Project in qualitascorpus http://qualitascorpus.com/

4 refactoring tools

Page 4: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Refactoring Tools

Eclipse IntelliJ IDEA

Commercial IDE Jdeodorant

Eclipse plugin only tools for smell detection and give suggestion step

for refactor RefactorIT

Commercial Eclipse plugin Analysis and refactor helper

Page 5: On Experimenting refactoring tools to remove code smells Xp 2015 workshop
Page 6: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Code Smell detect tools

iPlasma: free, detect 11 types of smells Jdeodorant: detect 4 types of smells InCode: comercial 10 code smell for C/C++/Java

Décor, CheckStyle, CodeProAnalytics, JBuilder

Page 7: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Code Smells

God Class, Brain Method, Brain Class, Data Clumps, Feature envy(class內聚性低 ), Intensive coupling, Long method, shotgun surgery, type checking

Page 8: On Experimenting refactoring tools to remove code smells Xp 2015 workshop
Page 9: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Which tool is more useful?

Page 10: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Eclipse

Can refactor most of smells Very user-friendly Can highly customized (high control on refactoring) Provide preview

Page 11: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

IntelliJ IDEA

Many refactor options Less customizable than eclipse(less control on how

to refactoring) Sometimes crashes

Page 12: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

RefactorIT

Similar to eclipse Less option than eclipse

Page 13: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

JDeodorant

Auto detect & auto refactor But sometimes cause more bug Some crashes occur If auto refactor PG may unfamiliar with new code.

Page 14: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Which smell easier to remove by tool?

Page 15: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Easeist

Feature Envy Method should be moved to where Supported by Jdeodorant

Intensive Coupling Also can be fixed by move

type checking Polymorphism or State/Strategy pattern Support by eclipse/ Jdeodorant

Page 16: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

hardest

God Class Brain Class

Page 17: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

which tool is more useful for each smells?

Page 18: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Brain/God class/method

Eclipse the best intelliJ

Less refactor option Jdeodorant

have some problem but provide useful guide

Page 19: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Data clumps

Eclipse/intelliJ extract class (group data together)

Page 20: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Feature Envy

Jdeoderant auto detect and refactor

other tools can also do refactor

Page 21: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Intensive coupling

RefactorIT, Eclipse, IntelliJ

Page 22: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Long method

Extract method refactoring Eclipse, IntelliJ, RefactorIT(no preview) Jdeodorant may have some error

Page 23: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Shotgun surgery

Eclipse > intelliJ for execution time, usability, preview

Page 24: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Type Checking

Best is eclipse (usually have no problem) Jdeoderant (less intuitive)

Page 25: On Experimenting refactoring tools to remove code smells Xp 2015 workshop

Summary Eclipse the best IntelliJ

Many refactor option and analysis But sometimes crash

Jdeodorant Auto detect and auto refactor But both have some problem

RefactorIT Used like eclipse but less option