SlideShare a Scribd company logo
Code Crime Sceneversion 1.1
Paweł Klimczyk
Gemotial 2016
About me
• Software engineer
• Running Gemotial Software Studio
• Co-organizer ofWrocNET
• Blog: http://blog.klimczyk.pl
• Contact:
• Twitter @pwlklm
• Mail: pawel@klimczyk.pl
What is a crime scene? (1)
• Duplicate Code
• Long Method
• Comments
• Long Parameter List
• Large Class
• Switch Statements
• Parallel Inheritance Hierarchies
• Conditional Complexity
• Combinitorial Explosion
• Uncommunicative Name
• Dead Code
• Inconsistent Names
• Temporary Field
What is a crime scene? (2)
• Alternative Classes with Different
Interfaces
• Primitive ObsessionData Class
• Data Clumps
• Refused Bequest
• Inappropriate Intimacy
• Indecent Exposure
• Feature Envy
• Lazy Class
• Message Chains
• Middle Man
• Divergent Change
• Shotgun Surgery
• Parallel Inheritance Hierarchies
• Incomplete Library Class
• Solution Sprawl
Crime scene samples – code level
Crime scene samples – class level
Crime scene samples – SOLID violation
Crime scene samples – multiple test assertions
SmartStore.NET introduction
https://github.com/smartstoreag/SmartStoreNET
SmartStore.NET is a free, open source, full-featured e-commerce solution for
companies of any size. It is web standards compliant and incorporates the
newest Microsoft web technology stack.
SmartStore.NET includes all essential features to create multilingual and multi-
currency stores targeting desktop or mobile devices and enabling SEO
optimized rich product catalogs with support for an unlimited number of
products and categories, variants, bundles, datasheets, ESD, discounts, coupons
and many more.
The state-of-the-art architecture of SmartStore.NET - with ASP.NET 4.5 + MVC
5, Entity Framework 6 and Domain Driven Design approach - makes it easy to
extend, extremely flexible and essentially fun to work with ;-)
SmartStore.NET production deployments
• http://2stonedshop.de/
• http://indo-divers.de/
• http://www.adr-shop.com/
• http://www.mobilesat.co.uk/
trendspro.builtwith.com
+500 online stores
SmartStore.NET Screen (1)
SmartStore.NET Screen (2)
SmartStore.NET Screen (3)
CodeBase Stats (June 2016)
Finding the crime
How to find code crime in project ?
Code crime scene (Ndepend)
• Dependency graph
• Dependency matrix
• LINQ queries
• Code quality metrics (+custom)
• More…
NDepend – Project overview
NDepend – Dependency diagram
NDepend – Dependency matrix
NDepend – Metricts
NDepend – Cyclomatic complexity
NDepend – SOLID violation (S)
NDepend – SOLID violation (I)
NDepend – Code coverage
NDepend – Coupling
NDepend – GC.Collect
June – October 2016 compare
Source control systems – measure behavior* 1a660f0 | (HEAD -> master, origin/master, origin/HEAD) dd (Fri May 13 17:03:40 2016) [User1]
* dfcd431 | screenshots attepmt 2 (Fri May 13 16:59:35 2016) [User1]
* f29f63e | Apropriate screenshotting added (Fri May 13 16:54:46 2016) [User1]
* 9203bdb | disabled native events for IE (Fri May 13 16:38:44 2016) [User1]
* 45a6f12 | More setting for screenshots (Fri May 13 15:13:36 2016) [User1]
* 690180c | IE only (Fri May 13 15:01:22 2016) [User1]
* b687d21 | ScreenShots added (Fri May 13 15:00:51 2016) [User1]
* f98748f | Added waiting for page fully loaded (Fri May 13 14:44:48 2016) [User1]
* 2f15015 | Wait till page fully loaded for IE (Fri May 13 11:46:25 2016) [User1]
* 46dafc1 | Enabled IE and Chrome (Fri May 13 11:23:21 2016) [User1]
* 4faa96c | eliminated reposting form twice (Fri May 13 11:13:15 2016) [User1]
* ea6e879 | Improved user profile edit tests (Fri May 13 10:53:38 2016) [User1]
* 83f2f28 | removed retry forTestLauncher (Fri May 13 10:32:31 2016) [User1]
* ff0e1ff | Changed retry count and added message text for asserts (Fri May 13 10:25:13 2016) [User1]
* 2f27e2a |Temporary disabled most of the tests to (Fri May 13 10:08:46 2016) [User1]
* b6dcb02 | FireFox enabled for tests (Thu May 12 14:02:29 2016) [User1]
* 04c5596 | Better Handling of an alerts missing situations (Thu May 12 14:00:41 2016) [User1]
Code maat - introduction
Features:
• Analize GIT/SVN history
• Command line tool
• Various analizers
• CSV output
• Open source
Work flow:
• Git log….
• Parse log with code maat
• Generate graph from csv
Code maat – sample
entity,n-authors,n-revs
src/Presentation/SmartStore.Web/Controllers/ShoppingCartController.cs,4,14
src/Plugins/SmartStore.PayPal/Providers/PayPalExpressProvider.cs,4,6
src/Libraries/SmartStore.Services/Catalog/Importer/ProductImporter.cs,3,48
src/Presentation/SmartStore.Web/Administration/Controllers/ImportController.cs,3,38
src/Libraries/SmartStore.Services/Catalog/Importer/CategoryImporter.cs,3,35
src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs,3,31
src/Libraries/SmartStore.Data/Migrations/201601262000441_ImportFramework1.cs,3,3
0
src/Libraries/SmartStore.Services/Customers/Importer/CustomerImporter.cs,3,29
java -jar code-maat-0.8.5-standalone.jar -l log_file.log -c git -a authors
Code maat – hot files
entity n.authors n.revs
src/Libraries/SmartStore.Services/Catalog/Importer/ProductImporter.cs 3 48
src/Presentation/SmartStore.Web/Administration/Controllers/ImportController.cs 3 38
src/Libraries/SmartStore.Services/Catalog/Importer/CategoryImporter.cs 3 35
src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs 3 31
src/Libraries/SmartStore.Data/Migrations/201601262000441_ImportFramework1.cs 3 30
src/Libraries/SmartStore.Services/Customers/Importer/CustomerImporter.cs 3 29
src/Libraries/SmartStore.Data/Migrations/201512151526290_ImportFramework.cs 2 28
src/Libraries/SmartStore.Data/Migrations/201603121451066_ThirdPartyEmailHandOver.cs 2 21
src/Plugins/SmartStore.PayPal/Localization/resources.en-us.xml 3 20
src/Plugins/SmartStore.PayPal/Localization/resources.de-de.xml 3 20
src/Plugins/SmartStore.PayPal/Services/PayPalService.cs 1 20
src/Libraries/SmartStore.Services/DataExchange/Export/DataExporter.cs 3 19
src/Libraries/SmartStore.Services/DataExchange/Import/DataImporter.cs 3 19
src/Libraries/SmartStore.Services/DataExchange/Import/ImportRow.cs 3 18
src/Presentation/SmartStore.Web/Administration/Views/Import/_ColumnMappings.cshtml 3 18
src/Presentation/SmartStore.Web/Administration/Views/Import/_CreateOrUpdate.cshtml 1 18
src/Presentation/SmartStore.Web/Administration/Controllers/ProductController.cs 2 16
src/Presentation/SmartStore.Web/Administration/Models/DataExchange/ImportProfileModel.cs 2 16
src/Presentation/SmartStore.Web/Controllers/CommonController.cs 2 15
src/Presentation/SmartStore.Web/Scripts/smartstore.entityPicker.js 2 15
Code maat – Author importance
0
20000
40000
60000
80000
100000
120000
Christian Oliff James Bright Marcus Gesing Michael Herzog Murat Cakir
Authors importance 2016
added deleted diff
Code maat – module ownership
5956 2449
226
6
10053
3747
32
7040
1604
0
90351
3662
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Marcus Gesing
Murat Cakir
Michael Herzog
src/Plugins/SmartStore.AmazonPay src/Plugins/SmartStore.Clickatell src/Plugins/SmartStore.DevTools
src/Plugins/SmartStore.DiscountRules src/Plugins/SmartStore.FacebookAuth src/Plugins/SmartStore.GoogleAnalytics
src/Plugins/SmartStore.GoogleMerchantCenter src/Plugins/SmartStore.OfflinePayment src/Plugins/SmartStore.Shipping
src/Plugins/SmartStore.ShippingByWeight src/Plugins/SmartStore.Tax src/Plugins/SmartStore.WebApi
src/Libraries/SmartStore.Core src/Libraries/SmartStore.Data src/Libraries/SmartStore.Services
src/Libraries/SmartStore.Services/Catalog src/Libraries/SmartStore.Services/Common src/Libraries/SmartStore.Services/DataExchange
src/Libraries/SmartStore.Services/Localization src/Libraries/SmartStore.Services/Messages src/Libraries/SmartStore.Services/Orders
src/Libraries/SmartStore.Services/Payments src/Libraries/SmartStore.Services/Shipping src/Libraries/SmartStore.Services/Tasks
src/Libraries/SmartStore.Services/Customers src/Libraries/SmartStore.Services/Configuration src/Libraries/SmartStore.Core/Utilities
src/Libraries/SmartStore.Core/Logging src/Libraries/SmartStore.Core/Extensions src/Libraries/SmartStore.Core/Domain
src/Tests/SmartStore.Services.Tests src/Tests/SmartStore.Web.MVC.Tests src/Presentation/SmartStore.Web
src/Presentation/SmartStore.Web.Framework
Code maat – module ownership core
14266
10053
7040
1097
234
535
699
2449
23
5956
90351
3747
1604
1138
723
472
396
226
200
1443662 32 0 0
44
0 6 6 0 22
Marcus Gesing Murat Cakir Michael Herzog
Code maat – code relations
A B C
Functional code Tests code
Other tools
•FxCop
•StyleCop
•R#
Arguments for boss
Hard data provided by engineering
tools speaks for itself
Key outcome
•Everything can be measured
•Use suitable tools
•Provide hard data
•Programming triangle: correctness,
readability, performance
References
• NDepend http://www.ndepend.com/
• Code Maat https://github.com/adamtornhill/code-maat
• Book https://pragprog.com/book/atcrime/your-code-as-a-crime-scene
• FxCop https://msdn.microsoft.com/en-us/library/bb429476(v=vs.80).aspx
• R# https://www.jetbrains.com/resharper/ (and other similarVS plugins)
Thank you!

