Analysis Of Source Lines Of Code(SLOC) Metric



Similar documents
EVALUATING METRICS AT CLASS AND METHOD LEVEL FOR JAVA PROGRAMS USING KNOWLEDGE BASED SYSTEMS

Unit 11: Software Metrics

Baseline Code Analysis Using McCabe IQ

Software Metrics in Static Program Analysis

International Journal of Computer Science Trends and Technology (IJCST) Volume 3 Issue 4, Jul-Aug 2015

Exercise 12 " Project Management "

Software Metrics. Lord Kelvin, a physicist. George Miller, a psychologist

Different Approaches to White Box Testing Technique for Finding Errors

APPROACHES TO SOFTWARE TESTING PROGRAM VERIFICATION AND VALIDATION

Measuring Software Complexity to Target Risky Modules in Autonomous Vehicle Systems

Article 3, Dealing with Reuse, explains how to quantify the impact of software reuse and commercial components/libraries on your estimate.

Chap 4. Using Metrics To Manage Software Risks

Programming with Java GUI components

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction

Idea: Measuring the Effect of Code Complexity on Static Analysis Results

The «SQALE» Analysis Model An analysis model compliant with the representation condition for assessing the Quality of Software Source Code

Software Testing & Analysis (F22ST3): Static Analysis Techniques 2. Andrew Ireland

Homework/Program #5 Solutions

Component visualization methods for large legacy software in C/C++

Mining Metrics to Predict Component Failures

STUDY AND ANALYSIS OF AUTOMATION TESTING TECHNIQUES

Improved Software Testing Using McCabe IQ Coverage Analysis

Using Karel with Eclipse

Capabilities of a Java Test Execution Framework by Erick Griffin

Tutorial Reference Manual. Java WireFusion 4.1

JiST Graphical User Interface Event Viewer. Mark Fong

Object-Oriented Software Engineering THE TOOLS OF THE TRADE CHAPTER 5. Stephen R. Schach 5.1 Stepwise Refinement.

5.17 GUI. Xiaoyi Jiang Informatik I Grundlagen der Programmierung

Project Planning and Project Estimation Techniques. Naveen Aggarwal

EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer

CS 335 Lecture 06 Java Programming GUI and Swing

Definitions. Software Metrics. Why Measure Software? Example Metrics. Software Engineering. Determine quality of the current product or process

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

IMPROVING JAVA SOFTWARE THROUGH PACKAGE STRUCTURE ANALYSIS

Basic Unix/Linux 1. Software Testing Interview Prep

Minimizing code defects to improve software quality and lower development costs.

Benefits of Test Automation for Agile Testing

Lesson Plan. Course Title: Advanced Computer Programming Session Title: Project Management Basics

Moving from CS 61A Scheme to CS 61B Java

Chapter 24 - Quality Management. Lecture 1. Chapter 24 Quality management

Finally, Article 4, Creating the Project Plan describes how to use your insight into project cost and schedule to create a complete project plan.

Integrating Unit Testing Into A Software Development Team s Process

METHODOLOGIES AND TOOLS FOR THE SOFTWARE QUALITY ASSURANCE COURSE *

Testing, What is it Good For? Absolutely Everything!

The ROI of Test Automation

Network (Tree) Topology Inference Based on Prüfer Sequence

A methodology for measuring software development productivity using Eclipse IDE

A Case study based Software Engineering Education using Open Source Tools

Automated Data Collection for Usability Evaluation in Early Stages of Application Development

file://c:\dokumente und Einstellungen\Marco Favorito\Desktop\ScanCmds.html

SQLFlow: PL/SQL Multi-Diagrammatic Source Code Visualization

Quality Analysis with Metrics

GSPIM: Graphical Visualization Tool for MIPS Assembly

THE THREE ASPECTS OF SOFTWARE QUALITY: FUNCTIONAL, STRUCTURAL, AND PROCESS

Using Eclipse CDT/PTP for Static Analysis

Parsing Technology and its role in Legacy Modernization. A Metaware White Paper

Useful Automated Software Testing Metrics

