SlideShare uma empresa Scribd logo
1 de 8
DEFECT PREVENTION SOFTWARE
• Tools for static analysis of source code: PMD Marker,
FindBugs, Metrics Marker
• Tools for determining software quality metrics for source
code: VizzMaintenance
• Tools for UML design critics: ArgoUML
• Tools for generating test cases from UML model of your code:
Smartesting
See static analysis report sample and software quality metrics
for sample class on following pages…
Here is sample CommaHyphenString.java source code
1 /**
2 *
3 * CommaHyphenString parses .properties file. It eliminates commas or low lines
4 * from .properties file so items in it( such as categories) could be properly
5 * showed on screen
6 */
7 import java.util.*;
8
9 public class CommaHyphenString {
10
11 //String s;
12 int lastIndex;
13 CommaHyphenString(){}
14
15
16 /** Eliminates commas, returns array of strings with low line
17 * @return String[]
18 */
19 String[] getWithLowLine(String s) {
20 int lastIndex = defineLast(s);
21 if(lastIndex==0){
22 String[] ss = new String[1];
23 ss[0] = s;
24 return ss;
25 } else {
26 int start = -1;
27 Vector v = new Vector();
28 int current = s.indexOf(',');
29 do {
30 v.addElement(s.substring(start+1,current));
31 start = current;
32 current = s.indexOf(',',current+1);
33 } while (start!=lastIndex);
34
35 String[] ss = new String[v.size()+1];
36 for(int i=0; i<v.size(); i++){
37 ss[i] = (String)v.elementAt(i);
38 }
39 ss[v.size()] = s.substring(lastIndex+1,s.length());
40 return ss;
41 }
42 }
43
44 /** Eliminates low line
45 * @return String[]
46 */
47 String[] getStringsOnly(String s){
48 String[] temp = this.getWithLowLine(s);
49 for (int i=0; i<temp.length; i++){
50 char[] tempChar = temp[i].toCharArray();
51 String k = "";
52 for (int j=0; j<tempChar.length; j++){
53 if(tempChar[j]=='_') tempChar[j]=' ';
54 k+=tempChar[j];
55 }
56 temp[i] = k;
57 }
58 return temp;
59 }
60
61
62 /** Returns categories with low line
63 * @return String[]
64 */
65 String[] getCategoriesHyphen(String s){
66 return this.getWithLowLine(s);
67 }
68
69 /** Returns categories
70 * @return String[]
71 */
72 String[] getCategories(String s){
73 return this.getStringsOnly(s);
74 }
75
76 /** Defines index of last comma in string
77 * @return integer
78 */
79 public int defineLast(String s){
80 int lastIndex = 0;
81 char c[] = s.toCharArray();
82 for (int i=0; i<c.length; i++){
83 if(c[i]==',') lastIndex=i;
84 }
85 return lastIndex;
86 }
87
88 }
Here are static analysis violations detected in CommaHyphenString.java
Description of static analysis violation Line Tool
All classes and interfaces must belong to a named package 9 PMD Marker
Unused field: CommaHyphenString.lastIndex 12 FindBugs
Use explicit scoping instead of the default package private level 12 PMD Marker
Document empty constructor 13 PMD Marker
Lines of Code in Method is 27 16
Metrics
Marker
Number of Statements is 28 16
Metrics
Marker
Avoid variables with short names like s 19 PMD Marker
Parameter 's' is not assigned and could be declared final 19 PMD Marker
Use explicit scoping instead of the default package private level 19 PMD Marker
Local variable 'lastIndex' could be declared final 20 PMD Marker
Avoid variables with short names like ss 22 PMD Marker
A method should have only one exit point, and that should be the last statement in the
method 24 PMD Marker
Avoid variables with short names like v 27 PMD Marker
Consider replacing this Vector with the newer java.util.List 27 PMD Marker
Local variable 'v' could be declared final 27 PMD Marker
Use ArrayList instead of Vector 27 PMD Marker
Avoid variables with short names like ss 35 PMD Marker
Lines of Code in Method is 16 44
Metrics
Marker
Avoid variables with short names like s 47 PMD Marker
Parameter 's' is not assigned and could be declared final 47 PMD Marker
Use explicit scoping instead of the default package private level 47 PMD Marker
Avoid using if statements without curly braces 53 PMD Marker
CommaHyphenString.getStringsOnly(String) concatenates strings using + in a loop 54 FindBugs
Prefer StringBuffer over += for concatenating strings 54 PMD Marker
Parameter 's' is not assigned and could be declared final 65 PMD Marker
Use explicit scoping instead of the default package private level 65 PMD Marker
Parameter 's' is not assigned and could be declared final 72 PMD Marker
Use explicit scoping instead of the default package private level 72 PMD Marker
Parameter 's' is not assigned and could be declared final 79 PMD Marker
Local variable 'c' could be declared final 81 PMD Marker
Avoid using if statements without curly braces 83 PMD Marker
Here are VizzMaintenance software quality metrics for CommaHyphenString.java class
Class Name Maintainability CBO CYC_Classes DAC DIT ILCOM LCOM LD LEN LOC LOD_Class MPC NAM NOC NOM
CommaHyphenString 0,136637872 0 1 0 0 0 25 0 17 80 0,167 0 6 0 5
Here are full names of VizzMaintenance software quality metrics (click on links for details)
Complexity
o Size
 Lines of Code (LOC)
