• No results found

SOFTWARE PROJECT ESTIMATION

Project Management

2.4 SOFTWARE PROJECT ESTIMATION

Software project estimation is part of the general systems engineering process that takes place when a project is planned. It is always a part of major software projects for one basic reason: no reasonable person or organization would begin a large project without some belief that the project can be done with the resources that the person or organization is willing to commit to the project. Clearly, some form of process estimation is necessary. This section provides additional details that will extend the discussion begun in Chapter 1, Section 1.8.4.

Any project will need most of the following resources, with many people, computers, or software required to perform multiple duties in very small projects or organizations:

• Computers for software development

• Basic software for development such as compilers or linkers, ideally within an inte- grated development environment that includes configuration management and simi- lar tools

• Methods of communicating between computers such as networks • Computer-aided software engineering (CASE) tools

• Software packages with which the system must be interoperable

• Software and hardware emulators of both testing and development environments for devices such as smartphones and tablets

• Computers for testing • Computers for training

• Clouds and cloud computing services for large-scale development

• Commercial off-the-shelf (COTS) products deemed necessary for system operation • Documentation tools • Copying devices • Programmers • Testers • Managers • Designers • Requirements engineers

Note that projects of moderate size or larger may require multiple instances of each resource, including software tools, such as CASE tools or configuration management sys- tems. In fact, every software team duty mentioned earlier in this chapter would have to be counted as a resource requirement of the project.

The term size has been used informally in this section. Determination of the actual size of a project is a nontrivial matter and we will return to it several times. For now, the size of a project is the number of lines of source code created by the organization in order to develop a project. A line of code is any line in a program that is neither blank nor consists only of comments. (Better definitions of the term line of code will be given later in this book.)

Understanding what is meant by the size of an existing system and being able to quan- tify this size in a consistent manner are absolutely essential if we expect to estimate the size of new systems. Thus, we will temporarily turn our attention to the subject of measuring the size of a software system.

Of course, the measurement of software system size can be very difficult. For example, suppose that you write a program 100 lines long that writes its output to a data file. Suppose that the data file is then imported into a spreadsheet and that the spreadsheet you created uses the spreadsheet’s built-in statistical routines, which are then exported to another file, which contains the final result. How big is the system? Is it the 100 lines of code that you wrote? Is it the millions of lines of code that make up the spreadsheet (plus the 100 lines you wrote)? Is it the number of lines you wrote (100) plus the size of the code you entered into your spreadsheet program? Is it the number of lines you wrote (100) plus the size of the data output that is written to the spreadsheet?

The difficulty in measuring software system size requires precise definitions. Unfortunately, there are few standards that are common throughout the software industry. We will return to this point several times in this book when we discuss

software metrics. For now, we will just consider the number of lines of code as the measure of the size of a software system and ignore exactly how the number of lines of code was computed.

There is a rule of thumb that says 10,000 is approximately the largest amount of lines of source code that a good software engineer who is experienced in both the application area and the programming language used can understand completely. (This rule of thumb is part of the folklore of software engineering.) Let us use this number to estimate the size of a team that would be needed for software development of various sizes. (An assessment of a smaller number as the maximum that anyone can understand would increase the number of software engineers needed, whereas a larger number would decrease this number.) For simplicity, we will assume that all source code for the project is created by the team. The results are summarized in Table 2.1.

Note that there are many software projects in each of the larger size ranges. For example, the typical word processor software for a modern personal computer consists of millions of lines of code. As stated before, one particular version of Microsoft Excel consisted of more than 1.2 million lines of code. The project to revise the United States air traffic control sys- tem, which was terminated in the late 1990s, was expected to consist of well over 10 million lines of code. These huge numbers make it clear that most products reuse a huge amount of code, simply because there are not enough good software engineers available.

Unfortunately, the enormous numbers shown in Table 2.1 greatly underestimate the number of people needed for extremely large software projects that consist of large amounts of new code. There are several reasons for this:

• Not all programmers can understand systems at the complexity level of 10,000 lines of code.

• Larger systems mean that the programmers developing the software must be physi- cally separated, that is, on different floors of the same building, in different buildings,

TABLE 2.1 An Unrealistically Optimistic View of the Relationship between the Size of a Software Project in Lines of New Code versus the Number of Programmers on Development Teams

Lines of New Code Approximate Number of Software Engineers

5,000 1 10,000 1 20,000 2 50,000 5 100,000 10 200,000 20 500,000 50 1,000,000 100 2,000,000 200 5,000,000 500 10,000,000 1,000 100,000,000 10,000

different locations, or even in different countries. There is no way for the informal, one-on-one discussions that can solve problems quickly to occur as spontaneously as in a smaller environment.

