Comparing programming paradigms - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Comparing programming paradigms

Description:

The SML code took a total of 39 hours to test , compared with only 19 hours for the C code. ... to run the test cases from the command line compared to C . ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 26
Provided by: GOP7
Category:

less

Transcript and Presenter's Notes

Title: Comparing programming paradigms


1
Comparing programming paradigms
  • an evaluation of functional and object-oriented
    programs

2
Contents
  • Introduction
  • Measuring software quality
  • Method
  • Data collection
  • Analysis and results
  • Efficiency
  • Discussion
  • Conclusion

3
Introduction
  • To investigate whether the quality of code
    produced using a functional language is
    significantly different from that produced using
    an object-oriented language.
  • Establish a baseline of quality indicators to
    measure the quality.

4
Measuring software quality
  • Our aim is to quantify the quality of the
    delivered code.
  • Two kinds of attributes of the code. External and
    internal product attributes of the code.
  • External attributes are difficult to quantify.
  • Establish two sets of measurements during
    software development process.

5
Measurements
  • Development metrics. (KE,TKE,MR,TMR,SC)
  • Code metrics or suggestive indicators. (length,
    the number of functions called ,the number of
    functions declared).
  • Code metrics are collated and tested for
    correlation against the development metrics.

6
Measurements
  • Significant correlations were detected for many
    of the suggested indicators .in particular , the
    number of non comment source lines was found to
    be closely correlated to the development metrics
    for both paradigms.

7
Measurements
  • In addition to the number of distinct functions
    called ,the number of domain-specific functions
    called and the number of function definitions
    were found to be correlated to the number of
    modification requests for both paradigms.

8
Method
  • During this research , 12 sets of algorithms were
    developed together with a number of utility
    function in both SML and C. The algorithms are
    from the image analysis domain.

9
Method
  • 3.1 Application domain
  • We required a domain that demanded a range of
    data types , good file handling facilities and
    significant input/output and user-interface
    facilities.
  • It also had to provide a range of algorithms of
    different complexities ,and ideally needed to be
    a domain in which we already had significant
    software engineering expertise.

10
Method
  • This led us to image analysis.
  • The field of image analysis covers wide variety
    of different types of algorithm.
  • The algorithms encoded in such a way that they
    can be combined and recombined in various
    experimental arrangements that eventually lead
    to efficient and practical image applications.

11
Method
  • 3.2 Reducing bias
  • Chose a developer , who had comparable experience
    of programming with both SML and C, and could
    program competently with both the languages , but
    had used a neither language within the chosen
    application domain before the start of the
    project.
  • Developer implements different kind of algorithms
    in both languages by switching between them,
    which reduces the confounding effects of
    different variables.

12
Data collection (DMS)
13
Data collection (cms)
14
Analysis and results
  • The aim of this analysis is to determine whether
    there is a significant difference in the quality
    of code produced using functional and
    object-oriented languages.
  • The statistically significant differences are
    listed below, together with the percentage
    differences which the SML programs exhibited for
    the overall totals.

15
Analysis and results
  • The time taken to test the programs,105 more.
  • The number of known errors per 1000 ncsl,156
    more.
  • The number L of library functions called ,
  • 285more. L/N, a measure of reuse,
  • 142 more.
  • The number of function declarations ,9 fewer.

16
Analysis and results
  • Development metrics.
  • The SML code took a total of 39 hours to test ,
    compared with only 19 hours for the C code.
    This is due to the compiler executable object
    code which can be run from the command line,
    where as the complete SML system must be reloaded
    to run tests written in SML. Another reason is
    the number of test cases were run .(253 for
    SML,158 for C), this may be due to larger
    number of functions called.
  • The longer testing time is also due in part to
    the larger number of known errors that were found
    in the SML.

17
Development metrics
  • d) The number of known errors 41 in SML compared
    with 16 in C. The analysis showed that 59 of
    the SML errors were associated with function
    calls.
  • e) There were no statistically significant
    differences in the following development metrics
    KE,MR,DT,SC, time to fix the faults and make
    changes.
  • The time to fix the known errors was 30 less in
    SML compared to C. that means may be the errors
    found in SML are less severe than C.
  • The SML may increase the programmer productivity
    through the improvement in compiler efficiency.

18
Code metrics
  • There were no statistically significant
    differences in five of the seven suggested
    indicators ( ncsl, N, D , depth and def).
  • Although not statistically significant , some
    differences were apparent SML programs needed
    28 fewer ncsl and defined 61 more functions.
  • Both N and D were correlated to the number of
    modification requests for both paradigms.

19
Code metrics
  • There were significant differences in the number
    of library functions called . This can be
    correlated to qualitytype development metrics.
  • The metric L/N,the ratio of the number of
    distinct library functions called to the total
    number of distinct functions called, showed a
    statistically significant difference.
  • This metric L/N(reuse) should lie between 0 and
    1.

20
Efficiency
  • No special attempts were made to optimize any of
    the programs developed , as this may affect the
    quality of the code, and the extent of the
    optimization would be difficult to monitor.

21
Efficiency ( execution times)
  • The SML system reloaded every time to run the
    test cases from the command line compared to C.
  • The majority of the differences in execution
    times can be explained by the choice of data
    structures used to hold the image data.
  • An image was packed as an ADT (graphs) in SML and
    as a class in C.
  • The SML implementation stores the image as a list
    of lists, where each list represents a row of
    pixel values.
  • The C class included member functions which
    provide facilities for the direct storage and
    retrieval of individual pixels. (uses dynamic
    memory allocation and pointers).

22
Efficiency (compilation times)
  • The SML compilation times are greater than C
    compilation times. Moreover, SML does not include
    the time for garbage collection.

23
Discussion
  • Advantages

24
Disadvantages
25
Conclusion
  • No statistically significant differences found in
    development metrics ,except for the length of the
    testing time. (SML takes twice as long as to test
    as that written using C)
  • The number of known errors per thousand ncsl.
  • In code metrics , we found few differences.
    Nearly four times as many library functions were
    called in the SML than in C code.
  • SML reflected one and a half times as much reuse
    as the C code. Due to the number of list
    processing functions.
Write a Comment
User Comments (0)
About PowerShow.com