SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
Code Quality Control in a PHP Project
Andrii Yatsenko, Oro Inc.
Andrey Yatsenko
Passionate about Symfony & DX
- Developer Advocate
- Trainer
- Conference speaker
- Mentor of Advanced PHP course on GeekHub
- Symfony 3 Certified Developer (Expert)
About Oro Inc.
7 offices in 5 Countries
(USA , Germany, France, Ukraine, Poland)
Global Partner Network
Open-source applications
www.oroinc.com
Code Quality
is about how good or bad the code is
7/32
Code Quality Metrics
● Number of bugs
● Time of life without changes
● Support complexity
Code Support
● Read
● Maintain
● Extend
● Reuse
● Test
How to Control Code Quality?
● Developers ask the team lead when something goes wrong
● The team lead participates in plannings
● The team lead participates in plannings and reviews the code
The Team Grows
How to Improve Code Quality of a Big Team?
How to Know That the Code Quality is Improved (or Not)?
Measure:
● Number of bugs
● Time of life without changes
● Support complexity
How to Know That the Code Quality is Improved (or Not)?
Measure:
● Number of bugs
● Time of life without changes
● Support complexity
}Late Feedback
Code Support Complexity
● Readability
● Maintainability
● Extendability
● Reusability
● Testability
Control Code Support Complexity
● Readability (use coding standards, review the code)
● Maintainability
● Extendability
● Reusability
● Testability
Control Code Support Complexity
● Readability (use coding standards, review the code)
● Maintainability (review the code, write tests)
● Extendability
● Reusability
● Testability
Control Code Support Complexity
● Readability (use coding standards, review the code)
● Maintainability (review the code, write tests)
● Extendability (document extension points)
● Reusability
● Testability
Control Code Support Complexity
● Readability (use coding standards, review the code)
● Maintainability (review the code, write tests)
● Extendability (document extension points)
● Reusability (decouple to packages)
● Testability
Control Code Support Complexity
● Readability (use coding standards, review the code)
● Maintainability (review the code, write tests)
● Extendability (document extension points)
● Reusability (decouple to packages)
● Testability (write tests)
Automated Code Review Tools
● PHP Code Sniffer
● PHP Mess Detector
● PHP Code Fixer
● Copy/Paste Detector (CPD) for PHP
● PHPStan - PHP Static Analysis Tool
● PHP Semver Checker
● PhpStorm
● Symfony Insight
ORO Configs for Automated Code Review Tools
● PHP Code Sniffer - PSR2
● PHP Mess Detector
● PHP Code Fixer
● PHPCPD
● --min-lines 25
● --regexps-exclude Migrations/Schema/,Entity/
● PHPStan
● https://github.com/oroinc/phpstan-rules
● PHP Semver Checker
Code Review Types
● Formal inspection
● Regular change-based
Source: http://geek-and-poke.com/
Code Review
● Automated tools
● Definition of done
● CR checklist
Code Review
Definition of Done
● Acceptance criteria are met
● All use cases are automated by Behat tests
● Unit tests cover at least 70%
● All changes are well documented
● New packages and new dependencies are approved
● CI builds are green
Code Review Checklist
● Functional Review
● Architectural Review
● Implementation Review
● Automated Tests Review
● Documentation Review
Code Review Checklist
Code Review Best Practices
Source: http://geek-and-poke.com/
● Limit the amount of the code under review
(max 2000 LOC)
● Spend on a review not more than 2 hours in
one time
● Start from the investigation the review scope
● Leave simple and explicit comments in PR
● Talk to author when something is not clear
Testing
Manual Automated
Manual Testing
● Covers cases that are hard to automate
(ex. time x30)
● Not effective when done only by the
developer
● Starts from ensuring what is automated
● Acceptance + Impact
● Pairwise testing
Automated Testing
● Unit - for architecture
● Behavioral - for business needs
● Performance - for reliability
Behat
Behat
Developer Documentation
● Can compensate for bad code quality
● Code comments are not documentation
Developer Documentation in ORO
● Feature description
● Feature usage examples
● Feature configuration
● CLI commands
● API resources
● General purpose interfaces
● Complex algorithms & data structures
● Useful links & other technical details
Class Comments Inspection
Checks if class/interface/trait documentation exists
and it has text doc that describes what this class is for
https://bit.ly/2FKFqz1
Refactoring
● Before adding a new feature or
fixing a complex bug
● Lowers the cost of
enhancements
● Improves architecture*
● After product goes to market
● Performance
● Bug fixing
Applying New Technologies During Upgrade
Only when there is a reason
● Security
● Developer experience
● Performance
● New features for the business
Conclusion
● Code quality is important
● Code quality is relative
● Code quality can always be improved
● You can control the code quality in different ways
● Review & pair programming
● Automated tests
● Manual control
● How to control depends on a project
References
Blog Posts
● Performing an Efficient Code Review, Part I. Best Practices
● Performing an Efficient Peer Code Review, Part II. Checklist
● Auto Testing OroCommerce-Based Application Behavior with Behat
Books
● Refactoring by Martin Fowler

