Download presentation
Presentation is loading. Please wait.
Published byCharlotte Burke Modified over 9 years ago
1
SOFTWARE METRICS
2
Software Process Revisited The Software Process has a common process framework containing: u framework activities - for all software projects u work tasks u project milestones u software work products and deliverables u quality assurance points u umbrella activities - occur throughout the process u software quality assurance u software configuration management u software metrics or measurement
3
Measurement Measurement is fundamental to engineering ‘ When you can measure what you are speaking about and express it in numbers, you know something about it; but when you cannot measure, when you cannot express it in numbers, your knowledge is of a meager and unsatisfactory kind’. (Lord Kelvin)
4
Software Metrics Software Metrics refers to measurements relating to computer software. Software Metrics can assist in: –Improving the software process by: Assessing productivity and estimating Controlling the project and its quality –Assessing the quality of a software product
5
Scope of Software Metrics u Software Metrics has two main fields of application: –Measure/assessment of a software product or process (eg a baseline – as it is now) –Prediction of critical features involved in a software project (ie a future estimate)
6
Software Product/Process Measurement u An integral part of the Project Plan u Aims to provide data which can be used to better control the production of software “You cannot control what you cannot measure” Tom de Marco (1982)
7
The Need for Software Metrics Software Production suffers from –Excessive Costs (especially Maintenance) –Low Productivity & Poor Quality –Lack of Standards, Professionalism because we fail to set measurable targets: –Measure the ‘real’ costs in projects –Quantify the quality –Properly evaluate new tools and techniques
8
The Need for Software Metrics.... Managers need to: –Measure System Costs to determine a realistic price –Measure Productivity of Staff, to set company-wide productivity goals –Measure ‘whole of system’ costs to better estimate complexity, schedule, resources and budgets –Measure the ‘added value’ of the project to the organisation
9
The Need for Software Metrics.... u Software Developers need to: –Monitor the quality of evolving systems by making regular process measurements –Specify quality and performance requirements in measurable terms –Identify potentially complex components –Measure the reliability of the product –Measure the quality of software, to determine methods, baselines, targets etc
10
Main Issues Software Metrics are used to help improve these aspects of a system: u Visibility u Quality u Productivity u Planning and control
11
Cost Estimation Process
12
To estimate the Cost of a system –it is important to know the Size of the system –Typical Size measures are: LOC – Lines of Code FP – Function Points
13
Software Size and Complexity u Estimating/Measuring Software Size Measures must be: Useful for planning Precise Automatically countable Estimate must be: Available early in the life-cycle u Estimation of Effort requires knowledge of the Complexity of a system Useful technique is COCOMO
14
Software Size... u Usefulness of Measures for Planning... –Development time is a function of program size the time it takes to develop a program depends upon the size (and the complexity) of the program –On a large project there may be many kinds of products –Product size measures should correlate to the effort/ hours you need to develop them –Source Lines of Code (SLOC) is a common size measure
15
LOC... u Lines of Code (LOC) or SLOC – Source Lines of Code Defining LOC »use complete definitions »you or your organisation should develop a Standard »(eg C++ SLOC Counting Standard – refer Attachment)
16
LOC... u What factors influence a definition of LOC? –Language –Count Type: Logical or physical –Compiler Directives –Comments »Not general practice to include comments but there should be a coding standard to cover this »Comments are part of the Eiffel standard so should be included in the LOC –Blank lines - not usually counted
17
LOC... u What factors influence a definition of LOC? –Statement Type »Executable - but what about u class_monitor.my_menu.activate u thisPage.PrintL(Mylist.GetString(ThisData,1)) u Logical constructs if..then..else u Reused code »Declarations u class MONITOR I,J : INTEGER u Preconditions, postconditions u begin..end
18
LOC... u Physical LOC Counters –Simplest type of counter –Ignore blank lines –Comment lines? –It is useful to keep totals for each program unit »What units should we keep totals for? (Eiffel class?) »How would we determine the start / end of a unit? Exercise: Produce a Physical LOC count standard for Eiffel
19
LOC... u Logical LOC Counters Works the same as a Physical LOC counter, but Line-counter stepping is more complex »Establish a logical line-count standard »No one counting method superior to another »BE CONSISTENT! You could set coding standards to write one Logical LOC per line then you would combine two methods in one.
20
LOC... Using the LOC Count u Measurement Types –An Eiffel LOC count is different from »a C++ LOC count »an Assembler LOC count –You should not mix LOC counts for »test code, support code, product code
21
LOC... Using the LOC Count... u Meaning of LOC –If 2 programmers code the same program »Programmer A produced 1200 LOC in 117 hours »Programmer B produced 793 LOC in 61 hours –therefore Programmer B »took much less time, »produced 30% more LOC per hour What does LOC tell us?
22
LOC... u LOC and Project Evaluation –Estimated time to develop Historical information from the same type of project will give an estimated LOC per working hour –Total defects found per LOC or defects/KLOC A standard measurement –Maintenance Small code changes to large programs are a significant quality concern Small code changes are almost 40 times as error prone as new development
23
LOC... Counting Issues –For software reuse: Do we count reused code? –Reused code affects: Definition of productivity – LOC per day Quality measurement – defects per KLOC –If reuse should be rewarded, it should be counted!!! –For maintenance: Do we count modified code and deleted code?
24
LOC... u LOC Counting Methods –You can get almost any numbers you want... Option LOCProductivity (LOC/hour) Added 5008.33 Added + Modified 600 10.00 Added + Modified + Deleted 800 13.33 Added + Modified + Reused 1200 20.00 Added + Modified + Deleted + Reused 1400 23.33 Total Finished Product 900 15.00
25
LOC... u Problems with LOC for Estimation Hard to judge at project start All software projects unique Historical data may assist Need to determine the difference between new project and last Need a proxy, a stand-in for LOC
26
OO Metrics Proxies 1. Classes as Proxies Satisfy criteria: »Related to development effort »Automatically countable »easily visualized at project start 2. Routines/Features as Proxies »Gives finer-grained measure »You could weight a class by the number of routines it contains
27
OO Metrics... Categories of Classes Three broad categories of classes in an application: »Model u application classes »View u menus, windows etc. »Controller u Commands Do the classes in each category exhibit different size characteristics? Is the code in each easier or harder to write?
28
OO Metrics... For your assignment, calculate: u For each class category: Number of classes For each class: For each routine implemented here LOC count for each routine Average length / class in the category u Note the difference –In average length of class / category
29
Summary ‘You cannot control what you cannot measure’ Tom de Marco
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.