o Interface Complexity
 Number of Attributes and Methods (SIZE2)
 Number Of local Methods (NOM)
o Structural Complexity
 McCabe Cyclomatic Complexity (CC)
 Weighted Method Count (WMC)
 Response For a Class (RFC)
Architecture and Structure
o Inheritance
 Depth of Inheritance Tree (DIT)
 Number Of Children (NOC)
o Coupling
o Afferent Coupling (Ca)
 Coupling Between Objects (CBO)
 Change Dependency Between Classes (CDBC)
 Change Dependency Of Classes (CDOC)
 Efferent Coupling (Ce)
 Coupling Factor (CF)
 Data Abstraction Coupling (DAC)
 Instability (I)
 Locality of Data (LD)
 Message Passing Coupling (MPC)
 Package Data Abstraction Coupling (PDAC)
o Cohesion
 Lack of Cohesion in Methods (LCOM)
 Improvement of LCOM (ILCOM)
 Tight Class Cohesion (TCC)
Design Guidelines and Code Conventions
o Documentation
 Lack Of Documentation (LOD)
o Code Conventions
Follow me on Facebook page
https://www.facebook.com/AutomatedTesting

Mais conteúdo relacionado

Mais procurados

Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...
Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...
Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...Mateus S. H. Cruz
 
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...Adam Mukharil Bachtiar
 
DBMask: Fine-Grained Access Control on Encrypted Relational Databases
DBMask: Fine-Grained Access Control on Encrypted Relational DatabasesDBMask: Fine-Grained Access Control on Encrypted Relational Databases
DBMask: Fine-Grained Access Control on Encrypted Relational DatabasesMateus S. H. Cruz
 
Dcom vs. corba
Dcom vs. corbaDcom vs. corba
Dcom vs. corbaMohd Arif
 
Refactoring - improving the smell of your code
Refactoring - improving the smell of your codeRefactoring - improving the smell of your code
Refactoring - improving the smell of your codevmandrychenko
 
Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...
Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...
Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...Mateus S. H. Cruz
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures CodingMax Kleiner
 
Implicit conversion and parameters
Implicit conversion and parametersImplicit conversion and parameters
Implicit conversion and parametersKnoldus Inc.
 
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...Khushboo Jain
 
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...Frank Nielsen
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScriptDIWE - Programming with JavaScript
DIWE - Programming with JavaScriptRasan Samarasinghe
 
Advanced programming topics asma
Advanced programming topics asmaAdvanced programming topics asma
Advanced programming topics asmaAbdullahJana
 
pointers, virtual functions and polymorphisms in c++ || in cpp
pointers, virtual functions and polymorphisms in c++ || in cpppointers, virtual functions and polymorphisms in c++ || in cpp
pointers, virtual functions and polymorphisms in c++ || in cppgourav kottawar
 
Privacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the Cloud
Privacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the CloudPrivacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the Cloud
Privacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the CloudMateus S. H. Cruz
 

Mais procurados (20)

Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...
Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...
Realizing Fine-Grained and Flexible Access Control to Outsourced Data with At...
 
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
DBMask: Fine-Grained Access Control on Encrypted Relational Databases
DBMask: Fine-Grained Access Control on Encrypted Relational DatabasesDBMask: Fine-Grained Access Control on Encrypted Relational Databases
DBMask: Fine-Grained Access Control on Encrypted Relational Databases
 