Más contenido relacionado

La actualidad más candente

Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Peter Kofler
 
Robot framework - Lord of the Rings
Robot framework - Lord of the RingsRobot framework - Lord of the Rings
Robot framework - Lord of the RingsAsheesh Mehdiratta
 
Civilized Git Process
Civilized Git ProcessCivilized Git Process
Civilized Git ProcessTu Hoang
 
Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Peter Kofler
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Peter Kofler
 
Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Peter Kofler
 
Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Peter Kofler
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 
Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build processBryan Agee
 
Barcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot FrameworkBarcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot FrameworkSomkiat Puisungnoen
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with GolangTakaaki Mizuno
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkSteve Zhang
 
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Peter Kofler
 
Outside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDDOutside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDDPeter Kofler
 
Introduction to Robot Framework (external)
Introduction to Robot Framework (external)Introduction to Robot Framework (external)
Introduction to Robot Framework (external)Zhe Li
 
Choosing a career goal as an IT graduate
Choosing a career goal as an IT graduateChoosing a career goal as an IT graduate
Choosing a career goal as an IT graduateTahsin Abrar
 
Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Peter Kofler
 

La actualidad más candente (20)

Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)Coding Dojo: Mars Rover (2014)
Coding Dojo: Mars Rover (2014)
 
Robot framework - Lord of the Rings
Robot framework - Lord of the RingsRobot framework - Lord of the Rings
Robot framework - Lord of the Rings
 
Civilized Git Process
Civilized Git ProcessCivilized Git Process
Civilized Git Process
 
Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)Coding Dojo: Bank OCR Outside-In (2015)
Coding Dojo: Bank OCR Outside-In (2015)
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)
 
Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)Coding Dojo: Functional Calisthenics (2016)
Coding Dojo: Functional Calisthenics (2016)
 
Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)Coding Dojo: Baby Steps Push Challenge (2021)
Coding Dojo: Baby Steps Push Challenge (2021)
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build process
 
Barcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot FrameworkBarcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot Framework
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with Golang
 
Framework
FrameworkFramework
Framework
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
 
Outside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDDOutside-in Test Driven Development - the London School of TDD
Outside-in Test Driven Development - the London School of TDD
 
A simplified Gitflow
A simplified GitflowA simplified Gitflow
A simplified Gitflow
 
UPC Plone Testing Talk
UPC Plone Testing TalkUPC Plone Testing Talk
UPC Plone Testing Talk
 
Introduction to Robot Framework (external)
Introduction to Robot Framework (external)Introduction to Robot Framework (external)
Introduction to Robot Framework (external)
 
Choosing a career goal as an IT graduate
Choosing a career goal as an IT graduateChoosing a career goal as an IT graduate
Choosing a career goal as an IT graduate
 
Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)
 

Similar a Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020

Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleikram_ahamed
 
Continuous Integration In Php
Continuous Integration In PhpContinuous Integration In Php
Continuous Integration In PhpWilco Jansen
 
Test Driven Development with PHP
Test Driven Development with PHPTest Driven Development with PHP
Test Driven Development with PHPRogério Vicente
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020Abhijeet Vaikar
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingJoomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingShyam Sunder Verma
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testingEngineor
 
Complete python toolbox for modern developers
Complete python toolbox for modern developersComplete python toolbox for modern developers
Complete python toolbox for modern developersJan Giacomelli
 
Moodle Development Best Pracitces
Moodle Development Best PracitcesMoodle Development Best Pracitces
Moodle Development Best PracitcesJustin Filip
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionJosh Gough
 
Security in CI/CD Pipelines: Tips for DevOps Engineers
Security in CI/CD Pipelines: Tips for DevOps EngineersSecurity in CI/CD Pipelines: Tips for DevOps Engineers
Security in CI/CD Pipelines: Tips for DevOps EngineersDevOps.com
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Conceptswesovi
 
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Peter Kofler
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Peter Kofler
 
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...
[ENGLISH] TDC 2015 - PHP  Trail - Tests and PHP Continuous Integration Enviro...[ENGLISH] TDC 2015 - PHP  Trail - Tests and PHP Continuous Integration Enviro...
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...Bruno Tanoue
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Engineor
 
