Skip to content

COCOMO工作量估计模型#

目录#

1. 背景#

最近在《软件协同设计》课程中学习了COCOMO工作量估计模型,在此进行总结。

2. 概述#

构造性成本模型(COCOMO,Constructive Cost Model)是由巴里·勃姆(Barry Boehm)提出的一种软件成本估算方法。这种模型使用一种基本的回归分析公式,使用从项目历史和现状中的某些特征作为参数来进行计算。从本质上说是一种参数化的项目估算方法,参数建模是把项目的某些特征作为参数,通过建立一个数字模型预测项目成本。

3. 定义#

GeeksforGeeks的一篇博客中摘取COCOMO模型的内容。

Cocomo (Constructive Cost Model) is a regression model based on LOC, i.e number of Lines of Code. It is a procedural cost estimate model for software projects and often used as a process of reliably predicting the various parameters associated with making a project such as size, effort, cost, time and quality. It was proposed by Barry Boehm in 1970 and is based on the study of 63 projects, which make it one of the best-documented models.

The key parameters which define the quality of any software products, which are also an outcome of the Cocomo are primarily Effort & Schedule:

  • Effort: Amount of labor that will be required to complete a task. It is measured in person-months units.
  • Schedule: Simply means the amount of time required for the completion of the job, which is, of course, proportional to the effort put. It is measured in the units of time such as weeks, months.

Different models of Cocomo have been proposed to predict the cost estimation at different levels, based on the amount of accuracy and correctness required. All of these models can be applied to a variety of projects, whose characteristics determine the value of constant to be used in subsequent calculations. These characteristics pertaining to different system types are mentioned below.

Boehm’s definition of organic, semidetached, and embedded systems:

  1. Organic – A software project is said to be an organic type if the team size required is adequately small, the problem is well understood and has been solved in the past and also the team members have a nominal experience regarding the problem.

  2. Semi-detached – A software project is said to be a Semi-detached type if the vital characteristics such as team-size, experience, knowledge of the various programming environment lie in between that of organic and Embedded. The projects classified as Semi-Detached are comparatively less familiar and difficult to develop compared to the organic ones and require more experience and better guidance and creativity. Eg: Compilers or different Embedded Systems can be considered of Semi-Detached type.

  3. Embedded – A software project with requiring the highest level of complexity, creativity, and experience requirement fall under this category. Such software requires a larger team size than the other two models and also the developers need to be sufficiently experienced and creative to develop such complex models.

MBA智库百科中也对三种类型做了定义。

COCOMO模型中,考虑到开发环境的不同,软件开发项目的类型可以分为3种:

  1. 组织型(organic):相对较小、较简单的软件项目。开发人员对开发目标理解比较充分,与软件系统相关的工作经验丰富,对软件的使用环境很熟悉,受硬件的约束较小,程序的规模不是很大(<50000行)。

  2. 嵌入型(embedded):要求在紧密联系的硬件、软件和操作的限制条件下运行,通常与某种复杂的硬件设备紧密结合在一起。对接口、数据结构、算法的要求很高,软件规模任意。如大而复杂的事务处理系统,大型/超大型操作系统,航天用控制系统,大型指挥系统等。

  3. 半独立型(semidetached):介于上述两种软件之间。规模和复杂度都属于中等或更高。最大可达30万行。


All the above system types utilize different values of the constants used in Effort Calculations.

Types of Models: COCOMO consists of a hierarchy of three increasingly detailed and accurate forms. Any of the three forms can be adopted according to our requirements. These are types of COCOMO model:

  1. Basic COCOMO Model
  2. Intermediate COCOMO Model
  3. Detailed COCOMO Model

The first level, Basic COCOMO can be used for quick and slightly rough calculations of Software Costs. Its accuracy is somewhat restricted due to the absence of sufficient factor considerations.

Intermediate COCOMO takes these Cost Drivers into account and Detailed COCOMO additionally accounts for the influence of individual project phases, i.e in case of Detailed it accounts for both these cost drivers and also calculations are performed phase wise henceforth producing a more accurate result. These two models are further discussed below.

根据MBA智库百科

