Một cách khác để mô tả mối quan hệ của các biện pháp kích thước khác nhau làHiển thị trong hình 3.4. Ở đây, các cơ sở cho phiên bản 2 là màu Lộc 450 từPhiên bản 1. Trong việc phát triển phiên bản 2, chúng tôi xóa 200 Lộc từ các cơ sở, sửa đổi 75Lộc, và để lại 175 Lộc chưa sửa đổi. Của vòng tròn 450-Lộc ban đầu, 200 Lộcbên ngoài vòng tròn Phiên bản 2 và cả 75 lần và 175 chưa sửa đổi Lộcnằm trong vòng tròn Phiên bản 2. Này, chúng tôi thêm dòng bổ sung mã, 60 và các600 dòng tái mã để đi đến một phiên bản cuối cùng 2 Tổng kích thước của 910 Lộc (175 +75 + 60 + 600).Tất cả các mục trong bảng 3.2 phải được tính cho mỗi phiên bản hoặc tổng sốcó khả năng sẽ không chính xác. Đó là một tính năng đẹp của cấu trúc kế toán Lộcnó là phụ gia. Điều này đặc biệt quan trọng khi nhiều nhóm đóng góp mã để mộtHệ thống lớn. Sau đó, sau khi phát triển một số phiên bản, bạn có thể thêm số điện thoại củaThêm, xóa, sửa đổi và tái mã để có được hiệu quả kết hợp của những nỗ lực phát triển tất cả cho tất cả các phiên bản. Ví dụ, trong trường hợp Hiển thị trong bảng 3.2,cơ sở mã ban đầu là 0, thêm mã là 350 + 100 + 60 = 510 Lộc, các đã xoáMã là 0 + 0 + 200 Lộc, và sửa đổi mã là 0 + 25 + 75 = 100 LOC. Nếu chúng tôi44 chương 3 đo kích thước phần mềm3.2 BẢNG KÍCH THƯỚC KẾ TOÁN VÍ DỤCơ sở bổ sung thay đổi trừ NetCăn cứ V0 0Thêm 350Đã xoá 0Lần 0 0Tái 0Tổng số V0 350-0 = 350 + = 350Base V1 350Added 100Deleted 0Modified 25 25Reused 0Totals V1 125 – 25 = 100 + = 450Base V2 450Added 60Deleted 200Modified 75 75Reused 600Totals V2 735 – 275 = 460 + = 910Final Product 910________________________________________ ______________________________ __________ __________ __________________________________________________ ______________________________ __________ __________ __________________________________________________ ______________________________ __________ __________ ____________________count the modifications as additions and deletions, the total is the additions (510 +100 = 610) minus the deletions (200 + 100 = 300) plus the reused code (600), giving 610 – 300 + 600 = 910 LOC as the correct final total LOC.Although size accounting may seem unnecessarily complex, after several releases of a large program you may need to know where all of the code came fromand the effort required to develop it. This accounting scheme permits you to findthis out. It also gives you a way to precisely account for all of the size changes in alarge number of releases. This exact approach can be used to track the sizes of documents, databases, or any other product for which you have defined size measures.3.5 Using Size DataThe principal ways to use size data are in planning, quality management, andprocess analysis. The following paragraphs describe how to use size measures inplanning, their value in assessing program quality, and how they help in evaluating your personal work.3.5 Using Size Data 45Added andModified135 LOCVersion 1Base program450 LOCVersion 2New program910 LOCDeleted200 LOCAdded60 LOCNewReusableReused600 LOCUnmodified175 LOCModified75 LOCFIGURE 3.4 THE VERSION 2 SIZE ACCOUNTING EXAMPLEUsing Size Measures for Planning
In planning a development job, if you have a defined size measure and historical
size and time data, you can use these data to accurately estimate the size of the
new product. With these same data, you can also accurately estimate the development effort. For the PSP exercises in this book, I suggest that you use the added
and modified code (or database elements) and not the deletions or other unmodified inclusions in estimating development effort. The effort to add or modify code
in these exercise programs will probably be roughly the same, while the effort required to delete or include a previously developed line will generally be much less.
For other kinds of work, however, you might make different choices. In maintenance work, for example, the effort required to delete a line could take as much or
more time than the effort required to add or modify a line. Examine each situation
and be guided by your data. Some methods for making such choices are discussed
in Chapter 5.
Assessing Program Quality
In evaluating program quality, it is often helpful to make cross-product comparisons. For example, dividing the number of defects found in a phase by that program’s size gives the program’s defect density for that phase. This is important in
planning projects because testing, maintenance, and service costs are generally
closely related to a program’s defect content at various points in the process. With
data on similar programs, you can use estimates of defect density and size to estimate testing, maintenance, and service costs. The defect-density measure can partially compensate for size differences among programs and take advantage of the
historical data for a larger number of prior projects.
In calculating defect density, count only the code added and modified during
development. When considering the relative quality of several finished programs,
however, consider their total size. Although I know of no published data on this
point, my experiences at IBM suggest that total program size correlates most
closely with product service costs. Although this may seem strange, it is logical
when you realize that, for all but very poor-quality products, defect-related costs
are only a small part of total service costs. At IBM, we found that the total number of support calls was more closely related to total program size than to the
added and modified size of each release. Once you have sufficient data, you can
decide what method works best for you and your products.
For program quality, defect density is generally measured in defects per 1,000
LOC, or KLOC. For finished products, however, the most suitable measure is defects
per 1,000,000 LOC, or defects per MLOC. For measures of database work, document
writing, or other product development, defects are generally counted per 100 or 1,000
elements, depending on which measure gives numbers between about 10 and 100.
46 Chapter 3 Measuring Software Size
Every counting choice has advantages and disadvantages. Using total program
size as a quality measure is most appropriate when small modifications are not significant. However, an unpublished IBM study found that small code modifications
were 39 times as error-prone as new development when measured in defects per
modified LOC (Humphrey 1989). Conversely, counting only added and modified
code would ignore any quality problems with the large inventory of existing code.
If this existing code had any significant defect content, maintenance cost estimates
would then likely be too low. In determining the relative quality of several releases
of a single program, one is generally interested in both the defect density for the
added and modified code and the defect density of the total product. Again, when
in doubt, gather the data and see what works best in your particular situation.
Evaluating Your Personal Work
For the PSP, the principal focus is on the quality of your personal process. Here,
you should probably use data on added and modified database objects, lines of
code, or other suitable measures to make the quality analyses in this book. However, you should also keep track of the size of the reused, added, deleted, and modified code. The PSP process shows you how to do this.
đang được dịch, vui lòng đợi..