// Correntista. //Conta Corrente. package Banco; public class Correntista { String nome, sobrenome; int cpf;

1 White-Box Testing by Stubs and Drivers

CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus

Advanced TTCN-3 Test Suite validation with Titan

Tool Support for Inspecting the Code Quality of HPC Applications

Latest Research and Development on Software Testing Techniques and Tools

Software Requirements Metrics

Complexity Analysis of Simulink Models to improve the Quality of Outsourcing in an Automotive Company. Jeevan Prabhu August 2010

Comparative Analysis of Open Source Automated Software Testing Tools: Selenium, Sikuli and Watir

Automated Software Testing by: Eli Janssen

Classes and Objects in Java Constructors. In creating objects of the type Fraction, we have used statements similar to the following:

Extending Desktop Applications to the Web

Module 11. Software Project Planning. Version 2 CSE IIT, Kharagpur

Measurement Information Model

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Effective unit testing with JUnit

The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings

Course/Year W080/807 Expected Solution Subject: Software Development to Question No: 1

Lesson 1 Introduction to Rapid Application Development using Visual Basic

Efficiency Metrics. Tamanna Siddiqui 1, Munior Ahmad Wani 2 and Najeeb Ahmad Khan 3

CS170 Lab 11 Abstract Data Types & Objects

A Review and Analysis of Software Complexity Metrics in Structural Testing

Introduction to Automated Testing

Master of Sciences in Informatics Engineering Programming Paradigms 2005/2006. Final Examination. January 24 th, 2006

Coverity White Paper. Effective Management of Static Analysis Vulnerabilities and Defects

Computer Programming In QBasic

FSW QA Testing Levels Definitions

A QTI editor integrated into the netuniversité web portal using IMS LD

Formal Software Testing. Terri Grenda, CSTE IV&V Testing Solutions, LLC