• Coordination of efforts is essential. This means many meetings; many managers to coordinate meetings; and many support personnel to install, maintain, and configure the computers and software needed to support this project. It is extremely rare for a software manager to coordinate more than twenty people, with eight to ten people a much more realistic number.

• The number of middle-level managers increases exponentially with the size of the project. For a small team, one manager might suffice. For a larger team, there may be a first-level software manager for every eight to ten people, a second-level manager for every eight to ten first-level managers, and so on. These managers are essential for coordination of efforts and to ensure that one group’s changes to a system are local- ized to that group and do not affect other efforts of the project. Even a flatter organi- zational structure with more “programmers” and fewer middle-level managers must develop higher levels of administration as the project size gets larger.

• The project team rarely stays together for the duration of a project. Every organiza- tion has turnover. There is often an influx of new personnel just out of school (“fresh- outs”) who need training in the organization’s software standards and practices. Even experienced personnel who are new to a project often need a considerable amount of time and effort to get up to speed.

• There are many other activities that are necessary for successful software develop- ment. There must be agreement on the requirements in the software being developed. The code must be tested, both at the small module level and at the larger system level. The system must be documented. The system must be maintained.

There are other activities, of course. Higher-level management wants to spend its resources wisely. It wants to know if projects are on schedule and within budget. It does not want to be surprised by last-minute disasters. Ideally, higher-level management wants feed- back on process improvement that can make the organization more competitive. Feedback and reporting often require the collection of many measurements, as well as one or more individuals to evaluate the data obtained by these measurements. Project demonstrations must be given and these require careful preparation.

How much of a software engineering project’s total effort is devoted to writing new source code? The answer varies slightly from organization to organization and project to project, but most experienced software managers report that development of the source code takes only about 15 percent of the total effort. This appears to be constant across all sizes of organizations. People who write source code in very small organizations may have to spend much of their time marketing their company’s products.

The need for these extra activities suggests a more realistic view of a software team’s size; see Table 2.2. As before, we only consider the case of new code. We assume that 5

percent of a programmer’s time is spent on measurements, and another 20 percent is spent on meetings, reporting progress (or explaining the lack of it), and other activi- ties (requirements, design, testing, documentation, delivery, maintenance, etc.). We also assume that programmers have difficulty understanding 5,000 lines of code, much less 10,000.

It is clear from Table 2.2 that some of the very largest projects require international efforts. The reality is that, unless you work for a software organization whose primary activities are training, hardware maintenance, system configuration, or technical support as a part of customer service, most of your work in the software industry will be as a mem- ber of a team.

You are certainly aware of the oft-voiced concern in the United States and elsewhere about the trend of outsourcing software, thereby taking away jobs. The problem is not con- sidered to be as serious as it once was, because of the relative shortage of software engineers in the United States and the difficulties in coordination of teams in radically different time zones. This has affected some international efforts.

The greatest issue in outsourcing now appears to be the independent programmer tak- ing jobs “on spec,” which often leads to unsatisfied customers who did not properly define their proposed project’s requirements to the programmer working on spec.

Of course, the numbers will be very different if the projects make use of a considerable amount of reused code. We ask you to consider this issue in one of the exercises at the end of the chapter.

There is one final point to make on this issue of size measurement. As measured by the number of new lines of code produced, the productivity of the typical programmer has not increased greatly in the last fifty years or so and is still in the neighborhood of a few documented, tested lines of code written per hour. Yet software systems have increased tremendously in complexity and size, without requiring all an organization’s, or even a nation’s, resources. How is this possible?

TABLE 2.2 A Somewhat More Realistic View of the Relationship between the Size of a Software Project with Only Lines of New Code and the Number of People Employed on the Project

Lines of New Code Approximate Number of Software Engineers

5,000 7 10,000 14 20,000 27 50,000 77 100,000 144 200,000 288 500,000 790 1,000,000 1,480 2,000,000 3,220 5,000,000 8,000 10,000,000 15,960 100,000,000 160,027

There are two primary reasons for the improvements that have been made in the abil- ity to develop modern complex software systems. The first is the increase in abstraction and expressive power of modern high-level languages and the APIs available in a software development kit (SDK) over pure assembly language. The second is the leveraging of previ- ous investment by reusing existing software when new software is being developed.

The code of Example 2.1 is a good illustration of the productivity gained by using high- level languages. It also illustrates how different people view the size of a software system.

Example 2.1: A Simple Example to Illustrate Line Counting

#include <stdio.h> main() { int i; for (i = 0; i < 10; i++) printf("%d\n", i); }

The code source consists of 9 lines, 16 words, and 84 characters according to the UNIX wc utility. The assembly language code generated for one computer running a variant of the UNIX operating system (HP-UX) by the gcc compiler consisted of 49 lines, 120 words, and 1,659 characters. The true productivity, as measured by the functionality produced, was improved by a factor of 49/9, or 5.44, by using a higher- level language. This number illustrates the effect of the higher-level language. We note that the productivity is even greater than 5.44 when we consider the advantage of reusing the previously written printf() library function.

