Skip to content

Commit db78ec2

Browse files
committed
Add script to compute an intermediate constructive cost model
1 parent 289dff2 commit db78ec2

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Computes an intermediate constructive cost model (COCOMO 81).
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:
18+
nonempty_lines_per_file="${root}/tools/git/scripts/nonempty_lines_per_file"
19+
20+
#
21+
"${nonempty_lines_per_file}" | 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+
$1 ~ /JavaScript/ {
59+
loc += $2
60+
}
61+
62+
END {
63+
sloc = loc * loc_sf
64+
kloc = sloc / 1000
65+
66+
# Compute the required effort in "man-months":
67+
effort_applied = a_i * kloc^b_i * effort_adjustment_factor
68+
69+
# Compute the development time in months:
70+
development_time = c_b * effort_applied^d_b
71+
72+
# Compute the number of people required:
73+
people_required = effort_applied / development_time
74+
75+
# Compute the cost based on developer salary:
76+
cost = people_required * salary * development_time/12
77+
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+
}
84+
'

0 commit comments

Comments
 (0)