软件度量 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 LanguageAvgMedianLowHigh
ABAP (SAP) *28181660
ASP*51541569
Assembler *1199825320
Brio +14141316
C *979939333
C++ *50532580
C# *54592970
COBOL *615523297
Cognos Impromptu Scripts +474230100
Cross System Products (CSP) +20181038
Cool:Gen/IEF *32241082
Datastage716531157
Excel *209191131315
Focus *43454545
FoxPro36353438
HTML *34401448
J2EE *46491567
Java *535314134
JavaScript *47533163
JCL *624825221
LINC II29302238
Lotus Notes *23211940
Natural *40343453
.NET *57605360
Oracle *37401760
PACBASE *35322260
Perl *24151560
PL/I *64801680
PL/SQL *37351360
Powerbuilder *2628740
REXX *77805080
Sabretalk *706645109
SAS *38372255
Siebel *59605160
SLOGAN *75757475
SQL *21211337
VB.NET *52602660
Visual Basic *42442060

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

E f f o r t = a ( K L O C ) b Effort = a(KLOC)^b Effort=a(KLOC)b

t i m e = c ( E f f o r t ) d time = c(Effort)^d time=c(Effort)d

P e r s o n r e q u i r e d = E f f o r t / t i m e Personrequired = Effort / time Personrequired=Effort/time

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 PROJECTSABCD
Organic2.41.052.50.38
Semi Detached3.01.122.50.35
Embedded3.61.202.50.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
  • Required software reliability extent
  • Size of the application database
  • The complexity of the product
  1. Hardware attributes
  • Run-time performance constraints
  • Memory constraints
  • The volatility of the virtual machine environment
  • Required turnabout time
  1. Personnel attributes
  • Analyst capability
  • Software engineering capability
  • Applications experience
  • Virtual machine experience
  • Programming language experience
  1. Project attributes
  • Use of software tools
  • Application of software engineering methods
  • Required development schedule
COST DRIVERSVERY LOWLOWNOMINALHIGHVERY HIGH
Product Attributes
Required Software Reliability0.750.881.001.151.40
Size of Application Database0.941.001.081.16
Complexity of The Product0.700.851.001.151.30
Hardware Attributes
Runtime Performance Constraints1.001.111.30
Memory Constraints1.001.061.21
Volatility of the virtual machine environment0.871.001.151.30
Required turnabout time0.941.001.071.15
Personnel attributes
Analyst capability1.461.191.000.860.71
Applications experience1.291.131.000.910.82
Software engineer capability1.421.171.000.860.70
Virtual machine experience1.211.101.000.90
Programming language experience1.141.071.000.95
Project Attributes
Application of software engineering methods1.241.101.000.910.82
Use of software tools1.241.101.000.910.83
Required development schedule1.231.081.001.041.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:

E = ( a ( K L O C ) b ) ∗ E A F E = (a(KLOC)^b) * EAF E=(a(KLOC)b)EAF

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

SOFTWARE PROJECTSAB
Organic3.21.05
Semi Detached3.01.12
Embeddedc2.81.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

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

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

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
COCOMO II模型是一种常用的软件工程估算方法,它通过对软件规模、复杂度和开发环境等因素的评估,来估算软件开发的工作量和时间。对于12306网络购票系统,我们可以按照以下步骤进行工作量估算: 1. 定义项目规模:我们可以使用功能点数来表示项目规模。假设该系统的功能点数为200,则我们可以将其作为项目规模的度量。 2. 评估项目特征:COCOMO II模型需要评估多个项目特征,包括开发模式、人员能力、项目复杂度、文档要求、软件可靠性等。根据12306网络购票系统的特点,我们可以评估出相应的特征值: - 开发模式:该系统采用的是面向对象的开发模式,评估值为1.05。 - 人员能力:假设团队成员的经验和能力较好,评估值为1.10。 - 项目复杂度:该系统的复杂度属于中等水平,评估值为1.10。 - 文档要求:该系统需要编写一定量的文档,评估值为1.03。 - 软件可靠性:该系统需要保证一定的软件可靠性,评估值为1.07。 3. 计算工作量:根据COCOMO II模型的公式,可以计算出该系统的工作量为: 工作量 = A × (规模)^E × B 其中,A、B、E是模型中的常数,对于该系统可以取以下值: - A = 2.94 - B = 1.12 × 1.05 × 1.10 × 1.03 × 1.07 = 1.45 - E = 0.91 + 0.01 × (评估值之和) = 0.91 + 0.01 × (1.05 + 1.10 + 1.10 + 1.03 + 1.07) = 1.23 代入上述值可得: 工作量 = 2.94 × (200)^1.23 × 1.45 = 22.7 人月 这意味着,完成该系统的开发工作需要22.7个人月的时间。需要注意的是,这只是一个估算值,实际的工作量可能会因为各种因素而有所不同。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值