|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# Computes an intermediate constructive cost model (COCOMO 81) per package. |
| 4 | +# |
| 5 | +# Notes: |
| 6 | +# |
| 7 | +# * COCOMO 81 is meant to include design, specification, review, and management overhead associated with producing quality software. |
| 8 | +# * COCOMO 81 was created to model large institutional projects which may not reflect the nature of distributed open-source projects. |
| 9 | +# |
| 10 | +# References: |
| 11 | +# |
| 12 | +# * [COCOMO](https://en.wikipedia.org/wiki/COCOMO) |
| 13 | + |
| 14 | +# Determine root directory: |
| 15 | +root="$(git rev-parse --show-toplevel)" |
| 16 | + |
| 17 | +# Define the path to a utility to compute the number of non-empty lines per file type per package: |
| 18 | +nonempty_lines_per_file_type_per_pkg="${root}/tools/git/scripts/nonempty_lines_per_file_type_per_pkg" |
| 19 | + |
| 20 | +# Compute the cost model... |
| 21 | +PACKAGES_FILTER="${PACKAGES_FILTER}" "${nonempty_lines_per_file_type_per_pkg}" | awk ' |
| 22 | +BEGIN { |
| 23 | + # Model coefficients: |
| 24 | + a_i = 3.2 |
| 25 | + b_i = 1.05 |
| 26 | + c_b = 2.5 |
| 27 | + d_b = 0.38 |
| 28 | +
|
| 29 | + # Effort adjustment factors: |
| 30 | + RSR = 1.15 # required software reliability |
| 31 | + SAD = 0.94 # size of application database |
| 32 | + COP = 1.15 # complexity of product |
| 33 | +
|
| 34 | + RTPC = 1.00 # run-time performance constraints |
| 35 | + MC = 1.00 # memory constraints |
| 36 | + VVME = 0.87 # volatility of virtual machine environment |
| 37 | + RTT = 0.87 # required turnabout time |
| 38 | +
|
| 39 | + AC = 0.86 # analyst capability |
| 40 | + AE = 0.91 # applications experience |
| 41 | + SEC = 0.86 # software engineer capability |
| 42 | + VME = 1.00 # virtual machine experience |
| 43 | + PLE = 0.95 # programming language experience |
| 44 | +
|
| 45 | + ASEM = 0.91 # application of software engineering methods |
| 46 | + UST = 0.91 # use of software tools |
| 47 | + RDS = 1.00 # required development schedule |
| 48 | +
|
| 49 | + effort_adjustment_factor = RSR * SAD * COP * RTPC * MC * VVME * RTT * AC * AE * SEC * VME * PLE * ASEM * UST * RDS |
| 50 | +
|
| 51 | + # Assume a ratio of 1:9 delivered code (pkgs) to support code (tests, examples, benchmarks): |
| 52 | + loc_sf = 0.1; |
| 53 | +
|
| 54 | + # Average annual developer salary (USD): |
| 55 | + salary = 55000 |
| 56 | +} |
| 57 | +
|
| 58 | +$6 ~ /JavaScript/ { |
| 59 | + pkg = $1 |
| 60 | + loc = $3 |
| 61 | +
|
| 62 | + sloc = loc * loc_sf |
| 63 | + kloc = sloc / 1000 |
| 64 | +
|
| 65 | + # Compute the required effort in "man-months": |
| 66 | + effort_applied = a_i * kloc^b_i * effort_adjustment_factor |
| 67 | +
|
| 68 | + # Compute the development time in months: |
| 69 | + development_time = c_b * effort_applied^d_b |
| 70 | +
|
| 71 | + # Compute the number of people required: |
| 72 | + people_required = effort_applied / development_time |
| 73 | +
|
| 74 | + # Compute the cost based on developer salary: |
| 75 | + cost = people_required * salary * development_time/12 |
| 76 | +
|
| 77 | + print "package" OFS pkg |
| 78 | + print "kloc" OFS kloc |
| 79 | + print "development_time" OFS development_time |
| 80 | + print "effort_applied" OFS effort_applied |
| 81 | + print "people_required" OFS people_required |
| 82 | + print "cost" OFS cost |
| 83 | + print "" |
| 84 | +} |
| 85 | +' |
0 commit comments