320 likes | 446 Views
A style checker for JAVA and its application at HU. 25.08.05. Introduction How to use AssessStyle Experience at HU in WS 04 /05 and related work. Humboldt University Berlin 1st Semester. Introduction to object-oriented programming with Java: lectures: 64 hours
E N D
A style checker for JAVA and its application at HU 25.08.05 Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Introduction • How to use AssessStyle • Experience at HU in WS 04 /05and related work Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Humboldt University Berlin1st Semester • Introduction to object-oriented programming • with Java: • lectures: 64 hours • exercises on paper: 32 hours • lab work: Java programs about 200 students involved,3 students work as correctors Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
apply theprogram topreparedtest cases short manualinspection Javacompiler Students final grading covers correctness and programming style Assessment of Java programs at HU by correctors- assistance for correctors and students final grading - Java program programming style compilability correctness Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
apply theprogram topreparedtest cases short manualinspection Javacompiler ToolAssessStyle(since WS 04/05) Source:N. Rocca Diploma thesis, supervisor: K. Bothe Tool AssessStyle- assistance for correctors and students - Java program programming style compilability correctness Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
48 criterias (check types) of good programming style, e. g. Tool ‘AssessStyle‘: Style guide checks • missing empty line • missing white space • wrong indentation • switch without ‘default‘ • method too long • missing comment • too short identifiers • . . . criterias(check types) Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
48 criterias (checks) of good programming style in the fields, e. g. Tool ‘AssessStyle‘: Style guide checks • White spaces and other optical aspects, e.g. missing empty line missing white space wrong indentation • Statements, e. g. switch without ‘default‘ • Size, length, complexity, e. g. method too long • Comments, e. g. missing comment • Names and declarations, e. g. too short identifiers in additional, you can group criterias tomistake types Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
How to use AssessStyle • Introduction • How to use AssessStyle • Load Java program into the tool • Tool automatically checks for style guides • Some criteria are checked semi-automaticallyand some manually • Tool automatically computes a metric and a markaccording to conformance to style guidelines • Tool configuration • Experience at HU in WS 04 /05and related work Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Set of mistake types User interface of AssessStyle bad name D Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Set of mistake types Example of AssessStyle (1) D bad name D Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Example of AssessStyle (2) D D bad name Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Example of AssessStyle (3) D Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
How to use AssessStyle • Introduction • How to use AssessStyle • Load Java program into the tool • Tool automatically checks for style guides • Some criteria are checked semi-automaticallyand some manually • Tool automatically computes a metric and a markaccording to conformance to style guidelines • Tool configuration • Experience at HU in WS 04 /05and related work Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
search algorithms are implemented; they are applied generally There are tree kinds of checks: • automatic • semi automatic • manual search algorithms are implemented; the user decides on their application search algorithms are not implemented; the user can mark mistakes manually Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Example of AssessStyle - manual (1) K bad comment bad name Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
drag & drop K Example of AssessStyle - manual (2) K bad comment bad name Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
How to use AssessStyle • Introduction • How to use AssessStyle • Load Java program into the tool • Tool automatically checks for style guides • Some criteria are checked semi-automaticallyand some manually • Tool automatically computes a metric and a markaccording to conformance to style guidelines • Tool configuration • Experience at HU in WS 04 /05and related work Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
mark total number P 1 0 – 202 20 – 403 41 – 604 61 – 805 81 – 1006 > 100 Tool computes a metric P and a mark Parameters are: • The weight of particular mistake-types, e. g. missing comment 4 missing empty line 2 bad indentation 1 file too long 9 • The relation between the mark and the values of P P = h(f) * g(f) f F weight of error f number of errors f in 100 LOC Set of all mistake-types Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Tool has found these mistakes Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
How to use AssessStyle • Introduction • How to use AssessStyle • Load Java program into the tool • Tool automatically checks for style guides • Some criteria are checked semi-automaticallyand some manually • Tool automatically computes a metric and a markaccording to conformance to style guidelines • Tool configuration • Experience at HU in WS 04 /05and related work Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Tool configuration • Selection and configuration of a proper set of style errors for the lab (mistake types and detailed checks) • Weight of particular mistake types • Define the mark depending on the value of P Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Set of mistake types Tool configuration (1) you can configure all these with the tool Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
you can configure all these with the tool you can configure all these whith the tool total number P mark 0 – 20 120 – 40 241 – 60 361 – 80 481 – 100 5> 100 6 Tool configuration (2, 3) • Selection and configuration of a proper set of style errors for the lab (mistake types and detail checks) • Weight of particular mistake types, e. g. missing commend 4 missing empty line 2 bad indentation 1 file too long 9 • Define the mark depending on the value of P Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Introduction • How to use AssessStyle • Experience at HU in WS 04 /05and related work Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Experience at HU in WS 04 / 05 • used by correctors without too much effort • used by students as a pre-check of their solutions • accepted by correctors and students • programming style improved during the semester Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
a significant amount of students has a lot of style error points Programming style improved during the semester density (~students) style error points (P) Figure 1: first Java exercise Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Programming style improved during the semester now, almost all students have very few error points density (~students) style error points (P) Figure 2: third Java exercise Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Program Operating system GUI File TypesAim of application Related work: style check and style assessment AssessStyle independent yes Java display of style errors, assessment of style Checkstyle independent no Java display of style errors Artistic Style independent no C, C++, new formatting C#, Java JStyle windows yes Java display of style errors, metrics Praktomat web-interface web- Java, function tests and display interface C++ u. a. of style errors, manuell assisted assessment Jalote-Prog. ? ? C assessment of style Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Program Operating system GUI File TypesAim of application Related work: style check and style assessment AssessStyle independent yes Java display of style errors, assessment of style Checkstyle independent no Java display of style errors Artistic Style independent no C, C++, new formatting C#, Java JStyle windows yes Java display of style errors, metrics Praktomat web-interface web- Java, function tests and display interface C++ u. a. of style errors, manuell assisted assessment Jalote-Prog. ? ? C assessment of style • Very good, but • commercial (1000 dollar / licence) • no assessment • + metrics (e. g. Halstead, …) Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Program Operating system GUI File TypesAim of application Related work: style check and style assessment AssessStyle independent yes Java display of style errors, assessment of style Checkstyle independent no Java display of style errors Artistic Style independent no C, C++, new formatting C#, Java JStyle windows yes Java display of style errors, metrics Praktomat web-interface web- Java, function tests and display interface C++ u. a. of style errors, manuell assisted assessment Jalote-Prog. ? ? C assessment of style • It checks very many programming style criterias and • it is open source, but • no GUI • no assessment Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Program Operating system GUI File TypesAim of application Related work: style check and style assessment AssessStyle independent yes Java display of style errors, assessment of style Checkstyle independent no Java display of style errors Artistic Style independent no C, C++, new formatting C#, Java JStyle windows yes Java display of style errors, metrics Praktomat web-interface web- Java, function tests and display interface C++ u. a. of style errors, manuell assisted assessment Jalote-Prog. ? ? C assessment of style AssessStyle is an enhancement from Checkstyle! + GUI + assessment + manual checks + statistics, … Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin
Thank yu fr yur attentin! Baile Herculane, 28.8. – 3.9.2005 U. Sacklowski, Dept. of Comp. Sc., HU-Berlin