Csontos Pter, Porkolb Zoltn - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

Csontos Pter, Porkolb Zoltn

Description:

Csontos P ter, Porkol b Zolt n. E tv s Lor nd Tudom nyegyetem, Budapest. ECOOP 2001 ... Uncaught exceptions and Class libraries ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 16
Provided by: peterc77
Category:

less

Transcript and Presenter's Notes

Title: Csontos Pter, Porkolb Zoltn


1
On the complexity of exception handling
  • Csontos Péter, Porkoláb Zoltán
  • Eötvös Loránd Tudományegyetem, Budapest
  • ECOOP 2001

2
Outline
  • Background of software metrics
  • Basics of the proposed complexity measure
  • Advanced issues and proposed solutions

3
Software complexity measures
  • Static complexity
  • Not algorithmic (run-time) complexity
  • Not function points
  • Based only on the source code of the program
  • Usage of software metrics
  • Measuring software quality
  • Estimating software development projects
  • Comparing frameworks, component libraries or
    other architectures
  • Test plan creation

4
Reasons of mesuring exception handling
  • Widespread usage in object-oriented programs
  • It cannot be avoided when dealing with OO
    programming
  • Not a separate complexity measure, just an
    integrated part of the basic metrics
  • Different behaviour in different programming
    languages
  • Non-structural nature in some cases increases
    the complexity of the program
  • Relatively few research has been there in this
    area

5
Outline
  • Background of software metrics
  • Basics of the proposed complexity measure
  • Advanced issues and proposed solutions

6
Evolution of the particular complexity measure
used
  • McCabe, 1976 Cyclomatic number (call-flow graphs
    and predicate count)
  • Harrison and Magel, 1981, Piwowarski, 1982
    Nested level (two ifs, one nested into the other
    are more complex, than two sequential ifs, etc.)
  • Fóthi and Nyéky-Gaizler, 1993 Handling of data
    (much closer to the exact size of the program)
  • Porkoláb, 1999 Object-orientation (abstract data
    types and inheritance)
  • Csontos and Porkoláb, 2001 Exceptions, language
    issues

7
Process of using the complexity measure
Complexity of the program
Sum up the complexity
Call flow graph with nodes labeled with nesting
level
Determine nesting level
Call-flow graph
Create call-flow graph
Syntax tree
Source code
Parsing the source code
8
Details on usageof our metrics
  • The call-flow graph of the program is created
  • Predicates and data handling (read and write
    instructions assignment, function parameters)
  • Throwing of an exception is also handled as a
    predicate node
  • Determining nesting level
  • The predicates (if, while, etc.) determine the
    nesting level of an instruction
  • The greater nesting level, the greater complexity
  • The data, as well as the predicates are added to
    the measure

9
Outline
  • Background of software metrics
  • Basics of the proposed complexity measure
  • Advanced issues and proposed solutions

10
Language- and compiler-dependent call-flow graphs
  • Different languages different semantics
    (call-flow graphs) for the same syntactic
    construct
  • C Weakly defined semantics in several cases
  • Implicit behaviour of programs can differ among
    different compilers or different modes of the
    same compiler (e.g. optimized or not)
  • Example aif()
  • Complexity measure the maximum value of the
    possible execution paths
  • It is needed to enumerate such cases
    (non-trivial, requires further research)

11
Possible call-flow graphsof the example statement
  • aif() // f() throws an exception

12
Freeing resources
  • Allocation of resources in a try block before
    hazardous function calls can be handled
    different ways
  • Java finally construct
  • C no finally construct, but several approaches
    exist to solve the issue
  • catch() construct the program is a bit more
    complicated and the complexity is greater (plus
    one function call and one explicit throw
    forwarding)
  • Separate Resource class with the allocation in
    the constructor and freeing in the destructor
    complexity is smaller if the resource is heavily
    used

13
Uncaught exceptions and Class libraries
  • Proprietary libraries, APIs the source code is
    not published
  • Just the interface is available
  • Measuring complexity of exception handling the
    internal implementation of a called function has
    relevance because of the implicit behaviour
  • Solution every theoretically possible exception
    handling path has to be measured and the
    complexities summed up
  • Java trivial, throws clause is mandatory
  • C non-trivial, throws clause is not mandatory
  • Not algorithmic (run-time) complexity
  • The unexpected() function is called implicitly
  • The complexity is greater (because of the plus
    function call)

14
Future directions
  • Measuring UML models
  • Comparing with function point metrics
  • Joint project of ELTE and IQSOFT
  • Measuring completed projects
  • Trying to use this measure for project estimation
  • Applying other ortogonal paradigms
  • Aspect-oriented programming
  • Generic programming
  • Functional programming
  • More language parsers for the tool
  • Java parser and automatic measurement tool is
    being completed
  • C, Eiffel, Ada, etc. parsers will be added

15
Questions
?
Write a Comment
User Comments (0)
About PowerShow.com