Presentation is loading. Please wait.

Presentation is loading. Please wait.

November 2011CSC7302: Testing & MetricsHangMan-Refactoring.1 HangMan PBL - Refactoring Use your updated (best) version of Hangman (with a dictionary of.

Similar presentations


Presentation on theme: "November 2011CSC7302: Testing & MetricsHangMan-Refactoring.1 HangMan PBL - Refactoring Use your updated (best) version of Hangman (with a dictionary of."— Presentation transcript:

1 November 2011CSC7302: Testing & MetricsHangMan-Refactoring.1 HangMan PBL - Refactoring Use your updated (best) version of Hangman (with a dictionary of words). 1.Detect potential problems: a.Metric values out of bounds ? (Your code should pass this?) b.Poor object oriented design that gives off bad smells? (Your code probably wont pass this?) 2.Prepare a refactoring: a.Check the tests for the code to be refactored – i.Are all tests passed? ii.Is the coverage good (100%)? b.Is the documentation good? c.Submit/save current version before proceeding 3.Run the refactoring: Does the Eclipse IDE provide a refactoring for you to (partially) correct the problem? YES – use it and re-run application tests NO – check if some other tool exists YES – test the refactoring before use, use it and re-run application tests NO – check if some help for manual refactoring YES –test the refactoring before use, use it and re-run application tests NO – proceed with care 4.Check the problems have been removed/reduced.

2 November 2011CSC7302: Testing & MetricsHangMan-Refactoring.2 HangMan PBL - Refactoring 1.Detect potential problems: Useful plug-ins: a.Metric values out of bounds ? This metrics plugin calculates various code and design metrics for Java projects. In addition to metrics such as McCabe cyclomatic complexity and the dependency metrics of Robert Martin and many others, it also includes a graphical dependency analysis tool based on the dynamic hyperbolic graphing package TouchGraph. You should already have this installed

3 November 2011CSC7302: Testing & MetricsHangMan-Refactoring.3 HangMan PBL - Refactoring 1.Detect potential problems: Useful plug-ins: b.Poor object oriented design that gives off bad smells? inCode is source code analyzer that provides a continuous detection of several well-known design flaws (i.e. God Class, Feature Envy, Data Class and Significant Duplication) that are described in the "Object-Oriented Metrics in Practice" book (Springer, 2006). Furthermore the tool provides three helpful visualisations of (i) the entire system (System Complexity View), (ii) classes (Class Blueprint)and (iii) methods (Method Interaction). You can install this from: http://www.intooitus.com/products/incodehttp://www.intooitus.com/products/incode See : inCode: Continuous Quality Assessment and Improvement, Radu Marinescu, George Ganea and Ioana Verebi, LOOSE Research Group, Politehnica University of Timis¸oara, Romania

4 November 2011CSC7302: Testing & MetricsHangMan-Refactoring.4 HangMan PBL - Refactoring 2.Prepare a refactoring: a.Check the tests for the code to be refactored – i.Are all tests passed? ii.Is the coverage good (100%)? I use 2 coverage tools/plugins: EclEmma - http://www.eclemma.org/http://www.eclemma.org/ DJunit - http://works.dgic.co.jp/djunit/http://works.dgic.co.jp/djunit/ b.Is the documentation good? I hope you are using Javadocs? c.Submit/save current version before proceeding I hope you are using version control (svn, cvs?) TO DO: install and execute these coverage tools on your hangman code/tests

5 November 2011CSC7302: Testing & MetricsHangMan-Refactoring.5 HangMan PBL - Refactoring 3.Run the refactoring: Does the Eclipse IDE provide a refactoring for you to (partially) correct the problem? YES – use it and re-run application tests NO – check if some other tool exists YES – test the refactoring before use, use it and re-run application tests NO – check if some help for manual refactoring YES –test the refactoring before use, use it and re-run application tests NO – proceed with care Try and refactor your code (in whatever way you wish) so that you are happy with the quality of the design.

6 November 2011CSC7302: Testing & MetricsHangMan-Refactoring.6 HangMan PBL - Refactoring 4.Check the problems have been removed/reduced. It is almost certain that you will need to repeat the refactoring multiple times before you arrive at an acceptable design/implementation. Note that you may have to compromise with complex systems – it may not be possible/easy to pass all metric tests and/or get rid of all bad smells. It is best to stop refactoring when it looks like you will be going round in circles. Don’t forget to submit/save any version that improves the system whilst still passing all the tests (with good test coverage) Once you are happy with your Hangman solution we will move onto the next stage of development: using dictionaries from (standardised) files. This will lead us to examine: Coupling and cohesion Integration testing Regression testing


Download ppt "November 2011CSC7302: Testing & MetricsHangMan-Refactoring.1 HangMan PBL - Refactoring Use your updated (best) version of Hangman (with a dictionary of."

Similar presentations


Ads by Google