Case Study: Unveiling COCOMO - An Accurate Software Project Estimation Method

COCOMO Python Language


Overview

COCOMO (Constructive Cost Model) is a widely used software cost estimation model that helps project managers estimate the effort, time, and resources required for a software development project. It categorizes projects into three modes:

  1. Organic Mode: Suitable for small teams with experience in the problem domain.

  2. Semi-detached Mode: Appropriate for intermediate team size and experience.

  3. Embedded Mode: For projects with tight constraints and high reliability needs.

 

Problem

You have been appointed as project manager for healthcare apps development. The project scope is focusing on developing the critical part of the apps which are: registration, view doctors schedule, make an appointment and order for prescription order.

Based on your experience or knowledge, please mention roles required for this project (i.e: back end, front end, etc) and estimate how many man-days required to deliver the project. Please also provide an analysis where your estimation coming from.


 

Solving

In this project, we are tasked with estimating the effort required for the development of a healthcare app. The critical features include registration, viewing doctors' schedules, making appointments, and ordering prescription refills.

Step 1: Import necessary libraries

import math
import pandas as pd
import matplotlib.pyplot as plt

These libraries will be used for mathematical calculations, data manipulation, and visualization.

 

Step 2: Function to calculate COCOMO estimates

def calculate_effort(kloc, em, days_in_a_month):
   # Effort in person-months
   effort_pm = kloc * em
   # Convert to person-days
   effort_days = effort_pm * days_in_a_month
​
   # Print the results
   print("Effort estimate using COCOMO")
   print("--------------------------------------")
   print(f"Lines of code (KLOC): {kloc}")
   print(f"Effort multiplier (EM): {em}")
   print(f"Estimated effort : {effort_days:.2f} person-days")
   print(f"Estimated effort : {effort_pm:.2f} person-months")
   return effort_days

This function calculates the effort required in person-days based on lines of code (KLOC) and effort multiplier (EM).

The number 22 in the equation effort_days = effort_pm * 22 is an estimate of the number of working days in one month. This number is based on the assumption that the average person works 5 days a week and 8 hours a day, with weekends and national holidays off. Therefore, there are about 22 working days in one month.

The equation effort_days = effort_pm * 22 is used to convert an effort estimate in person-months to an effort estimate in person-days. This is done because most software projects are measured in person-days, not person-months.

Here is an example:

  • If the effort estimate in person-months is 2, then the effort estimate in person-days is:

    effort_days = 2 * 22 = 44

This means that the project is estimated to take 44 working days to complete.

It is important to note that this number 22 is only an estimate and can vary depending on certain factors, such as:

  • Hours worked per day

  • Number of holidays

  • National holidays

Therefore, it is important to adjust this number 22 based on the specific conditions of our project.

 

Step 3: Project Parameters

# Project parameters
kloc = 300            # Estimated lines of code (KLOC)
em = 1.05            # Effort multiplier (organic mode)
days_in_a_month = 22 # Estimatd of the number of working days

Setting up parameters for the project, including estimated lines of code and the chosen effort multiplier for the organic mode.

Understanding the Effort Multiplier (EM):

  • EM is not determined based on individual roles. It's a factor that takes into account project-level attributes that can influence effort, such as:

    • Team experience

    • Product complexity

    • Required reliability

    • Use of modern programming practices

    • Development tools

  • COCOMO provides three modes for determining EM:

    • Organic mode (small teams, familiar with the problem domain): EM = 1.05

    • Semi-detached mode (intermediate team size and experience): EM = 1.12

    • Embedded mode (tight constraints, high reliability needs): EM = 1.20

For this project, we assumed organic mode (EM = 1.05) based on the following factors:

  • Small team size

  • New development project

  • Team familiarity with healthcare app development

If any of these factors change, the EM value may need re-evaluation.

Key Points:

  • Staffing needs are based on estimated effort and project timelines.

  • EM is a project-level factor, not role-specific.

  • Choose COCOMO mode based on project characteristics.

  • Reassess estimates and EM as the project evolves.

Recommendations:

  • Regularly review estimates and staffing needs.

  • Involve team members in estimation and planning.

  • Use project management tools to track progress and adjust resources as needed.

  • Communicate effectively with stakeholders about project progress and resource requirements.

 

Step 4: Calculate effort using COCOMO

# Calculate effort using COCOMO
effort_days = calculate_effort(kloc, em, days_in_a_month)

Output :

Effort estimate using COCOMO
--------------------------------------
Lines of code (KLOC): 300
Effort multiplier (EM): 1.05
Estimated effort : 6930.00 person-days
Estimated effort : 315.00 person-months

Applying the COCOMO model to estimate the effort required in person-days.

Explanation :

  • The estimation is based on COCOMO, a widely used software cost estimation model.

  • The KLOC value is an estimate based on the project scope and complexity.

  • The EM value is chosen for organic mode, which is typical for new development projects.

  • The estimated effort provides a starting point for project planning and resource allocation.

 

Step 5 : Calculate development time using the organic mode formula

# Calculate development time using the organic mode formula
c = 2.5
d = 0.38
​
development_time = c * math.pow(effort_days / days_in_a_month, d)  # Months
​
# Print the result
print(f"Development Time: {development_time:.2f} months")

Output :

Development Time: 22.25 months

Using the organic mode coefficients to calculate the estimated development time in months. Formula :

