Gordana Rakić, Zoran Budimac

33
SMIILE Finaly COBOL! and what else is new Gordana Rakić, Zoran Budimac

description

SMIILE Finaly COBOL! and what else is new. Gordana Rakić, Zoran Budimac. Contents. Last year... Motivation (why we did it) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work. Last year. - PowerPoint PPT Presentation

Transcript of Gordana Rakić, Zoran Budimac

Page 1: Gordana Rakić, Zoran Budimac

SMIILEFinaly COBOL!

and what else is new

Gordana Rakić, Zoran Budimac

Page 2: Gordana Rakić, Zoran Budimac

Contents Last year... Motivation (why we did it) Related work (what others did) Description (how we did it) Example (how does it work) Conclusion and results. Future work

Page 3: Gordana Rakić, Zoran Budimac

Last year• First prototype of “universal” software metrics tool

• Characteristics– Platform independency

• Developed in Java Programming Language

– Application range • Two programming languages (Modula-2 and Java)• Two software metrics (CC and LOC)

– Annotated syntax tree based source code and metric values representation - enables

• Source code and metric values history • Language independency of the tool

Page 4: Gordana Rakić, Zoran Budimac

ContentsLast year…

Motivation (why we did it)

Related work (what others did)

Description (how we did it)

Example (how does it work)

Conclusion and results.

Future work

Page 5: Gordana Rakić, Zoran Budimac

…Motivation…• Many techniques/tools are appropriate for only one programming language or for one

type of programming languages

• Support of object-oriented metrics is still weak

• Many techniques/tools compute numerical results with no real interpretation of their meanings

• There are no hints and advices what typical actions should be taken in order to improve the software

• The technique/tool should discourage cheating

• Current techniques/tools are not sensitive to the existence of additional code

• Sometimes is not clear which specific software metric have to be applied to accomplish the specific goal.

• PLUS

– Platform dependency

– Support for other metrics

– History of source code

– History of calculated metrics

Page 6: Gordana Rakić, Zoran Budimac

ContentsLast year …

Motivation (why we did it)

Related work (what others did)

Description (how we did it)

Example (how does it work)

Conclusion and results.

Future work

Page 7: Gordana Rakić, Zoran Budimac

Related work

• Review of software metric tools available for usage

– Based on testing

• Review of available literature

– Based on• research papers

• available development and product documentation

Page 8: Gordana Rakić, Zoran Budimac

Review conclusion

Practice needs new tool which

• Is platform independent

• Is programming language independent

• Calculates broad specter of metrics

• Supports keeping of source code history

• Supports keeping of calculated values of software metrics

Page 9: Gordana Rakić, Zoran Budimac

Contents

Last year…

Motivation (why we did it)

Related work (what others did)

Description (how we did it)

Example (how does it work)

Conclusion and results.

Future work

Page 10: Gordana Rakić, Zoran Budimac

Description

• The tool description

• Background of universality

• Support for metrics and lanaguages

Page 11: Gordana Rakić, Zoran Budimac

Parser Generators

• Tool used for generation of language translators

• Input

– language grammar

• Output

– Language scanner

– Language parser

+ Intermediate representation of language constructions

!syntax trees!

Page 12: Gordana Rakić, Zoran Budimac

Syntax Trees• Syntax Trees

– Intermediate structure produced by • parser generator directly

• translator generated by parser generator

• Represent

– language in abstract form

– concrete source code

– concrete source code elements attached to corresponding abstract language elements

Page 13: Gordana Rakić, Zoran Budimac

Syntax Trees (2)• Classification of Syntax trees used in this thesis

– Abstract Syntax Tree (AST) represents concrete source code

– Concrete Syntax Tree (CST) represents concrete source code elements attached to corresponding abstract language elements

– Enriched Concrete Syntax Tree (eCST) • Represents concrete source code elements attached to

corresponding abstract language elements

• Contains additional information - universal nodes as markers for language elements figuring in metric algorithms

Page 14: Gordana Rakić, Zoran Budimac

Description

• The tool description

• Background of universality

• Support for metrics ad languages

Page 15: Gordana Rakić, Zoran Budimac

Background of universality

• Enriched Concrete Syntax Tree (eCST)

– Generated by Parser generator• Generation is based on programming language grammar

• Enrichment is based on modification of programming language grammar by adding universal nodes into tree

– Stored to XML structure• Enrichment does not effect structure of the tree

– Only content of the tree is affected by these changes

Page 16: Gordana Rakić, Zoran Budimac

Structure of the eCST

Page 17: Gordana Rakić, Zoran Budimac

Content of the CST and eCSTUniversal Nodes

IF parenthesizedExpression ifStat = statement(ELSE elseStat = statement -> ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat))

^(BRANCH ELSE $elseStat))| -> ^(BRANCH_STATEMENT IF ^(BRANCH ^(IF parenthesizedExpression $ifStat))))

Page 18: Gordana Rakić, Zoran Budimac

Information flow trough the tool

Page 19: Gordana Rakić, Zoran Budimac

Description

• The tool description

• Background of universality

