Open In App
Related Articles

COCOMO Model – Software Engineering

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Cocomo (Constructive Cost Model) is a regression model based on LOC, i.e., the number of Lines of Code. This article focuses on discussing the Cocomo Model in detail.

What is the Cocomo Model?

The Cocomo Model is a procedural cost estimate model for software projects and is 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 1981 and is based on the study of 63 projects, which makes it one of the best-documented models. 

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

  1. Effort: Amount of labor that will be required to complete a task. It is measured in person-months units.
  2. Schedule: This simply means the amount of time required for the completion of the job, which is, of course, proportional to the effort put in. It is measured in the units of time such as weeks, and 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 the constant to be used in subsequent calculations. These characteristics of 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, and knowledge of the various programming environments lie in between 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 better guidance and creativity. Eg: Compilers or different Embedded Systems can be considered Semi-Detached types.

3. Embedded

A software project requiring the highest level of complexity, creativity, and experience requirement falls 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.

Importance of the COCOMO Model

  1. Cost Estimation: To help with resource planning and project budgeting, COCOMO offers a methodical approach to software development cost estimation.
  2. Resource Management: By taking team experience, project size, and complexity into account, the model helps with efficient resource allocation.
  3. Project Planning: COCOMO assists in developing practical project plans that include attainable objectives, due dates, and benchmarks.
  4. Risk management: Early in the development process, COCOMO assists in identifying and mitigating potential hazards by including risk elements.
  5. Support for Decisions: During project planning, the model provides a quantitative foundation for choices about scope, priorities, and resource allocation.
  6. Benchmarking: To compare and assess various software development projects to industry standards, COCOMO offers a benchmark.
  7. Resource Optimization: The model helps to maximize the use of resources, which raises productivity and lowers costs.

Types of COCOMO Model

1. Basic Model

E = a(KLOC)^b

Time = c(Effort)^d

Person required = Effort/ time

The above formula is used for the cost estimation of 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 the system:

Software Projectsabcd
Organic2.41.052.50.38
Semi-Detached3.01.122.50.35
Embedded3.61.202.50.32
  1. 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.
  2. These formulas are used as such in the Basic Model calculations, as not much consideration of different factors such as reliability, and expertise is taken into account, henceforth the estimate is rough. 

Below is the C++ program for Basic COCOMO:

CPP

// 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
    // organic
    if (size >= 2 && size <= 50)
        model = 0;
 
    // semi-detached
    else if (size > 50 && size <= 300)
        model = 1;
 
    // embedded
    else if (size > 300)
        model = 2;
 
    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";
}
 
// Driver code
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;
}

                    

Java

import java.util.Arrays;
 
public class BasicCOCOMO
{
    private static final double[][] TABLE =
    {
        {2.4, 1.05, 2.5, 0.38},
        {3.0, 1.12, 2.5, 0.35},
        {3.6, 1.20, 2.5, 0.32}
    };
    private static final String[] MODE =
    {
        "Organic", "Semi-Detached", "Embedded"
    };
 
    public static void calculate(int size)
    {
        int model = 0;
 
        // Check the mode according to size
        if (size >= 2 && size <= 50)
        {
            model = 0;
        } else if (size > 50 && size <= 300)
        {
            model = 1;
        } else if (size > 300)
        {
            model = 2;
        }
 
        System.out.println("The mode is " + MODE[model]);
 
        // Calculate Effort
        double effort = TABLE[model][0] * Math.pow(size,
                                                   TABLE[model][1]);
 
        // Calculate Time
        double time = TABLE[model][2] * Math.pow(effort,
                                                 TABLE[model][3]);
 
        // Calculate Persons Required
        double staff = effort / time;
 
        // Output the values calculated
        System.out.println("Effort = " + Math.round(effort) +
                           " Person-Month");
        System.out.println("Development Time = " + Math.round(time) +
                           " Months");
        System.out.println("Average Staff Required = " + Math.round(staff) +
                           " Persons");
    }
 
    public static void main(String[] args)
    {
        int size = 4;
        calculate(size);
    }
}

                    

Python3