Development Time = c*(Effort)^d 

Coefficients for intermediate COCOMO

Project ai bi ci di
Organic 2.4 1.05 2.5 0.38
Semidetached 3.0 1.12 2.5 0.35
Embedded 3.6 1.20 2.5 0.32

GeeksforGeeks. (2023, December 26). COCOMO Model Software Engineering. https://www.geeksforgeeks.org/software-engineering-cocomo-model/

Explanation :

  • c and d are constant coefficients that depend on the COCOMO mode (organic, semi-detached, or embedded).

  • Effort i sthe total estimated effort in man-days (In our case, we have already performed the calculation in step 4).

According to the organic mode Coefficients :

  • c = 2.5

  • d = 0.38

 

Step 6 : Calculate person-months required

# Calculate person-months required
person_months = effort_days / 22;
print(f"Person Estimated: {person_months:.2f} months")

Output :

Person Estimated: 315.00 months

Determining the estimated person-months required for the project

 

Step 7 : Role-based Effort Allocation

# Define roles
roles = ["Back-end developer", "Front-end developer", "Mobile developer", "QA tester", "Project manager"]
​
# Collect role's percentage
percentages = [39, 26, 17.5, 13, 4.5]
​
# Calculate effort_days based on percentages
allocation = [effort_days * (percentage / 100) for percentage in percentages]
​
# Create DataFrame with roles and effort_days
role_effort_df = pd.DataFrame({"Role": roles, "Estimated Effort (man-days)": allocation})
​
# Print the DataFrame
print(role_effort_df)

Output :

                  Role  Estimated Effort (man-days)
0   Back-end developer                      2702.70
1 Front-end developer                      1801.80
2     Mobile developer                      1212.75
3           QA tester                       900.90
4     Project manager                       311.85

 

Allocating effort estimates to different roles and creating DataFrame for better organization

Here's a breakdown of how the estimated effort for each role was derived, based on the COCOMO model and project-specific considerations:

  1. Initial Effort Calculation:

    • Total estimated effort (man-days) = (?) (as previously calculated using COCOMO with on Step 4)

  2. Role-Based Effort Allocation:

    • Back-end developer:

      • Estimated to require the most effort due to:

        • Development of core server-side logic, database interactions, and API integrations.

        • Potential for handling sensitive healthcare data, requiring additional security measures.

    • Front-end developer:

      • Responsible for user interface development, which often involves:

        • Design and implementation of multiple screens, forms, and interactions.

        • Ensuring usability and responsiveness across different devices.

    • Mobile developer:

      • Focused on developing native mobile apps, which typically:

        • Have a smaller scope compared to the overall backend and frontend.

        • May involve platform-specific considerations and optimizations.

    • QA tester:

      • Allocated time for comprehensive testing of:

        • Functionality, usability, performance, and security.

        • Ensuring adherence to healthcare industry regulations.

    • Project manager:

      • Responsible for planning, coordination, and oversight, but:

        • Not directly involved in development tasks as much as other roles.

  3. Benchmarking for Effort Distribution:

    • While there's no universally accepted benchmark for effort distribution across roles,

      common practices and industry norms were considered:

      • Back-end development often accounts for a larger portion of effort in web-based applications, especially those with complex data management and integrations.

      • Front-end development's effort allocation aligns with typical web app development patterns.

      • Mobile development effort is adjusted based on the scope of the mobile apps and their integration with the backend.

      • QA testing effort is proportionate to the overall project size and complexity, ensuring quality assurance.

      • Project management effort is estimated based on industry standards for project management tasks and activities.

Important Considerations:

  • These estimates are based on assumptions and initial project understanding.

  • Actual effort may vary depending on:

    • Specific requirements

    • Team experience

    • Development tools

    • Unexpected challenges

  • It's crucial to:

    • Regularly review and adjust estimates as the project progresses.

    • Involve team members in estimation and planning for more accurate assessments.

 

Step 8 : Plotting the Role-Based Effort Allocation

# Plotting the Role-Based Effort Allocation
plt.figure(figsize=(10, 6))
plt.bar(roles, allocation, color=['blue', 'orange', 'green', 'red', 'purple'])
plt.title('Role-Based Effort Allocation')
plt.xlabel('Roles')
plt.ylabel('Estimated Effort (man-days)')
plt.show()

For a more detailed analysis, including role-based effort allocation, development time calculation, and recommendations, please refer to the complete report. [https://github.com/dikhimartin/simple-cocomo-project-estimation/blob/master/cocomo-project-estimation-approach.ipynb]

 

Conclusion

This step-by-step approach outlines the process of applying the COCOMO model for project estimation, including parameter setup, calculation of effort, role-based effort allocation, and visualization. The results provide valuable insights into resource requirements for the healthcare app development project.

Thank you for your assistance in enhancing my comprehension of COCOMO. I truly appreciate your valuable feedback, as it greatly contributes to my learning process.

 

References

Software Engineering | COCOMO Model - javatpoint. (n.d.). www.javatpoint.com. https://www.javatpoint.com/cocomo-model

GeeksforGeeks. (2023, December 26). COCOMO Model Software Engineering. https://www.geeksforgeeks.org/software-engineering-cocomo-model/

Share this post

Author
Dikhi Martin

Dikhi MartinSoftware Engineer