Dcom vs. corba
Dcom vs. corbaDcom vs. corba
Dcom vs. corba
 
Refactoring - improving the smell of your code
Refactoring - improving the smell of your codeRefactoring - improving the smell of your code
Refactoring - improving the smell of your code
 
Scala functions
Scala functionsScala functions
Scala functions
 
Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...
Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...
Fast, Private and Verifiable: Server-aided Approximate Similarity Computation...
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures Coding
 
Implicit conversion and parameters
Implicit conversion and parametersImplicit conversion and parameters
Implicit conversion and parameters
 
Algorithmic Notations
Algorithmic NotationsAlgorithmic Notations
Algorithmic Notations
 
Theory of Computation Unit 4
Theory of Computation Unit 4Theory of Computation Unit 4
Theory of Computation Unit 4
 
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
 
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScriptDIWE - Programming with JavaScript
DIWE - Programming with JavaScript
 
Advanced programming topics asma
Advanced programming topics asmaAdvanced programming topics asma
Advanced programming topics asma
 
09. Methods
09. Methods09. Methods
09. Methods
 
pointers, virtual functions and polymorphisms in c++ || in cpp
pointers, virtual functions and polymorphisms in c++ || in cpppointers, virtual functions and polymorphisms in c++ || in cpp
pointers, virtual functions and polymorphisms in c++ || in cpp
 
Privacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the Cloud
Privacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the CloudPrivacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the Cloud
Privacy-Preserving Multi-Keyword Fuzzy Search over Encrypted Data in the Cloud
 
Constructors and destructors in C++ part 2
Constructors and destructors in C++ part 2Constructors and destructors in C++ part 2
Constructors and destructors in C++ part 2
 

Destaque

Checking code-with-pmd
Checking code-with-pmdChecking code-with-pmd
Checking code-with-pmd3trg
 
Exercise E Answers Examples
Exercise E   Answers ExamplesExercise E   Answers Examples
Exercise E Answers ExamplesEMBS2007
 
Basic quality tools and others
Basic quality tools and othersBasic quality tools and others
Basic quality tools and othersLynja C. Refugio
 
The Challenge of Accepting Software
The Challenge of Accepting SoftwareThe Challenge of Accepting Software
The Challenge of Accepting SoftwareSQALab
 
HCI 3e - Ch 7: Design rules
HCI 3e - Ch 7:  Design rulesHCI 3e - Ch 7:  Design rules
HCI 3e - Ch 7: Design rulesAlan Dix
 
Software Development Life Cycle (SDLC)
Software Development Life Cycle (SDLC)Software Development Life Cycle (SDLC)
Software Development Life Cycle (SDLC)Angelin R
 

Destaque (8)

Checking code-with-pmd
Checking code-with-pmdChecking code-with-pmd
Checking code-with-pmd
 
Exercise E Answers Examples
Exercise E   Answers ExamplesExercise E   Answers Examples
Exercise E Answers Examples
 
Basic quality tools and others
Basic quality tools and othersBasic quality tools and others
Basic quality tools and others
 
091 Process Mapping
091 Process Mapping091 Process Mapping
091 Process Mapping
 
The Challenge of Accepting Software
The Challenge of Accepting SoftwareThe Challenge of Accepting Software
The Challenge of Accepting Software
 
HCI 3e - Ch 7: Design rules
HCI 3e - Ch 7:  Design rulesHCI 3e - Ch 7:  Design rules
HCI 3e - Ch 7: Design rules
 
Software Development Life Cycle (SDLC)
Software Development Life Cycle (SDLC)Software Development Life Cycle (SDLC)
Software Development Life Cycle (SDLC)
 
THE RTI ACT 2005 PRESENTATION
THE RTI ACT 2005 PRESENTATIONTHE RTI ACT 2005 PRESENTATION
THE RTI ACT 2005 PRESENTATION
 

Semelhante a DEFECT PREVENTION TOOLS AND METRICS

Csphtp1 06
Csphtp1 06Csphtp1 06
Csphtp1 06HUST
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2PVS-Studio
 