Reuse is even more effective when entire applications can be reused. It is obviously more effi- cient to use an existing database package than to redevelop the code to insert, delete, and man- age the database. An entire application reused without change is called off-the-shelf; the most common occurrence is the use of COTS software to manage databases, spreadsheets, or similar.

We note that many methodologies such as agile software development can greatly reduce the numbers of software engineers suggested in Table 2.2. With the agile team hav- ing a proper understanding of the application environment, specifically which existing large-scale components can be combined into programs with minimal coding to create the desired software solution, the numbers shown in Table 2.2 can be reduced immensely.

There are several components to a systematic approach to software project estimation: • Resources must be estimated, preferably with some verifiable measurement.

• An “experience database” describing the histories of the resources used for previous projects should be created.

We address each of these issues in turn.

The first step in resource estimation is predicting the size of the project. The begin- ning software engineer often wonders how project size is estimated. The most common approach is to reason by analogy. If the system to be developed appears to be similar to other systems with which the project manager is familiar, then the manager can use the previous experiences of the managers for those projects to estimate the resources for the current project. This approach requires that the other “similar” projects are similar enough that their actual resource needs are relevant to the current project. The less familiar a par- ticular project is, the less likely it is that a manager will be able to estimate its size by rea- soning by analogy.

The reasoning-by-analogy approach also involves determining the actual resource needs of the other “similar” projects. This can only be done if the information is readily available in an experience database. An experience database might look something like the one that is illustrated in Table 2.3.

Of course, such a table is meaningless unless we have units for the measurements used. In this table the effort is measured by the number of person-months needed for the project, where the term person-month is used to represent the effort of one person working for one month. The size evaluation can be any well-defined measurement. The most commonly used measurement is called “lines of code,” or LOC for short. We will discuss the lines of code measurement in several sections later in the book. For now, just use your intuition about what this measurement means.

How can the information in the experience database be used? Let us look at a scatter diagram of the number of months needed for different projects and the size of the projects (which might be measured in lines of code). A typical scatter diagram is shown in Figure 2.2. This diagram may be uninformative. A model may be created, based on the fitting of a straight line or curve to the data according to some formula. A straight line fitted to the data in Figure 2.2 would slope from lower left to upper right.

The fitting of a straight line to data is often done using the “method of least squares.” In this method, the two coefficients m and b of a straight line whose equation is written in the form

y = mx + b

TABLE 2.3 An Example of an Experience Database for Project Size Estimation

Project Name Domain Elapsed Months Person-MonthsEffort in Size in Lines of Code

Application 1 Graphics utility 12 30 5,000

Application 2 Graphics utility 10 40 8,000

Application 3 Graphics utility 24 30 5,000

Application 4 Graphics utility 36 100 20,000

Application 5 Graphics utility 12 30 5,000

Application 6 Graphics utility 24 30 10,000

Application 7 Graphics utility 48 90 25,000

are determined from the equations m=⎣⎢n

(∑

xiyi

)

( )∑

xi

( )∑

yi⎦⎥ n

xi2

( )∑

xi 2 ⎡ ⎣⎢ ⎤⎦⎥ and b=⎡n

(yi)

(xi2)

(xi)

(xiyi) n (xi)2

( )∑

xi 2

⎡ ⎣⎢ ⎤⎦⎥

These coefficients can be calculated using the built-in formula named LINEST in Microsoft Excel. The name of the function reflects that the line computed by this formula is called the linear regression line or the “least squares fit” to the data.

In the example illustrated in Figure 2.2, the values of m and b are approximately 0.002 and 1.84, respectively, and the equation of the line is

y = 0.002x + 1.84

This formula gives an approximation to the number of months needed for a typical project within the organization of any particular size. This implies that a project of size 15,000 LOC would take approximately 32 months. (This is clearly an inefficient software develop- ment process!)

One commonly used approach to software estimation is based on the COCOMO devel- oped by Boehm (1981) in his important book Software Engineering Economics. There are several other commonly used methodologies used for cost estimation: SEER and SLIM, both of which are embedded within complete suites of tools used for project management. For simplicity, we will not discuss them in this book.

Boehm suggests the use of a set of two formulas to compute the amount of effort (mea- sured in person-months) and the time needed for completion of the project (measured in months). Boehm’s formulas use data collected from an experience base that is a large col- lection of software projects in many different application domains.

25,000 20,000 15,000 10,000 5,000 0 0 10 20 30 40 50

FIGURE 2.2 A scatter diagram showing the relationship between project size and duration in months for the experience database of Table 2.1.

Boehm developed a hierarchy of three cost models: basic, intermediate, and advanced.