public class Craps extends JFrame implements ActionListener { final int WON = 0,LOST =1, CONTINUE = 2;

Securing PHP Based Web Application Using Vulnerability Injection

The role of Software Metrics on Software Development Life Cycle

Research Article Predicting Software Projects Cost Estimation Based on Mining Historical Data

Design and Code Complexity Metrics for OO Classes. Letha Etzkorn, Jagdish Bansiya, and Carl Davis. The University of Alabama in Huntsville

Automated Software Testing With Macro Scheduler

Object Oriented Software Design

Transcription:

Analysis Of Source Lines Of Code(SLOC) Metric Kaushal Bhatt 1, Vinit Tarey 2, Pushpraj Patel 3 1,2,3 Kaushal Bhatt MITS,Datana Ujjain 1 kaushalbhatt15@gmail.com 2 vinit.tarey@gmail.com 3 pushpraj.patel@yahoo.co.in Abstract Source lines of code (SLOC) is a software 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. SLOC is typically used to predict the amount of effort that will be required to develop a program, as well as to estimate programming productivity or maintainability once the software is produced.there are some drawbacks in SLOC metrics that affect the quality of software because of SLOC metric output is used as a input in other Software Estimation methods Like COCOMO Model. Keywords SLOC, Metrics, Software Estimation, COCOMO, Performance Analysis I. INTRODUCTION There sometimes is a decidedly dark side to SLOC software metric that many of us have observed, but few have openly discussed. It is clear to us that we often get what we ask for with software metrics and we sometimes get side effects from the metric that overshadow any value we might derive from the metrics information. Whether or not our models are correct, and regardless of how well or poorly we collect and compute software metrics, people s behaviors change in predictable ways to provide the answers management asks for when metrics are applied. For this reasons we Consider Source lines of code metrics for our analysis. SLOC Metric works on Source Lines of code but when we talk about the different Programming Languages the Lines of code to perform task is vary language to language because different languages have different structures. Our in-depth analysis in this field provide a comprehensive view to understand what SLOC metric do and how much one can rely on SLOC metric. II. ADVANTAGE AND DISADVANTAGES OF LOC METRICS Advantages:- 1. Scope for Automation of Counting: Since Line of Code is a physical entity; manual counting effort can be easily eliminated by automating the counting process. Small utilities may be developed for counting the SLOC in a program. However, a code counting utility developed for a specific language cannot be used for other languages due to the syntactical and structural differences among languages. 2. An Intuitive Metric: Line of Code serves as an intuitive metric for measuring the size of software because it can be seen and the effect of it can be visualized. Function points are said to be more of an objective metric which cannot be imagined as being a physical entity, it exists only in the logical space. This way, LOC comes in handy to express the size of software among programmers with low levels of experience [4]. Disadvantages:- 1. Lack of Accountability: Lines of code measure suffers from some fundamental problems. Some think it isn't useful to measure the productivity of a project using only results from the coding phase, which usually accounts for only 30% to 35% of the overall effort [2]. 2. Lack of Cohesion with Functionality: Though experiments have repeatedly confirmed that effort is highly correlated with SLOC, functionality is less well correlated with SLOC. That is, skilled developers may be able to develop the same functionality with far less code, so one program with less SLOC may exhibit more functionality than another similar program. In particular, SLOC is a poor productivity measure of individuals, because a developer who develops only a few lines may still be more productive than a developer creating more lines of code - even more: some good refactoring like "extract method" to get rid of redundant code and keep it clean will mostly reduce the lines of code[2]. 3. Adverse Impact on Estimation: Because of the fact presented under point 1, estimates based on lines of code can adversely go wrong, in all possibility. 4. Developer s Experience: Implementation of a specific logic differs based on the level of experience of the developer. Hence, number of lines of code differs from person to person. 150

An experienced developer may implement certain functionality in fewer lines of code than another developer of relatively less experience does, though they use the same language. 5. Difference in Languages: Consider two applications that provide the same functionality (screens, reports, databases). One of the applications is written in C++ and the other application written in a language like COBOL. The number of function points would be exactly the same, but aspects of the application would be different. The lines of code needed to develop the application would certainly not be the same. As a consequence, the amount of effort required to develop the application would be different (hours per function point). Unlike Lines of Code, the number of Function Points will remain constant. 6. Advent of GUI Tools: With the advent of GUI-based programming languages and tools such as Visual Basic, programmers can write relatively little code and achieve high levels of functionality. For example, instead of writing a program to create a window and draw a button, a user with a GUI tool can use drag-and-drop and other mouse operations to place components on a workspace. Code that is automatically generated by a GUI tool is not usually taken into consideration when using SLOC methods of measurement. This results in variation between languages; the same task that can be done in a single line of code (or no code at all) in one language may require several lines of code in another. 7. Problems with Multiple Languages: In today s software scenario, software is often developed in more than one language. Very often, a number of languages are employed depending on the complexity and requirements. Tracking and reporting of productivity and defect rates poses a serious problem in this case since defects cannot be attributed to a particular language subsequent to integration of the system. Function Point stands out to be the best measure of size in this case. 8. Lack of Counting Standards: There is no standard definition of what a line of code is. Do comments count? Are data declarations included? What happens if a statement extends over several lines? These are the questions that often arise. Though organizations like SEI and IEEE have published some guidelines in an attempt to standardize counting, it is difficult to put these into practice especially in the face of newer and newer languages being introduced every year. 9. Psychology of Programmer: A programmer whose productivity is being measured in lines of code will have an incentive to write unnecessarily verbose code. The more management is focusing on lines of code, the more incentive the programmer has to expand his code with unneeded complexity. This is undesirable since increased complexity can lead to increased cost of maintenance and increased effort required for bug fixing. III. MEASUREMENT OF LOC METRIC For measurement of SLOC Metric We can use Metric Computational Tool (LOC Metrics). [6] Tool Compute the following aspects of Source Code. 1. Physical Lines: Physical Lines are program's source code including comment lines. 2. Logical Lines: Logical Lines are number of executable statements. 3. Blank Lines: Lines in Code which is Blank. 4. Total Lines of code: Total Lines of code include Physical lines with Blank Lines 5. Executable Physical: Physical executable source lines of code is calculated as the total lines of source code minus blank lines and comment lines.[4] 6. Executable Logical: Executable Logical is number of statements that is executed. 7. Comment: Comment lines in code. 8. Words in Comment: Total No. of words in comment lines. 9. Header Comment: Comment of Header Part. 10. Header Words: Total words in Header Comment. 11. McCab VG Complexity: The McCab complexity is directly measures the number of linearly independent paths through a program's source code. The complexity is computed using the control flow graph of the program: the nodes of the graph correspond to indivisible groups of commands of a program, and a directed edge connects two nodes if the second command might be executed immediately after the first command[7]. Mathematical Representation of McCabe complexity is:- M = E N + 2P Where M= Complexity E= Number of Edges in graph N= Number of Nodes in graph P= Number of connected component(exit nodes) 151

Kaner s Ten Measurement Factors [1] 1. The purpose of the measure. What the measurement will be used for. 2. The scope of the measurement. How broadly the measurement will be used. 3. The attribute to be measured. E.g., a product s readiness for release. 4. The appropriate scale for the attribute. Whether the attribute s mathematical properties are rational, interval, ordinal, nominal, or absolute. 5. The natural variation of the attribute. A model or equation describing the natural variation of the attribute. E.g., a model dealing with why a tester may find more defects on one day than on another. 6. The instrument that measures the attribute. E.g., a count of new defect reports. 7. The scale of the instrument. Whether the mathematical properties of measures taken with the instruments are rational, interval, ordinal, nominal, or absolute. 8. The variation of measurements made with this instrument. A model or equation describing the natural variation or amount of error in the instrument s measurements. 9. The relationship between the attribute and the instrument. A model or equation relating the attribute to the instrument. 10. The probable side effects of using this instrument to measure this attribute. E.g., changes in tester behaviors because they know the measurement is being made. IV. Code : import java.awt.*; import javax.swing.*; import java.awt.event.*; REALIZATION public class Calculator implements ActionListener{ fmi1 = new MenuItem(" Copy "); fmi2 = new MenuItem(" Paste "); fmi3 = new MenuItem(" Quit "); EditMenu.add(fmi1); EditMenu.add(fmi2); 152 ("="); backspace = new Button ("Backspace"); clear = new Button ("C"); public void launchframe(){ tfield.settext("0."); tfield.setenabled(false); p6.add(badd); p6.add(equals); GridLayout (6, 1) ); f.setmenubar(menubar); f.pack(); // ACTION LISTENERS fmi1.addactionlistener(this); fmi2.addactionlistener(this); fmi3.addactionlistener(this); /* ------------ START OF ACTION EVENTS --------- --- */ public void actionperformed(actionevent a){ tfield.settext(value); if(a.getsource()==num7){ value+=7; tfield.settext(value);

International Journal of Emerging Technology and Advanced Engineering /* -- EQUALS ACTION -- */ if(a.getsource()==equals){ value=""; v2 = Double.parseDouble(tField.getText()); if(o=='+'){ if(o=='%'){ ctr=0; answer = v1 % v2; tfield.settext("" +answer); value=""; v1=null; v2=null; else{ Metric Calculation By SLOC calculation Software [3]:- /* -- EQUALS ACTION -- */ // END OF ACTION EVENTS public static void main (String args[]){ Calculator s = new Calculator(); s.launchframe(); The following results has been generated for the calculator code written in java using the SLOC Calculation Compilation of Code in tool:- 153

V. CONCLUSION SLOC is most useful Metric in Software Estimation but Some restrictions that is involved in SLOC Metric makes it vurnable for relying on it. Here we can present the depth Analysis of SLOC Metric for the purpose to expose some of its disadvantages and provide knowledge of SLOC Metric Measurement. REFERENCES [1] Kaner, C. Rethinking Software Metrics, Software Testing and Quality Engineering vol. 2, no. 2 (2000). [2] The Darker Side of Metrics by Douglas Hoffman [3] http://www.locmetrics.com [4] Wheeler, David A. (June 2001). "Counting Source Lines of Code (SLOC)" [5] Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric NIST Special Publication [6] Park, Robert E., et al.. "Software Size Measurement: A Framework for Counting Source Statements" [7] Rich Sharpe. "McCabe Cyclomatic Complexity: the proof in the pudding 154