More Related Content

Viewers also liked

12_-_Collections_Framework
12_-_Collections_Framework12_-_Collections_Framework
12_-_Collections_Framework
Krishna Sujeer
 
Software Processes
Software ProcessesSoftware Processes
Software Processes
Krishna Sujeer
 
2 - OOPS
2 - OOPS2 - OOPS
2 - OOPS
Krishna Sujeer
 
1- java
1- java1- java
Software testing strategies
Software testing strategiesSoftware testing strategies
Software testing strategies
Krishna Sujeer
 
Lista de Chequeo Scrum
Lista de Chequeo ScrumLista de Chequeo Scrum
Lista de Chequeo Scrum
Sergio Gomez Florez
 
VIEW26 - for software quality professionals
VIEW26 - for software quality professionalsVIEW26 - for software quality professionals
VIEW26 - for software quality professionals
Ajay Emmanuel
 
LSI - PMP - Training material
LSI - PMP - Training materialLSI - PMP - Training material
LSI - PMP - Training material
Krishna Sujeer
 
Recruitment_Process[1]
Recruitment_Process[1]Recruitment_Process[1]
Recruitment_Process[1]
Krishna Sujeer
 
Blue Green Deployment com Docker
Blue Green Deployment com DockerBlue Green Deployment com Docker
Blue Green Deployment com Docker
Pedro Cavalheiro
 