RailswayCon 2010 - Dynamic Language VMs
RailswayCon 2010 - Dynamic Language VMsRailswayCon 2010 - Dynamic Language VMs
RailswayCon 2010 - Dynamic Language VMsLourens Naudé
 
The operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerThe operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerAndrey Karpov
 
Procedures functions structures in VB.Net
Procedures  functions  structures in VB.NetProcedures  functions  structures in VB.Net
Procedures functions structures in VB.Nettjunicornfx
 
The Ring programming language version 1.8 book - Part 116 of 202
The Ring programming language version 1.8 book - Part 116 of 202The Ring programming language version 1.8 book - Part 116 of 202
The Ring programming language version 1.8 book - Part 116 of 202Mahmoud Samir Fayed
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Abou Bakr Ashraf
 
Csharp In Detail Part2
Csharp In Detail Part2Csharp In Detail Part2
Csharp In Detail Part2Mohamed Krar
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Palak Sanghani
 
Applying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedApplying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedPascal-Louis Perez
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework HelpC++ Homework Help
 
Java scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerJava scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerEdward Nyang'ali
 
Csphtp1 10
Csphtp1 10Csphtp1 10
Csphtp1 10HUST
 
The Ring programming language version 1.5.4 book - Part 82 of 185
The Ring programming language version 1.5.4 book - Part 82 of 185The Ring programming language version 1.5.4 book - Part 82 of 185
The Ring programming language version 1.5.4 book - Part 82 of 185Mahmoud Samir Fayed
 
Svd filtered temporal usage clustering
Svd filtered temporal usage clusteringSvd filtered temporal usage clustering
Svd filtered temporal usage clusteringLiang Xie, PhD
 

Semelhante a DEFECT PREVENTION TOOLS AND METRICS (20)

Csphtp1 06
Csphtp1 06Csphtp1 06
Csphtp1 06
 
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
Analysis of Haiku Operating System (BeOS Family) by PVS-Studio. Part 2
 
RailswayCon 2010 - Dynamic Language VMs
RailswayCon 2010 - Dynamic Language VMsRailswayCon 2010 - Dynamic Language VMs
RailswayCon 2010 - Dynamic Language VMs
 
The operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerThe operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzer
 
Procedures functions structures in VB.Net
Procedures  functions  structures in VB.NetProcedures  functions  structures in VB.Net
Procedures functions structures in VB.Net
 
Verilog
VerilogVerilog
Verilog
 
The Ring programming language version 1.8 book - Part 116 of 202
The Ring programming language version 1.8 book - Part 116 of 202The Ring programming language version 1.8 book - Part 116 of 202
The Ring programming language version 1.8 book - Part 116 of 202
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6
 
Csharp In Detail Part2
Csharp In Detail Part2Csharp In Detail Part2
Csharp In Detail Part2
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
 
Applying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedApplying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing Speed
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework Help
 
kotlin.pdf
kotlin.pdfkotlin.pdf
kotlin.pdf
 
Java scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerJava scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java Scanner
 
C++ tutorials
C++ tutorialsC++ tutorials
C++ tutorials
 
Csphtp1 10
Csphtp1 10Csphtp1 10
Csphtp1 10
 
3433 Ch10 Ppt
3433 Ch10 Ppt3433 Ch10 Ppt
3433 Ch10 Ppt
 
The Ring programming language version 1.5.4 book - Part 82 of 185
The Ring programming language version 1.5.4 book - Part 82 of 185The Ring programming language version 1.5.4 book - Part 82 of 185
The Ring programming language version 1.5.4 book - Part 82 of 185
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
 
Svd filtered temporal usage clustering
Svd filtered temporal usage clusteringSvd filtered temporal usage clustering
Svd filtered temporal usage clustering
 

Mais de Zarko Acimovic

Metrics for example Java project
Metrics for example Java projectMetrics for example Java project
Metrics for example Java projectZarko Acimovic
 
Elevator pitch for testing software architecture and software design
Elevator pitch for testing software architecture and software designElevator pitch for testing software architecture and software design
Elevator pitch for testing software architecture and software designZarko Acimovic
 
VizzMaintenance Eclipse Plugin Metrics
VizzMaintenance Eclipse Plugin MetricsVizzMaintenance Eclipse Plugin Metrics
VizzMaintenance Eclipse Plugin MetricsZarko Acimovic
 
