1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#!/usr/bin/env bash
#
# @license Apache-2.0
#
# Copyright (c) 2017 The Stdlib Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Computes a basic constructive cost model (COCOMO 81).
#
# Notes:
#
# - COCOMO 81 is meant to include design, specification, review, and management overhead associated with producing quality software.
# - COCOMO 81 was created to model large institutional projects which may not reflect the nature of distributed open-source projects.
#
# References:
#
# - [COCOMO](https://en.wikipedia.org/wiki/COCOMO)
# Determine root directory:
root="$(git rev-parse --show-toplevel)"
# Define the path to a utility to compute the number of non-empty lines per file:
nonempty_lines_per_file="${root}/tools/git/scripts/nonempty_lines_per_file"
# Compute the cost model...
"${nonempty_lines_per_file}" | awk '
BEGIN {
# Model coefficients:
a_b = 2.4
b_b = 1.05
c_b = 2.5
d_b = 0.38
# Assume a ratio of 1:9 delivered code (pkgs) to support code (tests, examples, benchmarks):
loc_sf = 0.1;
# Average annual developer salary (USD):
salary = 55000
}
$1 ~ /JavaScript/ {
loc += $2
}
END {
sloc = loc * loc_sf
kloc = sloc / 1000
# Compute the required effort in "man-months":
effort_applied = a_b * kloc^b_b
# Compute the development time in months:
development_time = c_b * effort_applied^d_b
# Compute the number of people required:
people_required = effort_applied / development_time
# Compute the cost based on developer salary:
cost = people_required * salary * development_time/12
print "kloc" OFS kloc
print "development_time" OFS development_time
print "effort_applied" OFS effort_applied
print "people_required" OFS people_required
print "cost" OFS cost
}
'
|