Introduction to Continuous Integration
Introduction to Continuous IntegrationIntroduction to Continuous Integration
Introduction to Continuous IntegrationHùng Nguyễn Huy
 
The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...Krzysztof (Chris) Ozog
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplateStanislav Petrov
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Fwdays
 

Similar a Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020 (20)

Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
 
Continuous Integration In Php
Continuous Integration In PhpContinuous Integration In Php
Continuous Integration In Php
 
Test Driven Development with PHP
Test Driven Development with PHPTest Driven Development with PHP
Test Driven Development with PHP
 
End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020End-end tests as first class citizens - SeleniumConf 2020
End-end tests as first class citizens - SeleniumConf 2020
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingJoomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
 
Complete python toolbox for modern developers
Complete python toolbox for modern developersComplete python toolbox for modern developers
Complete python toolbox for modern developers
 
Moodle Development Best Pracitces
Moodle Development Best PracitcesMoodle Development Best Pracitces
Moodle Development Best Pracitces
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous Inspection
 
Security in CI/CD Pipelines: Tips for DevOps Engineers
Security in CI/CD Pipelines: Tips for DevOps EngineersSecurity in CI/CD Pipelines: Tips for DevOps Engineers
Security in CI/CD Pipelines: Tips for DevOps Engineers
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
 
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
 
Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)Pragmatic Introduction to PHP Unit Testing (2015)
Pragmatic Introduction to PHP Unit Testing (2015)
 
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...
[ENGLISH] TDC 2015 - PHP  Trail - Tests and PHP Continuous Integration Enviro...[ENGLISH] TDC 2015 - PHP  Trail - Tests and PHP Continuous Integration Enviro...
[ENGLISH] TDC 2015 - PHP Trail - Tests and PHP Continuous Integration Enviro...
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)
 
Introduction to Continuous Integration
Introduction to Continuous IntegrationIntroduction to Continuous Integration
Introduction to Continuous Integration
 
The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...The automation of the process of caring for the quality of the code in PHP an...
The automation of the process of caring for the quality of the code in PHP an...
 
Automated testing
Automated testingAutomated testing
Automated testing
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"
 

Más de Andrew Yatsenko

OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.Andrew Yatsenko
 
Data cache management in php
Data cache management in phpData cache management in php
Data cache management in phpAndrew Yatsenko
 
Doctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWorkDoctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWorkAndrew Yatsenko
 
Writing extensible applications
Writing extensible applicationsWriting extensible applications
Writing extensible applicationsAndrew Yatsenko
 
Symfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassySymfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassyAndrew Yatsenko
 

Más de Andrew Yatsenko (6)

OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.OroCommerce Storefront Design. Non-standard Layout Customisation.
OroCommerce Storefront Design. Non-standard Layout Customisation.
 
Using Oro layouts
Using Oro layoutsUsing Oro layouts
Using Oro layouts
 
Data cache management in php
Data cache management in phpData cache management in php
Data cache management in php
 
Doctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWorkDoctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWork
 
Writing extensible applications
Writing extensible applicationsWriting extensible applications
Writing extensible applications
 
Symfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassySymfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 Cherkassy
 

Último

DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEselvakumar948
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 

Último (20)

DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

