Skip to content

Commit 9849fc4

Browse files
committed
Add script to compute a constructive cost model per package
1 parent ddac26f commit 9849fc4

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Computes a basic 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_b = 2.4
25+
b_b = 1.05
26+
c_b = 2.5
27+
d_b = 0.38
28+
29+
# Assume a ratio of 1:9 delivered code (pkgs) to support code (tests, examples, benchmarks):
30+
loc_sf = 0.1;
31+
32+
# Average annual developer salary (USD):
33+
salary = 55000
34+
}
35+
36+
$6 ~ /JavaScript/ {
37+
loc = $3
38+
39+
sloc = loc * loc_sf
40+
kloc = sloc / 1000
41+
42+
# Compute the required effort in "man-months":
43+
effort_applied = a_b * kloc^b_b
44+
45+
# Compute the development time in months:
46+
development_time = c_b * effort_applied^d_b
47+
48+
# Compute the number of people required:
49+
people_required = effort_applied / development_time
50+
51+
# Compute the cost based on developer salary:
52+
cost = people_required * salary * development_time/12
53+
54+
print "package" OFS $1
55+
print "kloc" OFS kloc
56+
print "development_time" OFS development_time
57+
print "effort_applied" OFS effort_applied
58+
print "people_required" OFS people_required
59+
print "cost" OFS cost
60+
print ""
61+
}
62+
'

0 commit comments

Comments
 (0)