sqe(lecture 7)

Upload: gau1119

Post on 07-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 SQE(Lecture 7)

    1/26

    Lines Of Code (LOC) Metrics

    Lines of code (LOC) is a software quality

    metric used to measure the size of a software

    program by counting the number of lines in the text

    of the program's source code.

    There are two major types of LOC measures:

    Physical LOC and Logical LOC.

  • 8/6/2019 SQE(Lecture 7)

    2/26

    Continue.

    Physical LOC is a count of lines in the text of the

    program's source code including comment lines.

    Logical LOC measure the number of "statements",

    but varies according to specific computer languages.

    EX: Logical LOC measure for C Programming is the

    number of statement-terminating semicolons.

  • 8/6/2019 SQE(Lecture 7)

    3/26

    Continue

    Example:

    for (i = 0; i < 100; i += 1) printf("hello"); /* How

    many lines of code is this? */

    1. Physical LOC = 1

    2. Logical LOC= 23. Comment line=1

  • 8/6/2019 SQE(Lecture 7)

    4/26

    Continue.

    /* Now how many lines of code is this? */

    for (i = 0; i < 100; i += 1)

    {

    printf("hello");

    Printf(thank U);

    }

    1. Physical LOC=6

    2. Logical LOC=3

    3. Comment line=1

  • 8/6/2019 SQE(Lecture 7)

    5/26

    There are various methods and algorithms within the

    same language to count LOC, describe by Jones

    (1986)1 Count only executable lines.

    2 Count executable lines and data definition or data

    manipulation statements.

    ex:{

    int a;

    /* ... */

    EXEC SQL SELECT salary INTO :a FROM Employee

    WHERE SSN=876543210;

    /* ... */

    printf("The salary is %d\n", a); /* ... */

    }

  • 8/6/2019 SQE(Lecture 7)

    6/26

    Continue

    3. Count executable lines, data definition, andcomments.

    4. Count data definition, comment, and job control

    language (scripting language used on IBM

    mainframe operating systems to instruct the

    system on how to run a batch job or start asubsystem.

  • 8/6/2019 SQE(Lecture 7)

    7/26

    Continue

    According to Boehm (1981) the LOC counting

    method counts lines as physical lines and includes

    executable lines, data definitions, and comments.

    In Software Engineering Metrics and Models by Conte et

    al. (1986), LOC is defined as follows:

    LOC is any line of program text that is not a commentor blank line, this specifically includes all lines

    containing program headers, declarations, and

    executable and non-executable statements.

  • 8/6/2019 SQE(Lecture 7)

    8/26

    When a new software product is released for the firsttime and when a certain LOC count method is

    specified.

    For example, suppose the, product has a total of50

    KLOC, the defect rate for this product during thenext two years is 2.0 defects per KLOC.

    For subsequent versions of the product, one needs to

    measure the quality of the entire product as well as

    the portion of the product that is new.

  • 8/6/2019 SQE(Lecture 7)

    9/26

    Line of code defect rate

    At IBM Rochester(U.S) The LOC count is based on

    source instruction (Logical LOC includes executable

    code and data definition but exclude comments).

    Two types of metrics to measure LOC ofnew andchanged source instruction.

    1) Shipped source instruction(Current release).(SSI)2) Changed source instruction.(CSI)

  • 8/6/2019 SQE(Lecture 7)

    10/26

    Continue

    Relation between SSI count and CSI count

    SSI (current release) = SSI (previous release) + CSI (new

    and changed code instructions for current release)

    deleted code (usually very small) changed code (to

    avoid double count in both SSI and CSI)

  • 8/6/2019 SQE(Lecture 7)

    11/26

    Continue

    There are various defect rate metrics per thousandSSI or per thousand CSI are as follows.

    (1) Total defects per KSSI (a measure of code

    quality of the total product).

    (2) Field defects (which are found bycustomers) per KSSI (a measure of defect rate in the

    field).

    (3) Release-origin defects (field and internal) per

    KCSI (a measure of development quality)

    (4) Release-origin field defects per KCSI (a

    measure of development quality per defects

    found by customers)

  • 8/6/2019 SQE(Lecture 7)

    12/26

    Function Point Metric (FP)

    Proposed byAlbrecht(1983).

    It can be used to easily estimate the size of thesoftware product directly from the problem

    specification.

    This in contrast to the LOC metric, where the sizecan be determined after the product has fully been

    developed.

  • 8/6/2019 SQE(Lecture 7)

    13/26

    Continue.

    Basic idea behind (FP) is, size of the software

    product is directly depend on the number of

    different functions or features it supports.

    The function points are derived using an empirical

    relationship based on direct measure ofsoftwares

    information domain.

    Information domains are defined by.

  • 8/6/2019 SQE(Lecture 7)

    14/26

    Continue

    Number of external inputs.(EIs).

    Number of external outputs(EOs).

    Number of external inquiries(EQs).

    Number of internal logical files(ILFs).

    Number of external interface files(EIFs).

  • 8/6/2019 SQE(Lecture 7)

    15/26

    Continue.

    Number of external Inputs(EIs):

    Each data item input by the user. Data items

    should be distinguished from users inquiries, such

    as Print-account-balance.

    Number of external outputs (EOs):

    The outputs considered refers to report printed,

    screen output, error message produced etc.

  • 8/6/2019 SQE(Lecture 7)

    16/26

    Continue

    Number of external inquiries(EQs):

    number of distinct queries which can be made by

    the users. These inquiries are users command which

    requires specific action by the system.

    Number of internal logical files(ILFs):

    Each logical file is counted. A logical file is a groupof logically related data. It can be a data structure.

  • 8/6/2019 SQE(Lecture 7)

    17/26

    Continue..

    Number of external interface files(EIFs):

    Interfaces used to exchange information withother systems. Examples of such interfaces are data

    files on tapes, disks, communication link with other

    system etc.

  • 8/6/2019 SQE(Lecture 7)

    18/26

  • 8/6/2019 SQE(Lecture 7)

    19/26

    Continue

    Once these data have been collected, a complexity

    value should be given for each information domain

    after validated by observations over many projects.

    Organization that used function point method

    developed criteria for determining whether a

    particular entry is simple, average, orcomplex.

  • 8/6/2019 SQE(Lecture 7)

    20/26

  • 8/6/2019 SQE(Lecture 7)

    21/26

    Continue

    Now the function point can be calculated in two steps.

    1) The first step is to compute the unadjusted

    function points(UFP).

    Ex: In case of average information domain value UFP willbe

    UFP = (External inputs(EIs))*4 + External outputs(EOs)*5

    + External inquiries(EQs)*4 + Internal logical files(ILFs)*10 + External interface files(EIFs)*7

  • 8/6/2019 SQE(Lecture 7)

    22/26

    Continue.

    2. Second step is to compute the technical complexityfactor(TCF).

    The TCF refines the UFP measure by considering 14

    other factors based on response to the following

    questions.

    Does the system require reliable backup and

    recovery?

    Are specialized data communication required totransfer information to or from the application?

    Are there distributed processing functions?

    Is performance critical?

  • 8/6/2019 SQE(Lecture 7)

    23/26

    Will the system run in an existing, heavily utilized

    operational environments?

    Does the system requires on-line data entry?

    Does the on-line data entry require the inputtransaction to be built over multiple screens or

    operations?

    Are the ILFs updated online?

    Are the input, output, files, or inquiries complex?

  • 8/6/2019 SQE(Lecture 7)

    24/26

    Is the internal processing complex?

    Is the code designed to be reusable?

    Are conversion and installation include in the design?

    Is the system designed for multiple installation in

    different organizations?

    Is the application designed to facilitate change and for

    ease of use by the user?

  • 8/6/2019 SQE(Lecture 7)

    25/26

    Each of these 14 factors is assign a value ranging

    from 0 to 6.

    The resulting values are summed yielding total degree

    of influence(DI).

    The TCF is calculated using the formula

    TCF = (0.65 + 0.01*DI)

    DI can vary from 0 to 70

    TCF can vary from 0.65 to 1.35.

    Finally FP= UFP*TCF

  • 8/6/2019 SQE(Lecture 7)

    26/26

    Problem

    A system has 12 external inputs, 24 external

    outputs, fields 30 different external queries,

    manages 4 internal logical files, and theinterfaces with 6 different legacy system(6

    EIFs). All of these data are of average

    complexity and degree of influence is 46.Calculate FP.