Presentation is loading. Please wait.

Presentation is loading. Please wait.

E L EARNING E NVIRONMENT FOR S OFTWARE E NGINEERING E DUCATION (R EFACTORING A GENT ) A.Stoyanova-Doycheva University of Plovdiv 23.11.2015 г. 10th Workshop.

Similar presentations


Presentation on theme: "E L EARNING E NVIRONMENT FOR S OFTWARE E NGINEERING E DUCATION (R EFACTORING A GENT ) A.Stoyanova-Doycheva University of Plovdiv 23.11.2015 г. 10th Workshop."— Presentation transcript:

1 E L EARNING E NVIRONMENT FOR S OFTWARE E NGINEERING E DUCATION (R EFACTORING A GENT ) A.Stoyanova-Doycheva University of Plovdiv 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 1

2 C ONTENT Introduction rLE Architecture and Implementation Refactoring Knowledge Base Conclusions 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 2

3 R EFACTORING A GENT 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. 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 3

4 RA F UNCTIONALITY 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. 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 4

5 Example: Refactoring Proposal (Dynamic HTML) 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 5

6 Example: Automatic Refactoring 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 6

7 Example: Refactoring questionary (Replace Type Code with State/Strategy) 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 7

8 I MPLEMENTATION 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. 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 8

9 RA A RCHITECTURE Refactoring Knowledge Base Refactoring Agent sensors effectors Local Control RAnalyzerRParser Refactoring classes BES (JADE)FES (IDE) Rules 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 9

10 RA K NOWLEDGE B ASE 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. 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 10

11 RA KB I MPLEMENTATION 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 11

12 RA KB P ATTERN P ACKAGE 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 12

13 A R EFACTORING M ETHOD I MPLEMENTATION (D ECOMPOSE C ONDITIONAL ) 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 13

14 R EFACTORING M ETHODS 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. 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 14

15 “A UTOMATIC R EFACTORING ” M ETHODS 1. Add Parameter 2. Change Bidirectional Association to Unidirectional 3. Consolidate Duplicate Conditional Fragments 4. Convert Dynamic to Static Construction 5. Convert Static to Dynamic Construction 6. Decompose Conditional 7. Encapsulate Downcast 8. Introduce Explaining Variable 9. Parameterize Method 10. Preserve Whole Object 11.Reduce Scope of Variable 12.Remove Assignments to Parameters 13.Remove Control Flag 14.Replace Assignment with Initialization 15.Replace Magic Number with Symbolic Constant 16.Replace Nested Conditional with Guard Clauses 17.Replace Parameter with Explicit Methods 18.Replace Static Variable with Parameter 19.Reverse Conditional 20.Self Encapsulate Field 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 15

16 “R EFACTORING P ROPOSAL ” M ETHODS 1. Introduce Null Object 2. Introduce Parameter Object 3. Replace Array with Object 4. Replace Constructor with Factory Method 5. Replace Conditional with Polymorphism 6. Replace Error Code with Exception 7. Replace Exception with Test 8. Replace Parameter with Method 9. Replace Recursion with Iteration 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 16

17 “R EFACTORING Q UESTIONARY ” M ETHODS 1. Replace Type Code with Class 2. Replace Type Code with State/Strategy 3. Replace Type Code with Subclass 23.11.2015 г. 10th Workshop SEERE 5-12.09.2010 17


Download ppt "E L EARNING E NVIRONMENT FOR S OFTWARE E NGINEERING E DUCATION (R EFACTORING A GENT ) A.Stoyanova-Doycheva University of Plovdiv 23.11.2015 г. 10th Workshop."

Similar presentations


Ads by Google