COCOMO模型按其详细程度可以分为三级:基本COCOMO模型,中间COCOMO模型,详细COCOMO模型。

  1. 基本COCOMO模型是一个静态单变量模型,它用一个已估算出来的原代码行数(LOC)为自变量的经验函数计算软件开发工作量。

  2. 中级COCOMO模型在基本COCOMO模型的基础上,再用设计产品、硬件、人员、项目等方面的影响因素调整工作量的估算。

  3. 详细COCOMO模型包括中间COCOMO模型的所有特性,但更进一步考虑了软件工程中每一步骤(如分析、设计)的影响。


代码行数可以通过《软件过程-实践者的研究方法》一书中引用的 Quantative Software Management 所统计的表格。

Programming Language Avg Median Low High
ABAP (SAP) * 28 18 16 60
ASP* 51 54 15 69
Assembler * 119 98 25 320
Brio + 14 14 13 16
C * 97 99 39 333
C++ * 50 53 25 80
C# * 54 59 29 70
COBOL * 61 55 23 297
Cognos Impromptu Scripts + 47 42 30 100
Cross System Products (CSP) + 20 18 10 38
Cool:Gen/IEF * 32 24 10 82
Datastage 71 65 31 157
Excel * 209 191 131 315
Focus * 43 45 45 45
FoxPro 36 35 34 38
HTML * 34 40 14 48
J2EE * 46 49 15 67
Java * 53 53 14 134
JavaScript * 47 53 31 63
JCL * 62 48 25 221
LINC II 29 30 22 38
Lotus Notes * 23 21 19 40
Natural * 40 34 34 53
.NET * 57 60 53 60
Oracle * 37 40 17 60
PACBASE * 35 32 22 60
Perl * 24 15 15 60
PL/I * 64 80 16 80
PL/SQL * 37 35 13 60
Powerbuilder * 26 28 7 40
REXX * 77 80 50 80
Sabretalk * 70 66 45 109
SAS * 38 37 22 55
Siebel * 59 60 51 60
SLOGAN * 75 75 74 75
SQL * 21 21 13 37
VB.NET * 52 60 26 60
Visual Basic * 42 44 20 60

How should I use the range?  The range simply shows lowest and highest gearing factors for each language.  The range can be combined with the average and median, to choose a "most likely" gearing factor for estimation.  The range can be useful as a starting point for choosing an uncertainty range around your "most likely" estimate of the gearing factor.

Where does the data come from? The gearing factors in this table were drawn from 2192 recently completed function point projects in the QSM database.  As mixed-language projects are not a reliable source of gearing factors, only single-language projects are used.

4. 模型#

COCOMO分为3种模型,从简单到复杂,下面是具体的计算例子。

4.1. Basic Model#

The above formula is used for the cost estimation of for the basic COCOMO model, and also is used in the subsequent models. The constant values a,b,c and d for the Basic Model for the different categories of system:

SOFTWARE PROJECTS A B C D
Organic 2.4 1.05 2.5 0.38
Semi Detached 3.0 1.12 2.5 0.35
Embedded 3.6 1.20 2.5 0.32

The effort is measured in Person-Months and as evident from the formula is dependent on Kilo-Lines of code. The development time is measured in Months.

These formulas are used as such in the Basic Model calculations, as not much consideration of different factors such as reliability, expertise is taken into account, henceforth the estimate is rough.

Below is the C++ program for Basic COCOMO

// C++ program to implement basic COCOMO
#include<bits/stdc++.h>
using namespace std;

// Function for rounding off float to int
int fround(float x)
{
    int a;
    x=x+0.5;
    a=x;
    return(a);
}

// Function to calculate parameters of Basic COCOMO
void calculate(float table[][4], int n,char mode[][15], int size)
{
    float effort,time,staff;

    int model;

    // Check the mode according to size

    if(size>=2 && size<=50)
        model=0;        //organic

    else if(size>50 && size<=300)
        model=1;        //semi-detached

    else if(size>300)
        model=2;        //embedded

    cout<<"The mode is "<<mode[model];

    // Calculate Effort
    effort = table[model][0]*pow(size,table[model][1]);

    // Calculate Time
    time = table[model][2]*pow(effort,table[model][3]);

    //Calculate Persons Required
    staff = effort/time;

    // Output the values calculated
    cout<<"\nEffort = "<<effort<<" Person-Month";

    cout<<"\nDevelopment Time = "<<time<<" Months";

    cout<<"\nAverage Staff Required = "<<fround(staff)<<" Persons";

}