Solid as OOP abstraction
Solid as OOP abstractionSolid as OOP abstraction
Solid as OOP abstraction
Pawel Klimczyk
 
Calidad de software septimo semestre
Calidad de software septimo semestreCalidad de software septimo semestre
Calidad de software septimo semestre
rodrigoarriagasalinas
 
Software Testing
Software TestingSoftware Testing
Software Testing
Krishna Sujeer
 
SOLID for Adults
SOLID for AdultsSOLID for Adults
SOLID for Adults
Pawel Klimczyk
 
Software quality
Software qualitySoftware quality
Software quality
Pedro Cavalheiro
 
JSON API: Não reinvente a roda
JSON API: Não reinvente a rodaJSON API: Não reinvente a roda
JSON API: Não reinvente a roda
Pedro Cavalheiro
 
Software testing career
Software testing careerSoftware testing career
Software testing career
Ahmed Ahmed Mokhtar
 
MODELO DE PROCESOS DEL SOFTWARE
MODELO DE PROCESOS DEL SOFTWAREMODELO DE PROCESOS DEL SOFTWARE
MODELO DE PROCESOS DEL SOFTWARE
Micky Jerzy
 
API Testing – Keeping a Check on Agile Software Development
API Testing – Keeping a Check on Agile Software DevelopmentAPI Testing – Keeping a Check on Agile Software Development
API Testing – Keeping a Check on Agile Software Development
Software Testing Solution
 