Software defect prevention example project
Software defect prevention example projectSoftware defect prevention example project
Software defect prevention example projectZarko Acimovic
 
Example of-non-cohesive-methods
Example of-non-cohesive-methodsExample of-non-cohesive-methods
Example of-non-cohesive-methodsZarko Acimovic
 
Example of-method-with-cyclomatic-complexity-202
Example of-method-with-cyclomatic-complexity-202Example of-method-with-cyclomatic-complexity-202
Example of-method-with-cyclomatic-complexity-202Zarko Acimovic
 
Example of-method-with-cyclomatic-complexity-17
Example of-method-with-cyclomatic-complexity-17Example of-method-with-cyclomatic-complexity-17
Example of-method-with-cyclomatic-complexity-17Zarko Acimovic
 

Mais de Zarko Acimovic (7)

Metrics for example Java project
Metrics for example Java projectMetrics for example Java project
Metrics for example Java project
 
Elevator pitch for testing software architecture and software design
Elevator pitch for testing software architecture and software designElevator pitch for testing software architecture and software design
Elevator pitch for testing software architecture and software design
 
VizzMaintenance Eclipse Plugin Metrics
VizzMaintenance Eclipse Plugin MetricsVizzMaintenance Eclipse Plugin Metrics
VizzMaintenance Eclipse Plugin Metrics
 
Software defect prevention example project
Software defect prevention example projectSoftware defect prevention example project
Software defect prevention example project
 
Example of-non-cohesive-methods
Example of-non-cohesive-methodsExample of-non-cohesive-methods
Example of-non-cohesive-methods
 
Example of-method-with-cyclomatic-complexity-202
Example of-method-with-cyclomatic-complexity-202Example of-method-with-cyclomatic-complexity-202
Example of-method-with-cyclomatic-complexity-202
 
Example of-method-with-cyclomatic-complexity-17
Example of-method-with-cyclomatic-complexity-17Example of-method-with-cyclomatic-complexity-17
Example of-method-with-cyclomatic-complexity-17
 

Último

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 

