Enviar pesquisa
Carregar
Code metrics
•
4 gostaram
•
1,290 visualizações
Tomasz Rękawek
Seguir
Tecnologia
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 23
Baixar agora
Baixar para ler offline
Recomendados
OOPs with Java - Packaging and Access Modifiers
OOPs with Java - Packaging and Access Modifiers
Hitesh-Java
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews
Hitesh-Java
Cso gaddis java_chapter2
Cso gaddis java_chapter2
mlrbrown
Review Session - Part -2
Review Session - Part -2
Hitesh-Java
Technical interview questions
Technical interview questions
Soba Arjun
Inner Classes
Inner Classes
Hitesh-Java
Top 20 basic java interview questions for SDET
Top 20 basic java interview questions for SDET
DevLabs Alliance
Session 11 - OOP's with Java - Packaging and Access Modifiers
Session 11 - OOP's with Java - Packaging and Access Modifiers
PawanMM
Mais conteúdo relacionado
Mais procurados
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance
Vb net xp_04
Vb net xp_04
Niit Care
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews
RatnaJava
Dev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdet
DevLabs Alliance
OOP with Java - Abstract Classes and Interfaces
OOP with Java - Abstract Classes and Interfaces
Hitesh-Java
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Edureka!
Object+oriented+programming+in+java
Object+oriented+programming+in+java
Ye Win
3. C# Guide Advance - To Print
3. C# Guide Advance - To Print
Chinthaka Fernando
Top 20 cucumber interview questions for sdet
Top 20 cucumber interview questions for sdet
DevLabs Alliance
OOP in Java
OOP in Java
wiradikusuma
Java interview question
Java interview question
varatharajanrajeswar
Extreme Interview Questions
Extreme Interview Questions
Ehtisham Ali
Java access modifiers
Java access modifiers
Khaled Adnan
C# Interview Questions | Edureka
C# Interview Questions | Edureka
Edureka!
Mais procurados
(14)
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
DevLabs Alliance Top 20 Software Testing Interview Questions for SDET - by De...
Vb net xp_04
Vb net xp_04
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews
Dev labs alliance top 20 basic java interview questions for sdet
Dev labs alliance top 20 basic java interview questions for sdet
OOP with Java - Abstract Classes and Interfaces
OOP with Java - Abstract Classes and Interfaces
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Top 50 .NET Interview Questions and Answers 2019 | Edureka
Object+oriented+programming+in+java
Object+oriented+programming+in+java
3. C# Guide Advance - To Print
3. C# Guide Advance - To Print
Top 20 cucumber interview questions for sdet
Top 20 cucumber interview questions for sdet
OOP in Java
OOP in Java
Java interview question
Java interview question
Extreme Interview Questions
Extreme Interview Questions
Java access modifiers
Java access modifiers
C# Interview Questions | Edureka
C# Interview Questions | Edureka
Destaque
Project quality (and test process) metrics
Project quality (and test process) metrics
Zbyszek Mockun
Test Metrics and KPIs
Test Metrics and KPIs
Devendra Singh
SlingQuery
SlingQuery
Tomasz Rękawek
CRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migration
Tomasz Rękawek
Agile Scrum in 60 minutes
Agile Scrum in 60 minutes
Syed Arh
Agile metrics - Measure and Improve
Agile metrics - Measure and Improve
WemanityUK
Agile Metrics
Agile Metrics
Mikalai Alimenkou
Agile Metrics
Agile Metrics
Andrzej Wiech
Top 10 Agile Metrics
Top 10 Agile Metrics
XBOSoft
Presentation -Quality Metrics For Agile Development
Presentation -Quality Metrics For Agile Development
Nabilahmed Patel
Agile Base Camp - Agile metrics
Agile Base Camp - Agile metrics
Serge Kovaleff
Measuring the Code Quality Using Software Metrics
Measuring the Code Quality Using Software Metrics
Geetha Anjali
Agile Testing - presentation for Agile User Group
Agile Testing - presentation for Agile User Group
suwalki24.pl
Agile code quality metrics
Agile code quality metrics
Gil Nahmias
Agile Metrics : A seminal approach for calculating Metrics in Agile Projects
Agile Metrics : A seminal approach for calculating Metrics in Agile Projects
Prashant Ram
Agile Metrics That Matter
Agile Metrics That Matter
ThoughtWorks Studios
AgileLIVE Webinar: Measuring the Success of Your Agile Transformation - Part 2
AgileLIVE Webinar: Measuring the Success of Your Agile Transformation - Part 2
VersionOne
Destaque
(17)
Project quality (and test process) metrics
Project quality (and test process) metrics
Test Metrics and KPIs
Test Metrics and KPIs
SlingQuery
SlingQuery
CRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migration
Agile Scrum in 60 minutes
Agile Scrum in 60 minutes
Agile metrics - Measure and Improve
Agile metrics - Measure and Improve
Agile Metrics
Agile Metrics
Agile Metrics
Agile Metrics
Top 10 Agile Metrics
Top 10 Agile Metrics
Presentation -Quality Metrics For Agile Development
Presentation -Quality Metrics For Agile Development
Agile Base Camp - Agile metrics
Agile Base Camp - Agile metrics
Measuring the Code Quality Using Software Metrics
Measuring the Code Quality Using Software Metrics
Agile Testing - presentation for Agile User Group
Agile Testing - presentation for Agile User Group
Agile code quality metrics
Agile code quality metrics
Agile Metrics : A seminal approach for calculating Metrics in Agile Projects
Agile Metrics : A seminal approach for calculating Metrics in Agile Projects
Agile Metrics That Matter
Agile Metrics That Matter
AgileLIVE Webinar: Measuring the Success of Your Agile Transformation - Part 2
AgileLIVE Webinar: Measuring the Success of Your Agile Transformation - Part 2
Semelhante a Code metrics
SPCA2013 - Building a SharePoint Factory
SPCA2013 - Building a SharePoint Factory
NCCOMMS
Integration testing - A&BP CC
Integration testing - A&BP CC
JWORKS powered by Ordina
Approaching ATDD/BDD
Approaching ATDD/BDD
Dhaval Dalal
Seven elements of technical Agility - Gil Broza - Agile Israel 2013
Seven elements of technical Agility - Gil Broza - Agile Israel 2013
AgileSparks
Project Work
Project Work
z02247
Edge Presentation Ppt
Edge Presentation Ppt
BrendaDean
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
mfrancis
Neoito — Design patterns and depenedency injection
Neoito — Design patterns and depenedency injection
Neoito
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
mfrancis
Our research lines on Model-Driven Engineering and Software Engineering
Our research lines on Model-Driven Engineering and Software Engineering
Jordi Cabot
Framework for Web Automation Testing
Framework for Web Automation Testing
Taras Lytvyn
Clean architecture with asp.net core
Clean architecture with asp.net core
Sam Nasr, MCSA, MVP
Integrating DDS into AXCIOMA - The Component Approach
Integrating DDS into AXCIOMA - The Component Approach
Real-Time Innovations (RTI)
Integrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approach
Remedy IT
Software quality - no more bugs!
Software quality - no more bugs!
Arnon Axelrod
Common Design Patterns.pptx
Common Design Patterns.pptx
fake195786
Ravindra Prasad
Ravindra Prasad
Ravindra Prasad
Mobile Code Optimisation Services
Mobile Code Optimisation Services
Raja Nagendra Kumar
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
Binary Studio
Ada 2012
Ada 2012
AdaCore
Semelhante a Code metrics
(20)
SPCA2013 - Building a SharePoint Factory
SPCA2013 - Building a SharePoint Factory
Integration testing - A&BP CC
Integration testing - A&BP CC
Approaching ATDD/BDD
Approaching ATDD/BDD
Seven elements of technical Agility - Gil Broza - Agile Israel 2013
Seven elements of technical Agility - Gil Broza - Agile Israel 2013
Project Work
Project Work
Edge Presentation Ppt
Edge Presentation Ppt
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
Neoito — Design patterns and depenedency injection
Neoito — Design patterns and depenedency injection
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
Our research lines on Model-Driven Engineering and Software Engineering
Our research lines on Model-Driven Engineering and Software Engineering
Framework for Web Automation Testing
Framework for Web Automation Testing
Clean architecture with asp.net core
Clean architecture with asp.net core
Integrating DDS into AXCIOMA - The Component Approach
Integrating DDS into AXCIOMA - The Component Approach
Integrating DDS into AXCIOMA, the component approach
Integrating DDS into AXCIOMA, the component approach
Software quality - no more bugs!
Software quality - no more bugs!
Common Design Patterns.pptx
Common Design Patterns.pptx
Ravindra Prasad
Ravindra Prasad
Mobile Code Optimisation Services
Mobile Code Optimisation Services
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
Ada 2012
Ada 2012
Mais de Tomasz Rękawek
Radio ad blocker
Radio ad blocker
Tomasz Rękawek
Deep-dive into cloud-native AEM deployments based on Kubernetes
Deep-dive into cloud-native AEM deployments based on Kubernetes
Tomasz Rękawek
Emulating Game Boy in Java
Emulating Game Boy in Java
Tomasz Rękawek
Zero downtime deployments for the Sling-based apps using Docker
Zero downtime deployments for the Sling-based apps using Docker
Tomasz Rękawek
Inter-Sling communication with message queue
Inter-Sling communication with message queue
Tomasz Rękawek
Sling Dynamic Include
Sling Dynamic Include
Tomasz Rękawek
Shooting rabbits with sling
Shooting rabbits with sling
Tomasz Rękawek
Mais de Tomasz Rękawek
(7)
Radio ad blocker
Radio ad blocker
Deep-dive into cloud-native AEM deployments based on Kubernetes
Deep-dive into cloud-native AEM deployments based on Kubernetes
Emulating Game Boy in Java
Emulating Game Boy in Java
Zero downtime deployments for the Sling-based apps using Docker
Zero downtime deployments for the Sling-based apps using Docker
Inter-Sling communication with message queue
Inter-Sling communication with message queue
Sling Dynamic Include
Sling Dynamic Include
Shooting rabbits with sling
Shooting rabbits with sling
Último
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
DianaGray10
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
Adtran
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
YounusS2
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
Daniel Santiago Silva Capera
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
UiPathCommunity
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
shyamraj55
20230104 - machine vision
20230104 - machine vision
Jamie (Taka) Wang
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
bruanjhuli
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
Bachir Benyammi
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
IES VE
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
Eric D. Schabell
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
Mahmoud Rabie
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
Seth Reyes
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
DianaGray10
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
DianaGray10
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
Precisely
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
SkyPlanner
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software
Designing A Time bound resource download URL
Designing A Time bound resource download URL
Runcy Oommen
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
Udaiappa Ramachandran
Último
(20)
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
20230104 - machine vision
20230104 - machine vision
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
How Accurate are Carbon Emissions Projections?
How Accurate are Carbon Emissions Projections?
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Designing A Time bound resource download URL
Designing A Time bound resource download URL
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
Code metrics
1.
Code quality © 2012
Cognifide Limited. In commercial confidence only.
2.
What is code
quality • Sample code quality questions: − Are methods and classes clean, readable and short? − Are connections between classes well-designed? − Does your code follow Java conventions? private static final rather than private final static − Do you have unit tests? What is the coverage? − Don’t you have some other code-smells? Eg. if statement with too many || conditions • Some issues caused by low quality code: − − − − Problems with adding new features Problems with collaboration Hidden bugs Hard to debug • Static code analysis tools can check all things automatically • Sonar – popular tool for Java © 2012 Cognifide Limited. In commercial confidence only.
3.
Coding standards © 2012
Cognifide Limited. In commercial confidence only.
4.
Coding standards –
example class FileUtils { public final static String pngExtension = "png"; public static String getExtension(String filename) { int DOTPos = filename.indexOf("."); if (filename != null && DOTPos > -1) { String extension = filename.substring(DOTPos+1); return extension; } return null; } } © 2012 Cognifide Limited. In commercial confidence only.
5.
Cyclomatic complexity © 2012
Cognifide Limited. In commercial confidence only.
6.
Cyclomatic complexity • • • • • Basic code
metric Describes number of “branches” in method or class Sequential code (no ifs, fors and whiles): complexity = 1 Each additional condition: +1 If method is too complex, we should split it into smaller ones © 2012 Cognifide Limited. In commercial confidence only.
7.
House of cards ©
2012 Cognifide Limited. In commercial confidence only.
8.
House of cards ©
2012 Cognifide Limited. In commercial confidence only.
9.
House of cards ©
2012 Cognifide Limited. In commercial confidence only.
10.
Complexity for sequential
code byte[] buffer = new byte[1024]; InputStream stream = new FileInputStream("/my/file"); InputStream buffered = new BufferedInputStream(stream); buffered.read(buffer); buffered.close(); • Complexity: 1 • No conditions, simple flow © 2012 Cognifide Limited. In commercial confidence only.
11.
Complexity with one
condition byte[] buffer = new byte[1024]; File file = new File("/my/file"); if (!file.exists()) { return; } InputStream stream = new FileInputStream(file); InputStream buffered = new BufferedInputStream(stream); buffered.read(buffer); buffered.close(); • Complexity: 2 © 2012 Cognifide Limited. In commercial confidence only.
12.
Complexity: formal definition Formal
definition: Edges – Nodes + 2 Components for(int i=0;i<3;i++) { System.out.println(i); } if(j == 42) { System.out.println(”j is the answer”) } Edges: 9, Nodes: 8, Components: 1 E-N+2P=3 © 2012 Cognifide Limited. In commercial confidence only.
13.
Class responsibilities © 2012
Cognifide Limited. In commercial confidence only.
14.
Single responsibility principle •
Each class should be responsible for only one thing • Example: class Driver: − 2 fields: car, brain, − 5 methods: drive(), goTo(), stop(), getAngry(), drinkCoffee(), • This class has 3 responsibilities: − Driving car − Getting angry − Drinking coffe • It should be split into 3 classes © 2012 Cognifide Limited. In commercial confidence only.
15.
LCOM4 & cohesion •
LCOM4 – Lack Of Cohesion Methods. • How many responsibilities class? • LCOM4 = 3 means that − there are 3 not connected sets of methods/properties − class can be split into three new classes. • Class should be designed to have LCOM4 = 1 • Low LCOM4 = high cohesion • Cohesion relates to coupling © 2012 Cognifide Limited. In commercial confidence only.
16.
Coupling © 2012 Cognifide
Limited. In commercial confidence only.
17.
Tight coupling • If
a class (eg. Driver) invokes methods on some other class (eg. Car) it’s tightly coupled with it • In this case we can’t easily change Car implementation to something other (eg. Tank) • Real-life example: iPhone and its battery public class Driver { private final Car car; public Driver(Car car) { this.car = car; } public void driveCar() { car.startEngine(); car.drive(); } public class Car { public void startEngine() { … } public void drive() { … } } } © 2012 Cognifide Limited. In commercial confidence only.
18.
Loose coupling • Class
doesn’t need to know about other classes existence • It only need to know about contracts (interfaces) provided by other class • Real-life example: screw and screwdriver public class Driver { private Vehicle vehicle; public Driver(Vehicle vehicle) { this.vehicle = vehicle; } public void drive() { vehicle.startEngine(); vehicle.drive(); } public interface Vehicle { void startEngine(); void drive(); } public class Car implements Vehicle { public void startEngine() { … } public void drive() { … } } } © 2012 Cognifide Limited. In commercial confidence only.
19.
Coupling & cohesion
– summary • Classes must be loosely coupled and highly cohesive. • Cohesion is the degree to which the methods of a single class are tight together. − If class is not cohesive (eg. two methods doesn’t share any property), it can be split to two classes. • Coupling is the degree to which each class is tight to the others. − Any change you make in one class has impact to some other classes. − Use interfaces & depdency injection • Read more… • Read even more… © 2012 Cognifide Limited. In commercial confidence only.
20.
Technical debt © 2012
Cognifide Limited. In commercial confidence only.
21.
Technical debt • „Doing
things the quick and dirty way sets us up with a technical debt, which is similar to a financial debt.” • Metric based on: − − − − − • • • • duplications, violations, (lack of) comments, coverage, complexity. Absolute debt in mandays and cash Debt ratio – dependent on the project size. Useful for project manager Read more... © 2012 Cognifide Limited. In commercial confidence only.
22.
Other metrics © 2012
Cognifide Limited. In commercial confidence only.
23.
Other code metrics • • • • • Lines
of code Unit test coverage Responses for class … All these metrics can be checked via Sonar − Free & very useful software − Can be integrated with Eclipse • Visual Studio provides integrated metrics as well © 2012 Cognifide Limited. In commercial confidence only.
Baixar agora