Software Quality Assurance
Software Quality AssuranceSoftware Quality Assurance
Software Quality Assurance
Saqib Raza
 

Viewers also liked (20)

12_-_Collections_Framework
12_-_Collections_Framework12_-_Collections_Framework
12_-_Collections_Framework
 
Software Processes
Software ProcessesSoftware Processes
Software Processes
 
2 - OOPS
2 - OOPS2 - OOPS
2 - OOPS
 
1- java
1- java1- java
1- java
 
Software testing strategies
Software testing strategiesSoftware testing strategies
Software testing strategies
 
Lista de Chequeo Scrum
Lista de Chequeo ScrumLista de Chequeo Scrum
Lista de Chequeo Scrum
 
VIEW26 - for software quality professionals
VIEW26 - for software quality professionalsVIEW26 - for software quality professionals
VIEW26 - for software quality professionals
 
LSI - PMP - Training material
LSI - PMP - Training materialLSI - PMP - Training material
LSI - PMP - Training material
 
Recruitment_Process[1]
Recruitment_Process[1]Recruitment_Process[1]
Recruitment_Process[1]
 
Blue Green Deployment com Docker
Blue Green Deployment com DockerBlue Green Deployment com Docker
Blue Green Deployment com Docker
 
Solid as OOP abstraction
Solid as OOP abstractionSolid as OOP abstraction
Solid as OOP abstraction
 
Calidad de software septimo semestre
Calidad de software septimo semestreCalidad de software septimo semestre
Calidad de software septimo semestre
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
SOLID for Adults
SOLID for AdultsSOLID for Adults
SOLID for Adults
 
Software quality
Software qualitySoftware quality
Software quality
 
JSON API: Não reinvente a roda
JSON API: Não reinvente a rodaJSON API: Não reinvente a roda
JSON API: Não reinvente a roda
 
Software testing career
Software testing careerSoftware testing career
Software testing career
 
MODELO DE PROCESOS DEL SOFTWARE
MODELO DE PROCESOS DEL SOFTWAREMODELO DE PROCESOS DEL SOFTWARE
MODELO DE PROCESOS DEL SOFTWARE
 
API Testing – Keeping a Check on Agile Software Development
API Testing – Keeping a Check on Agile Software DevelopmentAPI Testing – Keeping a Check on Agile Software Development
API Testing – Keeping a Check on Agile Software Development
 
Software Quality Assurance
Software Quality AssuranceSoftware Quality Assurance
Software Quality Assurance
 

Similar to Code Crime Scene pawel klimczyk

tranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker Discovery
tranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker DiscoverytranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker Discovery
tranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker Discovery
David Peyruc
 
Automated Malware Analysis and Cyber Security Intelligence
Automated Malware Analysis and Cyber Security IntelligenceAutomated Malware Analysis and Cyber Security Intelligence
Automated Malware Analysis and Cyber Security Intelligence
Jason Choi
 
Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment
isc2-hellenic
 
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20....Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
Javier García Magna
 
infrastructure management at digital ages
infrastructure management at digital agesinfrastructure management at digital ages
infrastructure management at digital ages
Bernard Paques
 
Node.js
Node.jsNode.js
Node.js
Matt Simonis
 
Новый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоныНовый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоны
Timur Safin
 
Keep Calm and Distributed Tracing
Keep Calm and Distributed TracingKeep Calm and Distributed Tracing
Keep Calm and Distributed Tracing
Angelo Simone Scotto
 
Monitoring in 2017 - TIAD Camp Docker
Monitoring in 2017 - TIAD Camp DockerMonitoring in 2017 - TIAD Camp Docker
Monitoring in 2017 - TIAD Camp Docker
The Incredible Automation Day
 
Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...
Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...
Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...
Daniel Czerwonk
 
Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog
 Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog
Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog
Redis Labs
 
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019 Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
Chun-Yu Tseng
 
Spark Streaming the Industrial IoT
Spark Streaming the Industrial IoTSpark Streaming the Industrial IoT
Spark Streaming the Industrial IoT
Jim Haughwout
 
Conceptos básicos. Seminario web 6: Despliegue de producción
Conceptos básicos. Seminario web 6: Despliegue de producciónConceptos básicos. Seminario web 6: Despliegue de producción
Conceptos básicos. Seminario web 6: Despliegue de producción
MongoDB
 
Data Stream Processing - Concepts and Frameworks
Data Stream Processing - Concepts and FrameworksData Stream Processing - Concepts and Frameworks
Data Stream Processing - Concepts and Frameworks
Matthias Niehoff
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross Introduction
Stuart Lodge
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross Seminar
Xamarin
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
John Adams
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at Netflix
Brendan Gregg
 
The Art of Container Monitoring
The Art of Container MonitoringThe Art of Container Monitoring
The Art of Container Monitoring
Derek Chen
 

Similar to Code Crime Scene pawel klimczyk (20)

tranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker Discovery
tranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker DiscoverytranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker Discovery
tranSMART Community Meeting 5-7 Nov 13 - Session 3: Clinical Biomarker Discovery
 
Automated Malware Analysis and Cyber Security Intelligence
Automated Malware Analysis and Cyber Security IntelligenceAutomated Malware Analysis and Cyber Security Intelligence
Automated Malware Analysis and Cyber Security Intelligence
 
Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment
 
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20....Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
.Net Microservices with Event Sourcing, CQRS, Docker and... Windows Server 20...
 
infrastructure management at digital ages
infrastructure management at digital agesinfrastructure management at digital ages
infrastructure management at digital ages
 
Node.js
Node.jsNode.js
Node.js
 
Новый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоныНовый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоны
 
Keep Calm and Distributed Tracing
Keep Calm and Distributed TracingKeep Calm and Distributed Tracing
Keep Calm and Distributed Tracing
 
Monitoring in 2017 - TIAD Camp Docker
Monitoring in 2017 - TIAD Camp DockerMonitoring in 2017 - TIAD Camp Docker
Monitoring in 2017 - TIAD Camp Docker
 
Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...
Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...
Open source tools for optimizing your peering infrastructure @ DE-CIX TechMee...
 
Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog
 Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog
Monitoring and Scaling Redis at DataDog - Ilan Rabinovitch, DataDog
 
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019 Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
Build and Host Real-world Machine Learning Services from Scratch @ pycontw2019
 
Spark Streaming the Industrial IoT
Spark Streaming the Industrial IoTSpark Streaming the Industrial IoT
Spark Streaming the Industrial IoT
 
Conceptos básicos. Seminario web 6: Despliegue de producción
Conceptos básicos. Seminario web 6: Despliegue de producciónConceptos básicos. Seminario web 6: Despliegue de producción
Conceptos básicos. Seminario web 6: Despliegue de producción
 
Data Stream Processing - Concepts and Frameworks
Data Stream Processing - Concepts and FrameworksData Stream Processing - Concepts and Frameworks
Data Stream Processing - Concepts and Frameworks
 
MvvmCross Introduction
MvvmCross IntroductionMvvmCross Introduction
MvvmCross Introduction
 
MvvmCross Seminar
MvvmCross SeminarMvvmCross Seminar
MvvmCross Seminar
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
YOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at NetflixYOW2018 Cloud Performance Root Cause Analysis at Netflix
YOW2018 Cloud Performance Root Cause Analysis at Netflix
 
The Art of Container Monitoring
The Art of Container MonitoringThe Art of Container Monitoring
The Art of Container Monitoring
 

More from Pawel Klimczyk

Wrocnet.meeting.info.20180515.109
Wrocnet.meeting.info.20180515.109Wrocnet.meeting.info.20180515.109
Wrocnet.meeting.info.20180515.109
Pawel Klimczyk
 
Wrocnet.meeting.info.20180320.107
Wrocnet.meeting.info.20180320.107Wrocnet.meeting.info.20180320.107
Wrocnet.meeting.info.20180320.107
Pawel Klimczyk
 
Software maintenance
Software maintenanceSoftware maintenance
Software maintenance
Pawel Klimczyk
 
Product Roadmap vs Development
Product Roadmap vs DevelopmentProduct Roadmap vs Development
Product Roadmap vs Development
Pawel Klimczyk
 
Software Quality for Programmers
Software Quality for ProgrammersSoftware Quality for Programmers
Software Quality for Programmers
Pawel Klimczyk
 
Wrocnet #88
Wrocnet #88Wrocnet #88
Wrocnet #88
Pawel Klimczyk
 
GeekWeekWro TechSaturdays
GeekWeekWro TechSaturdaysGeekWeekWro TechSaturdays
GeekWeekWro TechSaturdays
Pawel Klimczyk
 
GeekWeekWro hack4culture
GeekWeekWro hack4cultureGeekWeekWro hack4culture
GeekWeekWro hack4culture
Pawel Klimczyk
 
Wrocnet #87
Wrocnet #87Wrocnet #87
Wrocnet #87
Pawel Klimczyk
 
Wrocnet 86
Wrocnet 86Wrocnet 86
Wrocnet 86
Pawel Klimczyk
 
Wrocnet spotkanie 85
Wrocnet spotkanie 85Wrocnet spotkanie 85
Wrocnet spotkanie 85
Pawel Klimczyk
 

More from Pawel Klimczyk (11)

Wrocnet.meeting.info.20180515.109
Wrocnet.meeting.info.20180515.109Wrocnet.meeting.info.20180515.109
Wrocnet.meeting.info.20180515.109
 
Wrocnet.meeting.info.20180320.107
Wrocnet.meeting.info.20180320.107Wrocnet.meeting.info.20180320.107
Wrocnet.meeting.info.20180320.107
 
Software maintenance
Software maintenanceSoftware maintenance
Software maintenance
 
Product Roadmap vs Development
Product Roadmap vs DevelopmentProduct Roadmap vs Development
Product Roadmap vs Development
 
Software Quality for Programmers
Software Quality for ProgrammersSoftware Quality for Programmers
Software Quality for Programmers
 
Wrocnet #88
Wrocnet #88Wrocnet #88
Wrocnet #88
 
GeekWeekWro TechSaturdays
GeekWeekWro TechSaturdaysGeekWeekWro TechSaturdays
GeekWeekWro TechSaturdays
 
GeekWeekWro hack4culture
GeekWeekWro hack4cultureGeekWeekWro hack4culture
GeekWeekWro hack4culture
 
Wrocnet #87
Wrocnet #87Wrocnet #87
Wrocnet #87
 
Wrocnet 86
Wrocnet 86Wrocnet 86
Wrocnet 86
 
Wrocnet spotkanie 85
Wrocnet spotkanie 85Wrocnet spotkanie 85
Wrocnet spotkanie 85
 

Recently uploaded

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
ISH Technologies
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Semiosis Software Private Limited
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 

Recently uploaded (20)

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 

Code Crime Scene pawel klimczyk

  • 1. Code Crime Sceneversion 1.1 Paweł Klimczyk Gemotial 2016
  • 2. About me • Software engineer • Running Gemotial Software Studio • Co-organizer ofWrocNET • Blog: http://blog.klimczyk.pl • Contact: • Twitter @pwlklm • Mail: pawel@klimczyk.pl
  • 3. What is a crime scene? (1) • Duplicate Code • Long Method • Comments • Long Parameter List • Large Class • Switch Statements • Parallel Inheritance Hierarchies • Conditional Complexity • Combinitorial Explosion • Uncommunicative Name • Dead Code • Inconsistent Names • Temporary Field
  • 4. What is a crime scene? (2) • Alternative Classes with Different Interfaces • Primitive ObsessionData Class • Data Clumps • Refused Bequest • Inappropriate Intimacy • Indecent Exposure • Feature Envy • Lazy Class • Message Chains • Middle Man • Divergent Change • Shotgun Surgery • Parallel Inheritance Hierarchies • Incomplete Library Class • Solution Sprawl
  • 5. Crime scene samples – code level
  • 6. Crime scene samples – class level
  • 7. Crime scene samples – SOLID violation
  • 8. Crime scene samples – multiple test assertions
  • 9. SmartStore.NET introduction https://github.com/smartstoreag/SmartStoreNET SmartStore.NET is a free, open source, full-featured e-commerce solution for companies of any size. It is web standards compliant and incorporates the newest Microsoft web technology stack. SmartStore.NET includes all essential features to create multilingual and multi- currency stores targeting desktop or mobile devices and enabling SEO optimized rich product catalogs with support for an unlimited number of products and categories, variants, bundles, datasheets, ESD, discounts, coupons and many more. The state-of-the-art architecture of SmartStore.NET - with ASP.NET 4.5 + MVC 5, Entity Framework 6 and Domain Driven Design approach - makes it easy to extend, extremely flexible and essentially fun to work with ;-)
  • 10. SmartStore.NET production deployments • http://2stonedshop.de/ • http://indo-divers.de/ • http://www.adr-shop.com/ • http://www.mobilesat.co.uk/ trendspro.builtwith.com +500 online stores
  • 15. Finding the crime How to find code crime in project ?
  • 16. Code crime scene (Ndepend) • Dependency graph • Dependency matrix • LINQ queries • Code quality metrics (+custom) • More…
  • 22. NDepend – SOLID violation (S)
  • 23. NDepend – SOLID violation (I)
  • 24. NDepend – Code coverage
  • 27. June – October 2016 compare
  • 28. Source control systems – measure behavior* 1a660f0 | (HEAD -> master, origin/master, origin/HEAD) dd (Fri May 13 17:03:40 2016) [User1] * dfcd431 | screenshots attepmt 2 (Fri May 13 16:59:35 2016) [User1] * f29f63e | Apropriate screenshotting added (Fri May 13 16:54:46 2016) [User1] * 9203bdb | disabled native events for IE (Fri May 13 16:38:44 2016) [User1] * 45a6f12 | More setting for screenshots (Fri May 13 15:13:36 2016) [User1] * 690180c | IE only (Fri May 13 15:01:22 2016) [User1] * b687d21 | ScreenShots added (Fri May 13 15:00:51 2016) [User1] * f98748f | Added waiting for page fully loaded (Fri May 13 14:44:48 2016) [User1] * 2f15015 | Wait till page fully loaded for IE (Fri May 13 11:46:25 2016) [User1] * 46dafc1 | Enabled IE and Chrome (Fri May 13 11:23:21 2016) [User1] * 4faa96c | eliminated reposting form twice (Fri May 13 11:13:15 2016) [User1] * ea6e879 | Improved user profile edit tests (Fri May 13 10:53:38 2016) [User1] * 83f2f28 | removed retry forTestLauncher (Fri May 13 10:32:31 2016) [User1] * ff0e1ff | Changed retry count and added message text for asserts (Fri May 13 10:25:13 2016) [User1] * 2f27e2a |Temporary disabled most of the tests to (Fri May 13 10:08:46 2016) [User1] * b6dcb02 | FireFox enabled for tests (Thu May 12 14:02:29 2016) [User1] * 04c5596 | Better Handling of an alerts missing situations (Thu May 12 14:00:41 2016) [User1]
  • 29. Code maat - introduction Features: • Analize GIT/SVN history • Command line tool • Various analizers • CSV output • Open source Work flow: • Git log…. • Parse log with code maat • Generate graph from csv
  • 30. Code maat – sample entity,n-authors,n-revs src/Presentation/SmartStore.Web/Controllers/ShoppingCartController.cs,4,14 src/Plugins/SmartStore.PayPal/Providers/PayPalExpressProvider.cs,4,6 src/Libraries/SmartStore.Services/Catalog/Importer/ProductImporter.cs,3,48 src/Presentation/SmartStore.Web/Administration/Controllers/ImportController.cs,3,38 src/Libraries/SmartStore.Services/Catalog/Importer/CategoryImporter.cs,3,35 src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs,3,31 src/Libraries/SmartStore.Data/Migrations/201601262000441_ImportFramework1.cs,3,3 0 src/Libraries/SmartStore.Services/Customers/Importer/CustomerImporter.cs,3,29 java -jar code-maat-0.8.5-standalone.jar -l log_file.log -c git -a authors
  • 31. Code maat – hot files entity n.authors n.revs src/Libraries/SmartStore.Services/Catalog/Importer/ProductImporter.cs 3 48 src/Presentation/SmartStore.Web/Administration/Controllers/ImportController.cs 3 38 src/Libraries/SmartStore.Services/Catalog/Importer/CategoryImporter.cs 3 35 src/Presentation/SmartStore.Web/Administration/Controllers/ExportController.cs 3 31 src/Libraries/SmartStore.Data/Migrations/201601262000441_ImportFramework1.cs 3 30 src/Libraries/SmartStore.Services/Customers/Importer/CustomerImporter.cs 3 29 src/Libraries/SmartStore.Data/Migrations/201512151526290_ImportFramework.cs 2 28 src/Libraries/SmartStore.Data/Migrations/201603121451066_ThirdPartyEmailHandOver.cs 2 21 src/Plugins/SmartStore.PayPal/Localization/resources.en-us.xml 3 20 src/Plugins/SmartStore.PayPal/Localization/resources.de-de.xml 3 20 src/Plugins/SmartStore.PayPal/Services/PayPalService.cs 1 20 src/Libraries/SmartStore.Services/DataExchange/Export/DataExporter.cs 3 19 src/Libraries/SmartStore.Services/DataExchange/Import/DataImporter.cs 3 19 src/Libraries/SmartStore.Services/DataExchange/Import/ImportRow.cs 3 18 src/Presentation/SmartStore.Web/Administration/Views/Import/_ColumnMappings.cshtml 3 18 src/Presentation/SmartStore.Web/Administration/Views/Import/_CreateOrUpdate.cshtml 1 18 src/Presentation/SmartStore.Web/Administration/Controllers/ProductController.cs 2 16 src/Presentation/SmartStore.Web/Administration/Models/DataExchange/ImportProfileModel.cs 2 16 src/Presentation/SmartStore.Web/Controllers/CommonController.cs 2 15 src/Presentation/SmartStore.Web/Scripts/smartstore.entityPicker.js 2 15
  • 32. Code maat – Author importance 0 20000 40000 60000 80000 100000 120000 Christian Oliff James Bright Marcus Gesing Michael Herzog Murat Cakir Authors importance 2016 added deleted diff
  • 33. Code maat – module ownership 5956 2449 226 6 10053 3747 32 7040 1604 0 90351 3662 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% Marcus Gesing Murat Cakir Michael Herzog src/Plugins/SmartStore.AmazonPay src/Plugins/SmartStore.Clickatell src/Plugins/SmartStore.DevTools src/Plugins/SmartStore.DiscountRules src/Plugins/SmartStore.FacebookAuth src/Plugins/SmartStore.GoogleAnalytics src/Plugins/SmartStore.GoogleMerchantCenter src/Plugins/SmartStore.OfflinePayment src/Plugins/SmartStore.Shipping src/Plugins/SmartStore.ShippingByWeight src/Plugins/SmartStore.Tax src/Plugins/SmartStore.WebApi src/Libraries/SmartStore.Core src/Libraries/SmartStore.Data src/Libraries/SmartStore.Services src/Libraries/SmartStore.Services/Catalog src/Libraries/SmartStore.Services/Common src/Libraries/SmartStore.Services/DataExchange src/Libraries/SmartStore.Services/Localization src/Libraries/SmartStore.Services/Messages src/Libraries/SmartStore.Services/Orders src/Libraries/SmartStore.Services/Payments src/Libraries/SmartStore.Services/Shipping src/Libraries/SmartStore.Services/Tasks src/Libraries/SmartStore.Services/Customers src/Libraries/SmartStore.Services/Configuration src/Libraries/SmartStore.Core/Utilities src/Libraries/SmartStore.Core/Logging src/Libraries/SmartStore.Core/Extensions src/Libraries/SmartStore.Core/Domain src/Tests/SmartStore.Services.Tests src/Tests/SmartStore.Web.MVC.Tests src/Presentation/SmartStore.Web src/Presentation/SmartStore.Web.Framework
  • 34. Code maat – module ownership core 14266 10053 7040 1097 234 535 699 2449 23 5956 90351 3747 1604 1138 723 472 396 226 200 1443662 32 0 0 44 0 6 6 0 22 Marcus Gesing Murat Cakir Michael Herzog
  • 35. Code maat – code relations A B C Functional code Tests code
  • 37. Arguments for boss Hard data provided by engineering tools speaks for itself
  • 38. Key outcome •Everything can be measured •Use suitable tools •Provide hard data •Programming triangle: correctness, readability, performance
  • 39. References • NDepend http://www.ndepend.com/ • Code Maat https://github.com/adamtornhill/code-maat • Book https://pragprog.com/book/atcrime/your-code-as-a-crime-scene • FxCop https://msdn.microsoft.com/en-us/library/bb429476(v=vs.80).aspx • R# https://www.jetbrains.com/resharper/ (and other similarVS plugins)