Último (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

DEFECT PREVENTION TOOLS AND METRICS

  • 1. DEFECT PREVENTION SOFTWARE • Tools for static analysis of source code: PMD Marker, FindBugs, Metrics Marker • Tools for determining software quality metrics for source code: VizzMaintenance • Tools for UML design critics: ArgoUML • Tools for generating test cases from UML model of your code: Smartesting See static analysis report sample and software quality metrics for sample class on following pages…
  • 2. Here is sample CommaHyphenString.java source code 1 /** 2 * 3 * CommaHyphenString parses .properties file. It eliminates commas or low lines 4 * from .properties file so items in it( such as categories) could be properly 5 * showed on screen 6 */ 7 import java.util.*; 8 9 public class CommaHyphenString { 10 11 //String s; 12 int lastIndex; 13 CommaHyphenString(){} 14 15 16 /** Eliminates commas, returns array of strings with low line 17 * @return String[] 18 */ 19 String[] getWithLowLine(String s) { 20 int lastIndex = defineLast(s); 21 if(lastIndex==0){ 22 String[] ss = new String[1]; 23 ss[0] = s; 24 return ss; 25 } else { 26 int start = -1; 27 Vector v = new Vector(); 28 int current = s.indexOf(','); 29 do { 30 v.addElement(s.substring(start+1,current)); 31 start = current; 32 current = s.indexOf(',',current+1); 33 } while (start!=lastIndex); 34 35 String[] ss = new String[v.size()+1]; 36 for(int i=0; i<v.size(); i++){ 37 ss[i] = (String)v.elementAt(i); 38 }
  • 3. 39 ss[v.size()] = s.substring(lastIndex+1,s.length()); 40 return ss; 41 } 42 } 43 44 /** Eliminates low line 45 * @return String[] 46 */ 47 String[] getStringsOnly(String s){ 48 String[] temp = this.getWithLowLine(s); 49 for (int i=0; i<temp.length; i++){ 50 char[] tempChar = temp[i].toCharArray(); 51 String k = ""; 52 for (int j=0; j<tempChar.length; j++){ 53 if(tempChar[j]=='_') tempChar[j]=' '; 54 k+=tempChar[j]; 55 } 56 temp[i] = k; 57 } 58 return temp; 59 } 60 61 62 /** Returns categories with low line 63 * @return String[] 64 */ 65 String[] getCategoriesHyphen(String s){ 66 return this.getWithLowLine(s); 67 } 68 69 /** Returns categories 70 * @return String[] 71 */ 72 String[] getCategories(String s){ 73 return this.getStringsOnly(s); 74 } 75 76 /** Defines index of last comma in string 77 * @return integer 78 */
  • 4. 79 public int defineLast(String s){ 80 int lastIndex = 0; 81 char c[] = s.toCharArray(); 82 for (int i=0; i<c.length; i++){ 83 if(c[i]==',') lastIndex=i; 84 } 85 return lastIndex; 86 } 87 88 } Here are static analysis violations detected in CommaHyphenString.java Description of static analysis violation Line Tool All classes and interfaces must belong to a named package 9 PMD Marker Unused field: CommaHyphenString.lastIndex 12 FindBugs Use explicit scoping instead of the default package private level 12 PMD Marker Document empty constructor 13 PMD Marker Lines of Code in Method is 27 16 Metrics Marker Number of Statements is 28 16 Metrics Marker Avoid variables with short names like s 19 PMD Marker Parameter 's' is not assigned and could be declared final 19 PMD Marker Use explicit scoping instead of the default package private level 19 PMD Marker Local variable 'lastIndex' could be declared final 20 PMD Marker Avoid variables with short names like ss 22 PMD Marker A method should have only one exit point, and that should be the last statement in the method 24 PMD Marker Avoid variables with short names like v 27 PMD Marker Consider replacing this Vector with the newer java.util.List 27 PMD Marker Local variable 'v' could be declared final 27 PMD Marker Use ArrayList instead of Vector 27 PMD Marker Avoid variables with short names like ss 35 PMD Marker Lines of Code in Method is 16 44 Metrics Marker Avoid variables with short names like s 47 PMD Marker
  • 5. Parameter 's' is not assigned and could be declared final 47 PMD Marker Use explicit scoping instead of the default package private level 47 PMD Marker Avoid using if statements without curly braces 53 PMD Marker CommaHyphenString.getStringsOnly(String) concatenates strings using + in a loop 54 FindBugs Prefer StringBuffer over += for concatenating strings 54 PMD Marker Parameter 's' is not assigned and could be declared final 65 PMD Marker Use explicit scoping instead of the default package private level 65 PMD Marker Parameter 's' is not assigned and could be declared final 72 PMD Marker Use explicit scoping instead of the default package private level 72 PMD Marker Parameter 's' is not assigned and could be declared final 79 PMD Marker Local variable 'c' could be declared final 81 PMD Marker Avoid using if statements without curly braces 83 PMD Marker Here are VizzMaintenance software quality metrics for CommaHyphenString.java class Class Name Maintainability CBO CYC_Classes DAC DIT ILCOM LCOM LD LEN LOC LOD_Class MPC NAM NOC NOM CommaHyphenString 0,136637872 0 1 0 0 0 25 0 17 80 0,167 0 6 0 5
  • 6. Here are full names of VizzMaintenance software quality metrics (click on links for details) Complexity o Size  Lines of Code (LOC) o Interface Complexity  Number of Attributes and Methods (SIZE2)  Number Of local Methods (NOM) o Structural Complexity  McCabe Cyclomatic Complexity (CC)  Weighted Method Count (WMC)  Response For a Class (RFC) Architecture and Structure o Inheritance  Depth of Inheritance Tree (DIT)  Number Of Children (NOC) o Coupling o Afferent Coupling (Ca)
  • 7.  Coupling Between Objects (CBO)  Change Dependency Between Classes (CDBC)  Change Dependency Of Classes (CDOC)  Efferent Coupling (Ce)  Coupling Factor (CF)  Data Abstraction Coupling (DAC)  Instability (I)  Locality of Data (LD)  Message Passing Coupling (MPC)  Package Data Abstraction Coupling (PDAC) o Cohesion  Lack of Cohesion in Methods (LCOM)  Improvement of LCOM (ILCOM)  Tight Class Cohesion (TCC) Design Guidelines and Code Conventions o Documentation  Lack Of Documentation (LOD) o Code Conventions
  • 8. Follow me on Facebook page https://www.facebook.com/AutomatedTesting