Code Quality Control in a PHP project. GeekTalks, Cherkassy 2020

  • 1. Code Quality Control in a PHP Project Andrii Yatsenko, Oro Inc.
  • 2. Andrey Yatsenko Passionate about Symfony & DX - Developer Advocate - Trainer - Conference speaker - Mentor of Advanced PHP course on GeekHub - Symfony 3 Certified Developer (Expert)
  • 3. About Oro Inc. 7 offices in 5 Countries (USA , Germany, France, Ukraine, Poland) Global Partner Network Open-source applications
  • 5. Code Quality is about how good or bad the code is
  • 6.
  • 8. Code Quality Metrics ● Number of bugs ● Time of life without changes ● Support complexity
  • 9. Code Support ● Read ● Maintain ● Extend ● Reuse ● Test
  • 10. How to Control Code Quality? ● Developers ask the team lead when something goes wrong ● The team lead participates in plannings ● The team lead participates in plannings and reviews the code
  • 12. How to Improve Code Quality of a Big Team?
  • 13. How to Know That the Code Quality is Improved (or Not)? Measure: ● Number of bugs ● Time of life without changes ● Support complexity
  • 14. How to Know That the Code Quality is Improved (or Not)? Measure: ● Number of bugs ● Time of life without changes ● Support complexity }Late Feedback
  • 15. Code Support Complexity ● Readability ● Maintainability ● Extendability ● Reusability ● Testability
  • 16. Control Code Support Complexity ● Readability (use coding standards, review the code) ● Maintainability ● Extendability ● Reusability ● Testability
  • 17. Control Code Support Complexity ● Readability (use coding standards, review the code) ● Maintainability (review the code, write tests) ● Extendability ● Reusability ● Testability
  • 18. Control Code Support Complexity ● Readability (use coding standards, review the code) ● Maintainability (review the code, write tests) ● Extendability (document extension points) ● Reusability ● Testability
  • 19. Control Code Support Complexity ● Readability (use coding standards, review the code) ● Maintainability (review the code, write tests) ● Extendability (document extension points) ● Reusability (decouple to packages) ● Testability
  • 20. Control Code Support Complexity ● Readability (use coding standards, review the code) ● Maintainability (review the code, write tests) ● Extendability (document extension points) ● Reusability (decouple to packages) ● Testability (write tests)
  • 21. Automated Code Review Tools ● PHP Code Sniffer ● PHP Mess Detector ● PHP Code Fixer ● Copy/Paste Detector (CPD) for PHP ● PHPStan - PHP Static Analysis Tool ● PHP Semver Checker ● PhpStorm ● Symfony Insight
  • 22. ORO Configs for Automated Code Review Tools ● PHP Code Sniffer - PSR2 ● PHP Mess Detector ● PHP Code Fixer ● PHPCPD ● --min-lines 25 ● --regexps-exclude Migrations/Schema/,Entity/ ● PHPStan ● https://github.com/oroinc/phpstan-rules ● PHP Semver Checker
  • 23. Code Review Types ● Formal inspection ● Regular change-based Source: http://geek-and-poke.com/
  • 25. ● Automated tools ● Definition of done ● CR checklist Code Review
  • 26. Definition of Done ● Acceptance criteria are met ● All use cases are automated by Behat tests ● Unit tests cover at least 70% ● All changes are well documented ● New packages and new dependencies are approved ● CI builds are green
  • 27. Code Review Checklist ● Functional Review ● Architectural Review ● Implementation Review ● Automated Tests Review ● Documentation Review
  • 29. Code Review Best Practices Source: http://geek-and-poke.com/ ● Limit the amount of the code under review (max 2000 LOC) ● Spend on a review not more than 2 hours in one time ● Start from the investigation the review scope ● Leave simple and explicit comments in PR ● Talk to author when something is not clear
  • 31. Manual Testing ● Covers cases that are hard to automate (ex. time x30) ● Not effective when done only by the developer ● Starts from ensuring what is automated ● Acceptance + Impact ● Pairwise testing
  • 32. Automated Testing ● Unit - for architecture ● Behavioral - for business needs ● Performance - for reliability
  • 33. Behat
  • 34. Behat
  • 35. Developer Documentation ● Can compensate for bad code quality ● Code comments are not documentation
  • 36. Developer Documentation in ORO ● Feature description ● Feature usage examples ● Feature configuration ● CLI commands ● API resources ● General purpose interfaces ● Complex algorithms & data structures ● Useful links & other technical details
  • 37. Class Comments Inspection Checks if class/interface/trait documentation exists and it has text doc that describes what this class is for https://bit.ly/2FKFqz1
  • 38.
  • 39.
  • 40. Refactoring ● Before adding a new feature or fixing a complex bug ● Lowers the cost of enhancements ● Improves architecture* ● After product goes to market ● Performance ● Bug fixing
  • 41. Applying New Technologies During Upgrade Only when there is a reason ● Security ● Developer experience ● Performance ● New features for the business
  • 42. Conclusion ● Code quality is important ● Code quality is relative ● Code quality can always be improved ● You can control the code quality in different ways ● Review & pair programming ● Automated tests ● Manual control ● How to control depends on a project
  • 43. References Blog Posts ● Performing an Efficient Code Review, Part I. Best Practices ● Performing an Efficient Peer Code Review, Part II. Checklist ● Auto Testing OroCommerce-Based Application Behavior with Behat Books ● Refactoring by Martin Fowler