# Function to calculate parameters of Basic COCOMO
def calculate(table, n ,mode ,size):
    effort = 0
    time = 0
    staff = 0
    model = 0
     
    # Check the mode according to size
    if(size >= 2 and size <= 50):
        model = 0
    elif(size > 50 and size <= 300):
        model = 1
    elif(size > 300):
        model = 2
     
    print("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
    print("Effort = {} Person-Month".format(round(effort)))
    print("Development Time = {} Months".format(round(time)))
    print("Average Staff Required = {} Persons".format(round(staff)))
 
table = [[2.4, 1.05, 2.5, 0.38],
         [3.0, 1.12, 2.5, 0.35],
         [3.6, 1.20, 2.5, 0.32]]
mode = ["Organic","Semi-Detached","Embedded"]
size = 4;
calculate(table, 3, mode, size)
 
# This code is contributed by yashpra1010.

                    

C#

using System;
 
class Program {
  
  // Function to calculate parameters of Basic COCOMO
    static void calculate(double[, ] table, int n,
                          string[] mode, int size)
    {
        double effort = 0, time = 0, staff = 0;
        int model = 0;
 
        // Check the mode according to size
        if (size >= 2 && size <= 50) {
            model = 0;
        }
        else if (size > 50 && size <= 300) {
            model = 1;
        }
        else if (size > 300) {
            model = 2;
        }
 
        Console.WriteLine("The mode is " + mode[model]);
 
        // # Calculate Effort
        effort = table[model, 0]
                 * Math.Pow(size, table[model, 1]);
        time = table[model, 2]
               * Math.Pow(effort, table[model, 3]);
 
        // Calculate Persons Required
        staff = effort / time;
 
        Console.WriteLine("Effort = " + Math.Round(effort)
                          + " Person-Month");
        Console.WriteLine("Development Time = "
                          + Math.Round(time) + " Months");
        Console.WriteLine("Average Staff Required = "
                          + Math.Round(staff) + " Persons");
    }
 
    static void Main(string[] args)
    {
        double[, ] table = { { 2.4, 1.05, 2.5, 0.38 },
                             { 3.0, 1.12, 2.5, 0.35 },
                             { 3.6, 1.20, 2.5, 0.32 } };
        string[] mode
            = { "Organic", "Semi-Detached", "Embedded" };
        int size = 4;
 
        calculate(table, 3, mode, size);
    }
}
 
// This code is contributed by Shiv1o43g

                    

Javascript

// Javascript program to implement basic COCOMO
 
// Function to calculate parameters of Basic COCOMO
function calculate(table,n,mode,size)
{
    var effort,time,staff,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
     
 
    console.log("The mode is ",mode[model]);
     
    // Calculate Effort
    effort = table[model][0] * (size ** table[model][1]);
 
    // Calculate Time
    time = table[model][2] * (effort ** table[model][3]);
 
    // Calculate Persons Required
    staff = effort / time;
 
    console.log("Effort = ",effort," Person-Month");
    console.log("Development Time = ",time," Months");
    console.log("Average Staff Required = ",Math.round(staff)," Persons");
}
 
 
var table = [[2.4,1.05,2.5,0.38],[3.0,1.12,2.5,0.35],[3.6,1.20,2.5,0.32]]
var mode = ["Organic","Semi-Detached","Embedded"]
var size = 4;
calculate(table, 3, mode, size);
 
// This code is contributed by satwiksuman.

                    

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



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 systems. However, in reality, no system’s effort and schedule can be solely calculated based on Lines of Code. For that, various other factors such as reliability, experience, and 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: 

Product attributes:

  1. Required software reliability extent
  2. Size of the application database
  3. The complexity of the product
  4. Run-time performance constraints
  5. Memory constraints
  6. The volatility of the virtual machine environment
  7. Required turnabout time
  8. Analyst capability
  9. Software engineering capability
  10. Application experience
  11. Virtual machine experience
  12. Programming language experience
  13. Use of software tools
  14. Application of software engineering methods
  15. Required development schedule

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

Advantages of the COCOMO Model

  1. Systematic cost estimation: Provides a systematic way to estimate the cost and effort of a software project.
  2. Helps to estimate cost and effort: This can be used to estimate the cost and effort of a software project at different stages of the development process.
  3. Helps in high-impact factors: Helps in identifying the factors that have the greatest impact on the cost and effort of a software project.
  4. Helps to evaluate the feasibility of a project: This can be used to evaluate the feasibility of a software project by estimating the cost and effort required to complete it.

Disadvantages of the COCOMO Model

  1. Assumes project size as the main factor: Assumes that the size of the software is the main factor that determines the cost and effort of a software project, which may not always be the case.
  2. Does not count development team-specific characteristics: Does not take into account the specific characteristics of the development team, which can have a significant impact on the cost and effort of a software project.
  3. Not enough precise cost and effort estimate: This does not provide a precise estimate of the cost and effort of a software project, as it is based on assumptions and averages.

Conclusion

For both software engineers and project managers, COCOMO is an applicable and useful tool at a time when effective project planning is essential to success. Its continued application and adaption in a variety of settings show how valuable it is in the always-changing field of software development.



Last Updated : 01 Feb, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads