An Empirical Comparison of Modularity of Procedural and

An Empirical Comparison Of Modularity Of Procedural And-Free PDF

  • Date:09 Jan 2020
  • Views:146
  • Downloads:0
  • Pages:10
  • Size:212.23 KB

Share Pdf : An Empirical Comparison Of Modularity Of Procedural And

Download and Preview : An Empirical Comparison Of Modularity Of Procedural And


Report CopyRight/DMCA Form For : An Empirical Comparison Of Modularity Of Procedural And


Transcription:

more modularity However a surprising result is that C thousand lines of code as a measure of the number. programs do not exhibit more modularity than C of modules The size of modules was calculated as. programs We theorize that this indicates that 1 the the number of lines of code per module. benefits of object oriented programming are derived 2 The average number of parameters per module is. primarily from the design rather than the use of a smaller for object oriented programs than for. particular language and 2 many C programmers are procedural programs. not following a true object oriented design, 2 Experimental Design The tools described previously were used to measure. the number of modules number of lines of code per, This experiment analyzed 38 applications Ten module and number of parameters per module. applications were written in Fortran ten in C ten in C Descriptive statistics were calculated for the number of. and eight in Java Fortran and C are procedural lines of code per module and the number of parameters. languages while C and Java are object oriented per module. languages Most applications were obtained as open, source code arbitrarily selected from those available on 3 1 Experiment 1 Module Size Comparison. the Internet however finding open source Fortran, applications was difficult and only three were found The The number of lines of code per module was. first author had access to several Fortran applications that determined for 38 applications 10 in each of Fortran C. had been developed in house and seven of these were and C and 8 in Java The number of modules and. included to bring the count to ten The appendix lists the lines of code LOC per module were determined as well. programs used and where they were obtained The as the minimum maximum mean median mode and. applications that were investigated are of a variety of standard deviation of the lines of code per module 3 8. different types Combining the results from a number of 9 In addition the number of modules per thousand lines. different application types for each language should of code KLOC was also calculated This metric was. provide results that can be extrapolated to the general used to normalize the measure of number of modules per. case However it would also be interesting to compare application for comparison between applications of. applications of the same type Since web server different sizes The tabulated results for the applications. applications were available that had been written in C written in Fortran C C and Java are displayed in. C and Java an additional comparison was made Tables 1 through 4. between the three of them, Several tools were used to analyze the programs 3 2 Experiment 2 Number of Parameters.
selected The author created a tool to extract the number. of lines of code per module and the number of parameters. As noted in the Introduction a module is defined to. per module for Fortran programs Understand for C,be a function procedure or method The number of. Scientific Toolworks Inc www scitools com was used. parameters per module was determined for the same 38. to count the number of lines of code per method in C and. applications The minimum maximum mean median, C programs Scientific Toolworks also provided a perl. mode and standard deviation of the number of parameters. script to extract the number of parameters per method. were calculated The tabulated results for applications. from the database files that their tool created JStyle. written in Fortran C C and Java are displayed in,Man Machine Systems www mmsindia com was used. Tables 5 through 8 respectively, to determine the number of lines of code per method in. Java programs JStyle provides an integrated scripting. capability that the author used to extract the number of 4 Analysis. parameters passed per method, Fenton and Pfleeger 3 point out that the mean median.
This experiment investigated two hypotheses and mode of the data will be the same in a normal. distribution An examination of the collected data clearly. 1 Object oriented programs have more smaller shows that they do not form normal distributions. modules than procedural programs Since the Therefore normal parametric statistical analyses such as. programs investigated are not all the same size it linear regression and the t test cannot be applied. was decided to use number of modules per, Table 1 Module size comparison for applications written in Fortran. LOC module, Application Modules Total LOC Mean Min Max Median Mode Std Dev Mod KLOC. advsrc 22 829 37 7 3 274 13 4 65 0 26 5,anypia 216 5453 25 3 1 436 12 6 49 1 39 6. booster 26 398 15 3 3 122 9 5 10 23 8 65 3,fdwell 16 626 39 1 9 62 41 50 15 9 25 6. image 35 1434 41 0 3 146 19 6 45 1 24 4,lowtran 93 5585 60 1 2 718 21 12 99 1 16 7.
mlsc 115 7831 68 1 2 812 32 9 100 5 14 7,plume 43 901 21 0 4 62 18 4 18 2 47 7. quail 240 9816 40 9 1 264 27 11 42 3 24 4,simfence 563 28199 50 1 1 3489 25 4 156 3 20 0. All applications 1369 61072 44 6 1 3489 21 4 112 0 22 4. Table 2 Module size comparison for applications written in C. LOC module, Application Modules Total LOC Mean Min Max Median Mode Std Dev Mod KLOC. apache 1689 49239 29 2 0 636 15 4 44 3 34 3,chemtool 234 9993 42 7 4 983 17 8 93 9 23 4. gcompris 365 9861 27 0 0 451 13 9 40 7 37 0,gdpc 76 2864 37 7 3 587 7 4 87 6 26 5.
gperiodic 120 3124 26 0 0 404 10 7 46 7 38 4,gstat 1276 34904 27 4 2 961 16 5 49 2 36 6. gsx 87 3308 38 0 4 503 16 4 65 0 26 3,mutt 1214 48124 39 6 0 1267 19 8 74 5 25 2. umfpack 97 12518 129 1 0 828 80 13 160 4 7 7,xpaint 865 22138 25 6 1 253 15 5 31 4 39 1. All applications 6023 196073 32 6 0 1267 16 7 59 6 30 7. Table 3 Module size comparison for applications written in C. LOC module, Application Modules Total LOC Mean Min Max Median Mode Std Dev Mod KLOC. amaya 5641 258718 45 9 0 1937 24 4 75 3 21 8,benson 70 1100 15 7 0 103 10 5 4 19 3 63 6.
btl2 389 4487 11 5 0 88 8 2 12 9 86 7,celestia 1014 14472 14 3 0 364 5 4 28 1 70 1. gperf 100 2920 29 2 1 339 12 5 1 52 2 34 2,guarddog 89 1597 17 9 0 228 7 3 32 6 55 7. knetfilter 139 5007 36 0 2 212 17 2 44 3 27 8,ktouch 126 1766 13 8 1 142 5 4 22 1 71 3. pi3web 2113 41023 19 4 0 680 8 0 41 9 51 5,skysight 2954 89175 30 2 0 6914 11 4 229 9 33 1. All applications 12635 420265 33 4 0 6914 14 4 124 3 30 1. Table 4 Module size comparison for applications written in Java. LOC module, Application Modules Total LOC Mean Min Max Median Mode Std Dev Mod KLOC.
ArtOfIllusion 2993 41022 13 7 0 602 3 1 31 5 73 0,bugbase 1143 7511 6 6 0 223 1 1 14 3 152 2. ConsultComm 158 1485 9 4 0 205 2 1 21 2 106 4, jakarta tomcat 5669 41433 7 3 0 312 1 1 17 0 136 8. jCharts 370 2120 5 7 0 72 1 1 10 4 174 5,jext 3296 33155 10 1 0 906 2 1 33 2 99 4. jigsaw 7427 55710 7 5 0 308 2 1 13 8 133 3,mercator 3428 11926 3 5 0 126 1 1 7 7 287 4. All applications 24484 194362 7 9 0 906 2 1 20 6 126 0. Table 5 Number of parameters per module in Fortran programs. Parameters Module, Application Modules Mean Min Max Median Mode Std Dev.
booster 26 3 0 1 7 3 2 1 5,fdwell 16 6 0 2 19 5 4 4 2. image 35 7 4 1 18 7 6 4 7,lowtran 93 4 1 0 17 3 2 3 1. mlsc 115 2 9 0 34 2 2 4 1,plume 43 4 9 1 18 4 1 4 2. simfence 563 4 1 0 18 4 3 2 7,advsrc 22 1 7 0 7 1 1 1 6. quail 240 3 5 0 27 3 0 3 9,anypia 216 1 4 0 8 1 0 1 7.
All applications 1369 3 6 0 34 3 3 3 3, Table 6 Number of parameters per module in C programs. Parameters Module, Application Modules Mean Min Max Median Mode Std Dev. apache 1689 2 3 0 10 2 2 1 4,chemtool 234 2 2 0 11 2 2 1 9. gcompris 365 1 3 0 14 1 1 1 5,gperiodic 120 1 5 0 14 1 1 1 7. gstat 1276 2 2 0 11 2 2 1 7,gsx 87 1 8 0 5 2 2 2 0.
mutt 1214 2 5 0 14 2 1 1 8,xpaint 865 2 5 0 10 2 3 1 5. gdpc 76 2 2 0 17 2 2 1 9,umfpack 97 4 6 0 16 3 2 3 7. All applications 6023 2 3 0 17 2 1 1 7, Table 7 Number of parameters per module in C programs. Parameters Module, Application Modules Mean Min Max Median Mode Std Dev. btl2 389 1 3 0 15 1 1 1 7,celestia 1014 1 3 0 40 1 0 2 0.
gperf 100 1 1 0 6 1 0 1 4,guarddog 89 0 9 0 4 1 1 0 9. knetfilter 139 0 4 0 2 0 0 0 7,ktouch 126 0 8 0 6 0 0 1 3. amaya 5641 2 6 0 21 2 1 2 2,benson 70 1 4 0 6 1 1 1 2. pi3web 2113 1 6 0 12 1 0 1 6,skysight 2954 2 3 0 14 2 1 1 9. All applications 12635 2 2 0 40 2 1 2 0, Table 8 Number of parameters per module in Java programs.
Parameters Module, Application Modules Mean Min Max Median Mode Std Dev. ArtOfIllusion 2993 1 4 0 25 1 1 1 9,bugbase 1143 0 9 0 13 1 0 1 1. ConsultComm 158 0 7 0 4 1 1 0 8,jakarta tomcat 5669 0 9 0 11 1 0 1 1. jCharts 370 1 0 0 7 1 0 1 4,jext 3296 0 8 0 7 1 0 1 0. jigsaw 7427 1 0 0 7 1 0 1 1,mercator 3428 0 5 0 7 0 0 0 8.
All applications 6023 0 9 0 25 1 0 1 2, A major purpose of this experiment is to investigate. 4 1 Analysis of Module Size Comparison whether object oriented programs have more modules. that are smaller than those in similarly sized procedural. An examination of the data in Tables 1 through 4 programs Comparing the size of the modules is. shows noticeable variation among the individual straightforward The average size of the object oriented. applications and between those written in the different modules 16 6 lines of code is slightly less than half. programming languages It is likely that there is a 47 the size of the procedural modules 34 8 lines of. significant variation in lines of code per module across code Comparing the number of modules cannot be done. the entire population of programs Combining the results directly because of the differences in sizes of the. from the object oriented applications and from the applications To normalize the data the number of. procedural applications may provide results that are modules per thousand lines of code is instead used as the. representative of the general case Table 9 summarizes metric for comparison The number of modules per. the aggregated data while Figure 1 provides a graphical thousand lines of code for the object oriented applications. comparison of the module sizes for the object oriented is just over twice 210 the number for the procedural. procedural Java C C and Fortran applications applications These results support the idea that object. oriented applications are more modular than procedural. applications,Table 9 Summary of module size comparison. LOC Module, Language Modules Total LOC Mean Min Max Median Mode Std Dev Mod KLOC. Procedural 7392 257145 34 8 0 3489 17 4 72 4 28 7, Object oriented 37121 614627 16 6 0 6914 5 1 75 4 60 4. object oriented,procedural,0 10 20 30 40 50,LOC Module.
Figure 1 Graphical comparison of module size, Since three of the applications examined are web thousand lines of code which is used as a normalized. servers written in three different languages it might be measure of the number of modules per application is also. instructive to compare their results As they were all quite similar 30 1 vs 30 7 This suggests that the C. written for the same purpose they might be more similar programs that were examined were no more modular than. to each other than to the other programs examined Table the C programs Two complementary theories may. 10 compares the results for these three applications As explain this Although C supports object oriented. can be seen there is more difference between the two programming it does not strongly encourage the. object oriented applications C and Java than there is programmer to use an object oriented approach as does. between the C application and the C application It is Java Additionally many C programmers are re trained. not obvious therefore that comparing similar applications C programmers who have had little or no exposure to OO. is any more useful than comparing dissimilar applications concepts and thus cannot be expected to use the OO. An examination of the overall results for the four language features effectively These two related. languages given in Table 11 shows that the average size observations may indicate that these C applications. of the C applications investigated is very close to that may not have been written using an object oriented. of the C applications examined 33 4 LOC module vs approach. 32 6 LOC module Correspondingly the modules per, Table 10 Comparison of three web server applications. LOC Module, Language Application Modules Total LOC Mean Min Max Median Mode Std Dev Mod KLOC. C apache 1689 49239 29 2 0 636 15 4 44 3 34 3,C pi3web 2113 41023 19 4 0 680 8 0 41 9 51 5. Java jigsaw 7427 55710 7 5 0 308 2 1 13 8 133 3,Table 11 Module size summary.
LOC Module, Language Modules Total LOC Mean Min Max Median Mode Std Dev Mod KLOC. Fortran 1369 61072 44 6 1 3489 21 4 112 0 22 4,C 6023 196073 32 6 0 1267 16 7 59 6 30 7. C 12635 420265 33 4 0 6914 14 4 124 3 30 1,Java 24484 194362 7 9 0 906 2 1 20 6 126 0. 4 2 Analysis of Number of Parameters, Examination of Tables 5 8 indicates a significant number of parameters was 1 3 but the mode was 0 For. variability in the number of parameters per module Table the procedural programs the mean was 2 5 with a mode. 12 summarizes the data for the applications written in the of 1 Thus the procedural programs averaged. four languages and also shows the aggregated summary approximately twice as many parameters per module as. for the procedural and object oriented applications Not the object oriented. Understand for C Scientific Toolworks Inc www scitools com was used to count the number of lines of code per method in C and C programs Scientific Toolworks also provided a perl script to extract the number of parameters per method from the database files that their tool created JStyle Man Machine Systems www mmsindia com was used

Related Books