elearning environment for software engineering education (refactoring agent)

17
ELEARNING ENVIRONMENT FOR SOFTWARE ENGINEERING EDUCATION (REFACTORING AGENT) A.Stoyanova-Doycheva University of Plovdiv 1 8 . 0 6 . 2 2 1 0 t h W o r k s h o p S E E R E 5 - 1 2 . 0 9 . 2 0 1 0 1

Upload: israel

Post on 05-Jan-2016

53 views

Category:

Documents


4 download

DESCRIPTION

eLearning Environment for Software Engineering Education (Refactoring Agent). A.Stoyanova-Doycheva University of Plovdiv. Content. Introduction rLE Architecture and Implementation Refactoring Knowledge Base Conclusions. Refactoring Agent. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: eLearning Environment for Software Engineering  Education (Refactoring Agent)

ELEARNING ENVIRONMENT FOR SOFTWARE ENGINEERING EDUCATION (REFACTORING AGENT)A.Stoyanova-Doycheva

University of Plovdiv

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

101

Page 2: eLearning Environment for Software Engineering  Education (Refactoring Agent)

CONTENT

Introduction rLE Architecture and Implementation Refactoring Knowledge Base Conclusions

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

2

Page 3: eLearning Environment for Software Engineering  Education (Refactoring Agent)

REFACTORING AGENT

The Refactoring Agent (RA) is a part from Refactoring Learning Environment, which is intended to analyze and assess programming code, based on refactoring rules.

The Refactoring Agent is responsible for the analysis and assessment of the code, written by students in real time by using a set of refactoring methods.

According to the situation and based on the refactoring method to be applied, the agent could react in different ways.

Its goal is to show the student, as much as possible, the weak places of their programming code and the possible ways to make it better.

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

3

Page 4: eLearning Environment for Software Engineering  Education (Refactoring Agent)

RA FUNCTIONALITY

Depending on the refactoring method, which should be applied, the agent could react in three different ways: To apply automatically the method after

receiving confirmation from the user; To display detailed instructions, explaining to the

user where and how the particular refactoring method should be applied;

To ask the user additional questions in order to clarify the conditions and define the appropriate refactoring method.

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

4

Page 5: eLearning Environment for Software Engineering  Education (Refactoring Agent)

Example: Refactoring Proposal (Dynamic HTML)2

0.0

4.2

31

0th

Work

shop S

EER

E 5

-12

.09

.20

10

5

Page 6: eLearning Environment for Software Engineering  Education (Refactoring Agent)

Example: Automatic Refactoring2

0.0

4.2

31

0th

Work

shop S

EER

E 5

-12

.09

.20

10

6

Page 7: eLearning Environment for Software Engineering  Education (Refactoring Agent)

Example: Refactoring questionary

(Replace Type Code with State/Strategy)

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

7

Page 8: eLearning Environment for Software Engineering  Education (Refactoring Agent)

IMPLEMENTATION As a development environment we chose Eclipse

It is open source It supports a powerful mechanism for interaction

with external components in the form of plugins. This could be considered as a significant advantage of this particular environment which simplifies the integration of the Refactoring Agent (RA) in the development environment.

The sensors and effectors of the agent are realized in JADE and they use existing plugins in Eclipse.

The agent itself is implemented by means of the JADE environment .

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

8

Page 9: eLearning Environment for Software Engineering  Education (Refactoring Agent)

RA ARCHITECTURE

Refactoring Knowledge Base

Refactoring Agent se

nsors

effecto

rs

Local Control

RAnalyzer RParser

Refactoring classes

BES (JADE) FES (IDE)

Rules

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

9

Page 10: eLearning Environment for Software Engineering  Education (Refactoring Agent)

RA KNOWLEDGE BASE

The RKB consists of a set of rules together with a set of classes, which build a consistent knowledge base.

The rules are implemented as Java code and are specific for each refactoring method.

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

10

Page 11: eLearning Environment for Software Engineering  Education (Refactoring Agent)

RA KB IMPLEMENTATION

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

11

Page 12: eLearning Environment for Software Engineering  Education (Refactoring Agent)

RA KB PATTERN PACKAGE2

0.0

4.2

31

0th

Work

shop S

EER

E 5

-12

.09

.20

10

12

Page 13: eLearning Environment for Software Engineering  Education (Refactoring Agent)

A REFACTORING METHOD IMPLEMENTATION (DECOMPOSE CONDITIONAL)

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

13

Page 14: eLearning Environment for Software Engineering  Education (Refactoring Agent)

REFACTORING METHODS

As а source – Martin Fowler’s book “Refactoring – Improving the Design of Existing Code”

We discovered а total of 32 methods that can be implemented in the Knowledge Base.

We still have 34 methods to investigate.

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

14

Page 15: eLearning Environment for Software Engineering  Education (Refactoring Agent)

“AUTOMATIC REFACTORING” METHODS1. Add Parameter2. Change Bidirectional

Association to Unidirectional

3. Consolidate Duplicate Conditional Fragments

4. Convert Dynamic to Static Construction

5. Convert Static to Dynamic Construction

6. Decompose Conditional7. Encapsulate Downcast8. Introduce Explaining

Variable9. Parameterize Method10. Preserve Whole Object

10. Preserve Whole Object11. Reduce Scope of Variable12. Remove Assignments to

Parameters13. Remove Control Flag14. Replace Assignment with

Initialization15. Replace Magic Number with

Symbolic Constant16. Replace Nested Conditional

with Guard Clauses17. Replace Parameter with

Explicit Methods18. Replace Static Variable with

Parameter19. Reverse Conditional20. Self Encapsulate Field

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

15

Page 16: eLearning Environment for Software Engineering  Education (Refactoring Agent)

“REFACTORING PROPOSAL” METHODS

1. Introduce Null Object 2. Introduce Parameter Object3. Replace Array with Object4. Replace Constructor with Factory Method5. Replace Conditional with Polymorphism6. Replace Error Code with Exception7. Replace Exception with Test8. Replace Parameter with Method9. Replace Recursion with Iteration

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

16

Page 17: eLearning Environment for Software Engineering  Education (Refactoring Agent)

“REFACTORING QUESTIONARY” METHODS

1. Replace Type Code with Class2. Replace Type Code with State/Strategy3. Replace Type Code with Subclass

20

.04

.23

10

th W

ork

shop S

EER

E 5

-12

.09

.20

10

17