• Support for metrics and languages

Page 20: Gordana Rakić, Zoran Budimac

Current state• In current prototype

– metrics • Cyclomatic Complexity – CC (by predicate counting)• Lines of Code – LOC (by filled lines counting)

– Programming languages • Java• Modula 2 • COBOL

– All calculations and tree transformations in one pass through code

• XML eCST is large for multiple parsing

Page 21: Gordana Rakić, Zoran Budimac

Adding support for new Programming Language

if (support for new PL is needed) then

begin

modify existing grammar* of new PL (add universal nodes);

generate parser;

add new element in Languages XML structure

end

____________________________________________*Different grammars are supported by different parser generators. As we use ANTLR parser generator in this prototype grammar of new language should be LL(*)

Page 22: Gordana Rakić, Zoran Budimac

Universal nodes that do not directly affect CC metric

Node \ Language JAVA MODULA-2 COBOL

COMPILATION_UNIT Class MODULE PROGRAM

CONCRETE_UNIT_DECL Concrete Class (IMPLEMENTATION) MODULE

PROCEDURE DIVISION

FUNCTION_DECL Method Declaraton PROCEDURE Procedure

Declaration

MAIN_BLOCK - BEGIN (Of Main Block ) MAINLINE

CONDITION Start of Condition In Branch Statement Or Loop

BRANCH_STATEMENT

Start of Branch Statement (each part will be additionally marked with BRANCH node)

e.g. switch e.g. case e.g. EVALUATE

Page 23: Gordana Rakić, Zoran Budimac

Universal nodes that directly affect CC metric Node \ Language JAVA MODULA-2 COBOL

BRANCH

ifelse

?:

case defaultcatch

IFELSIF ELSECASE

WHENEND-OF-PAGE

(ON) EXCEPTIONINVALID KEY

(ON) OVERFLOW(ON) SIZE ERROR

IF

JUMP_STATEMENT

breakreturn

continuethrow(s)

EXITRETURN

STOPEXIT

GO-TOGO-BACK

LOOP_STATEMENT

forwhile

repeatdo-while

FORWHILEREPEATLOOP

VARYINGTIMES

PERFORM-UNTIL

LOGICAL_OPERATOR&& ||

ANDOR

ANDOR

ALSO

Page 24: Gordana Rakić, Zoran Budimac

JUMP_STATEMENT open questions

• Return, break,...

– Are these statements always the jumps?

• GO_TO (and similar statements)

– Could it be improved (maybe by involving the enriched Control Flow Graph - eCFG)?

– Could we distinguish:• JUMP_TO_BACK

• JUMP_TO_FORWARD

Page 25: Gordana Rakić, Zoran Budimac

Adding support for new Software Metrics

if (support for new Software Metrics is needed) then

begin

determine corresponding new universal nodes;

modify grammars for all supported languages;

regenerate language parsers;

add attribute for storing new metric in XML structure

for storing metric values;

add software metric algorithm implementation in measure class

end

Page 26: Gordana Rakić, Zoran Budimac

Contents

Last year…

Motivation (why we did it)

Related work (what others did)

Description (how we did it)

Example (how does it work)

Conclusion and results.

Future work

Page 27: Gordana Rakić, Zoran Budimac

Example

Not today

• For now we used only small example to test grammar and parser, and generation of universal nodes

• It is hard to find appropriate example implemented in all three languages in order to compare results

Page 28: Gordana Rakić, Zoran Budimac

Contents

Last year…

Motivation (why we did it)

Related work (what others did)

Description (how we did it)

Example (how does it work)

Conclusion and results.

Future work

Page 29: Gordana Rakić, Zoran Budimac

Results and conclusion

• Motivation and background for development of new software metrics tool which is

– Is platform independent

– Is programming language independent

– Calculates broad specter of metrics

– Supports keeping of source code history

– Supports keeping of calculated values of software metrics

Page 30: Gordana Rakić, Zoran Budimac

Results and conclusions (2)• Developed prototype of new software metrics tool

which is

– Developed in PL Java

• is platform independent

– Developed to support two input PLs

• Is not programming language independent but base for it is sited

– This year we made one step forward

– Developed to support two Software Metrics

• Specter of metrics is not broad but base for it is sited

– Supports keeping of source code history

– Supports keeping of calculated values of software metrics

! It analyzes single compilation unit stores to single input file

Page 31: Gordana Rakić, Zoran Budimac

Contents

Last year…

Motivation (why we did it)

Related work (what others did)

Description (how we did it)

Example (how does it work)

Conclusion and results.

Future work

Page 32: Gordana Rakić, Zoran Budimac

Future work

• Adding support for additional PLs– Ancient PLs – COBOL(almost done) and Fortran ?!

• JUMPS are still open questions here !!!• Support for COBOL is to be tested !!!

• Adding support for additional Software Metrics– For OO metrics relationships between compilation units are

needed !

• Interpret calculated metric values– Represent them graphically– Interpret their meaning in order to provide useful information

to the user

Page 33: Gordana Rakić, Zoran Budimac

Thank you

Hvala