int main()
{
    float table[3][4]={2.4,1.05,2.5,0.38,3.0,1.12,2.5,0.35,3.6,1.20,2.5,0.32};

    char mode[][15]={"Organic","Semi-Detached","Embedded"};

    int size = 4;

    calculate(table,3,mode,size);

    return 0;
}

Output:

The mode is Organic
Effort = 10.289 Person-Month
Development Time = 6.06237 Months
Average Staff Required = 2 Persons

4.2. Intermediate Model#

The basic Cocomo model assumes that the effort is only a function of the number of lines of code and some constants evaluated according to the different software system. However, in reality, no system’s effort and schedule can be solely calculated on the basis of Lines of Code. For that, various other factors such as reliability, experience, Capability. These factors are known as Cost Drivers and the Intermediate Model utilizes 15 such drivers for cost estimation.

Classification of Cost Drivers and their attributes:

  1. Product attributes

  2. Required software reliability extent

  3. Size of the application database
  4. The complexity of the product

  5. Hardware attributes

  6. Run-time performance constraints

  7. Memory constraints
  8. The volatility of the virtual machine environment
  9. Required turnabout time

  10. Personnel attributes

  11. Analyst capability

  12. Software engineering capability
  13. Applications experience
  14. Virtual machine experience
  15. Programming language experience

  16. Project attributes

  17. Use of software tools

  18. Application of software engineering methods
  19. Required development schedule
COST DRIVERS VERY LOW LOW NOMINAL HIGH VERY HIGH
Product Attributes
Required Software Reliability 0.75 0.88 1.00 1.15 1.40
Size of Application Database 0.94 1.00 1.08 1.16
Complexity of The Product 0.70 0.85 1.00 1.15 1.30
Hardware Attributes
Runtime Performance Constraints 1.00 1.11 1.30
Memory Constraints 1.00 1.06 1.21
Volatility of the virtual machine environment 0.87 1.00 1.15 1.30
Required turnabout time 0.94 1.00 1.07 1.15
Personnel attributes
Analyst capability 1.46 1.19 1.00 0.86 0.71
Applications experience 1.29 1.13 1.00 0.91 0.82
Software engineer capability 1.42 1.17 1.00 0.86 0.70
Virtual machine experience 1.21 1.10 1.00 0.90
Programming language experience 1.14 1.07 1.00 0.95
Project Attributes
Application of software engineering methods 1.24 1.10 1.00 0.91 0.82
Use of software tools 1.24 1.10 1.00 0.91 0.83
Required development schedule 1.23 1.08 1.00 1.04 1.10

The project manager is to rate these 15 different parameters for a particular project on a scale of one to three. Then, depending on these ratings, appropriate cost driver values are taken from the above table. These 15 values are then multiplied to calculate the EAF (Effort Adjustment Factor). The Intermediate COCOMO formula now takes the form:

The values of a and b in case of the intermediate model are as follows:

SOFTWARE PROJECTS A B
Organic 3.2 1.05
Semi Detached 3.0 1.12
Embeddedc 2.8 1.20

4.3. Detailed Model#

Detailed COCOMO incorporates all characteristics of the intermediate version with an assessment of the cost driver's impact on each step of the software engineering process. The detailed model uses different effort multipliers for each cost driver attribute. In detailed cocomo, the whole software is divided into different modules and then we apply COCOMO in different modules to estimate effort and then sum the effort.

The Six phases of detailed COCOMO are:

  1. Planning and requirements
  2. System design
  3. Detailed design
  4. Module code and test
  5. Integration and test
  6. Cost Constructive model

The effort is calculated as a function of program size and a set of cost drivers are given according to each phase of the software lifecycle.


联系邮箱:curren_wong@163.com

CSDNhttps://me.csdn.net/qq_41729780

知乎https://zhuanlan.zhihu.com/c_1225417532351741952

公众号复杂网络与机器学习

欢迎关注/转载,有问题欢迎通过邮箱交流。

二维码

Back to top