SlideShare a Scribd company logo
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

More Related Content

What's hot

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 Rings
Asheesh Mehdiratta
 
Civilized Git Process
Civilized Git ProcessCivilized Git Process
Civilized Git Process
Tu 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 Framework
Peter Kofler
 
Lighning Talk: PHP build process
Lighning Talk: PHP build processLighning Talk: PHP build process
Lighning Talk: PHP build process
Bryan Agee
 
Barcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot FrameworkBarcamp Bangkhen :: Robot Framework
Barcamp Bangkhen :: Robot Framework
Somkiat Puisungnoen
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with Golang
Takaaki Mizuno
 
Framework
FrameworkFramework
Framework
Seungjoon Lee
 
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
Steve 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 TDD
Peter Kofler
 
A simplified Gitflow
A simplified GitflowA simplified Gitflow
A simplified Gitflow
Geshan Manandhar
 
UPC Plone Testing Talk
UPC Plone Testing TalkUPC Plone Testing Talk
UPC Plone Testing Talk
Timo Stollenwerk
 
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 graduate
Tahsin Abrar
 
Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)Clean Readable Specifications (ETC 2016)
Clean Readable Specifications (ETC 2016)
Peter Kofler
 

What's hot (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 to 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-mule
ikram_ahamed
 
Continuous Integration In Php
Continuous Integration In PhpContinuous Integration In Php
Continuous Integration In Php
Wilco Jansen
 
Test Driven Development with PHP
Test Driven Development with PHPTest Driven Development with PHP
Test Driven Development with PHP
Rogé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 2020
Abhijeet 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 Testing
Shyam Sunder Verma
 
Codeception: introduction to php testing
Codeception: introduction to php testingCodeception: introduction to php testing
Codeception: introduction to php testing
Engineor
 
Complete python toolbox for modern developers
Complete python toolbox for modern developersComplete python toolbox for modern developers
Complete python toolbox for modern developers
Jan Giacomelli
 
Moodle Development Best Pracitces
Moodle Development Best PracitcesMoodle Development Best Pracitces
Moodle Development Best Pracitces
Justin Filip
 
Software Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous InspectionSoftware Defect Prevention via Continuous Inspection
Software Defect Prevention via Continuous Inspection
Josh 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 Engineers
DevOps.com
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
wesovi
 
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 Integration
Hù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
 
Automated testing
Automated testingAutomated testing
Automated testing
Aiste Stikliute
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
Stanislav Petrov
 
Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"Dmytro Dziubenko "Developer's toolchain"
Dmytro Dziubenko "Developer's toolchain"
Fwdays
 

Similar to 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"
 

More from 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
 
Using Oro layouts
Using Oro layoutsUsing Oro layouts
Using Oro layouts
Andrew Yatsenko
 
Data cache management in php
Data cache management in phpData cache management in php
Data cache management in php
Andrew Yatsenko
 
Doctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWorkDoctrine Internals. UnitOfWork
Doctrine Internals. UnitOfWork
Andrew Yatsenko
 
Writing extensible applications
Writing extensible applicationsWriting extensible applications
Writing extensible applications
Andrew Yatsenko
 
Symfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassySymfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 Cherkassy
Andrew Yatsenko
 

More from 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
 

Recently uploaded

Blood finder application project report (1).pdf
Blood finder application project report (1).pdfBlood finder application project report (1).pdf
Blood finder application project report (1).pdf
Kamal Acharya
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
CVCSOfficial
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
upoux
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
ElakkiaU
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
Dwarkadas J Sanghvi College of Engineering
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
Gino153088
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
Kamal Acharya
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
ijseajournal
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
Indrajeet sahu
 
AI-Based Home Security System : Home security
AI-Based Home Security System : Home securityAI-Based Home Security System : Home security
AI-Based Home Security System : Home security
AIRCC Publishing Corporation
 
Supermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdfSupermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdf
Kamal Acharya
 

Recently uploaded (20)

Blood finder application project report (1).pdf
Blood finder application project report (1).pdfBlood finder application project report (1).pdf
Blood finder application project report (1).pdf
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
An Introduction to the Compiler Designss
An Introduction to the Compiler DesignssAn Introduction to the Compiler Designss
An Introduction to the Compiler Designss
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
 
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
4. Mosca vol I -Fisica-Tipler-5ta-Edicion-Vol-1.pdf
 
Accident detection system project report.pdf
Accident detection system project report.pdfAccident detection system project report.pdf
Accident detection system project report.pdf
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Open Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surfaceOpen Channel Flow: fluid flow with a free surface
Open Channel Flow: fluid flow with a free surface
 
AI-Based Home Security System : Home security
AI-Based Home Security System : Home securityAI-Based Home Security System : Home security
AI-Based Home Security System : Home security
 
Supermarket Management System Project Report.pdf
Supermarket Management System Project Report.pdfSupermarket Management System Project Report.pdf
Supermarket Management System Project Report.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