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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
#!/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 an intermediate constructive cost model (COCOMO 81) per package.
#
# 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 type per package:
nonempty_lines_per_file_type_per_pkg="${root}/tools/git/scripts/nonempty_lines_per_file_type_per_pkg"
# Compute the cost model...
PACKAGES_FILTER="${PACKAGES_FILTER}" "${nonempty_lines_per_file_type_per_pkg}" | awk '
BEGIN {
# Model coefficients:
a_i = 3.2
b_i = 1.05
c_b = 2.5
d_b = 0.38
# Effort adjustment factors:
RSR = 1.15 # required software reliability
SAD = 0.94 # size of application database
COP = 1.15 # complexity of product
RTPC = 1.00 # run-time performance constraints
MC = 1.00 # memory constraints
VVME = 0.87 # volatility of virtual machine environment
RTT = 0.87 # required turnabout time
AC = 0.86 # analyst capability
AE = 0.91 # applications experience
SEC = 0.86 # software engineer capability
VME = 1.00 # virtual machine experience
PLE = 0.95 # programming language experience
ASEM = 0.91 # application of software engineering methods
UST = 0.91 # use of software tools
RDS = 1.00 # required development schedule
effort_adjustment_factor = RSR * SAD * COP * RTPC * MC * VVME * RTT * AC * AE * SEC * VME * PLE * ASEM * UST * RDS
# 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
}
$6 ~ /JavaScript/ {
pkg = $1
loc = $3
sloc = loc * loc_sf
kloc = sloc / 1000
# Compute the required effort in "man-months":
effort_applied = a_i * kloc^b_i * effort_adjustment_factor
# 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 "package" OFS pkg
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
print ""
}
'
|