SlideShare a Scribd company logo
PHP Mega Meetup, Sep, 2020, Anti patterns in php
Anti-patterns in php
Sep, 2020
Ahmed
Who is this guy
?
● Ahmed
● In the industry for about 9 years, I
worked as SRE, PM but mostly
Software engineer.
● I love all languages but PHP a little
bit more.
● Opensource advocate.
PHP Mega Meetup, Sep, 2020, Anti patterns in php

Recommended for you

Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self

Fine-tuning your development environment means more than just getting your editor set up just so -- it means finding and setting up a variety of tools to take care of the mundane housekeeping chores that you have to do -- so you have more time to program, of course! I'll share the benefits of a number of yak shaving expeditions, including using App::GitGot to batch manage _all_ your git repos, App::MiseEnPlace to automate getting things _just_ so in your working environment, and a few others as time allows. Delivered at OpenWest 2016, 13 July 2016

productivityautomationperl
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper KulikowskiTGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski

Automated tests are pieces of code that execute other code to verify outputs without manual testing. There are unit, integration and acceptance tests. Programmers are the worst testers of their own code so automated testing allows code to be tested and refactored more easily. Code without automated tests is just a rumor rather than a real feature. Test code is also production code so it is important to show code, not just talk about it. Automated testing makes developers out of programmers.

It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec

The document discusses test-driven development (TDD) and behavior-driven development (BDD). It explains that BDD uses external specifications to describe behavior before coding starts. This solves issues with TDD like where to begin and what to test. BDD uses a double cycle of writing scenarios in Behat and then examples in Phpspec at the internal class level. Phpspec is used to describe behavior through examples before coding classes. The document provides instructions on installing Phpspec and describes how to define a specification and examples.

bddphpbehat
● Low cost, high-risk actions.
● Composer.
● Inheritance.
● Standardization
● Testing
● Logging
● Observability
● Continuous integration
● Containers
Anti-patterns in php
Low cost, high-risk actions
Anti-patterns in php
PHP is easy and makes everything sounds that everything will work correctly on
it's own.
Low cost, high-risk actions
Low cost, high-risk actions
After you deploy your app to production, always expect:
- To be asked to extend certain feature.
- Add new feature.
- To get bug reports and be able to understand it and fix it.

Recommended for you

Follow these reasons to know java’s importance
Follow these reasons to know java’s importanceFollow these reasons to know java’s importance
Follow these reasons to know java’s importance

The document discusses several reasons for the importance of Java, including that Java applications can run on any system due to the Java virtual machine, Java has strong IDE support to help developers, and Java is used widely in areas like Android and enterprise applications. Specifically, it notes that Java's virtual machine allows applications to run the same on all processors and operating systems, Java IDEs like Eclipse make development easier, and Java is commonly used for Android development and for integrating with other systems through APIs.

crbtech solution reviews
Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)

The document discusses common myths about the Symfony framework and attempts to dispel them. It addresses claims that Symfony is hard to learn, extremely coupled, not really programming but just configuration, restrictive, and badly performing. For each myth, counterarguments are provided explaining why Symfony is in fact easy to learn through documentation and community support, has become decoupled over time, allows for significant programming through controllers and custom code, is flexible through configuration, and can be optimized for performance.

symfonyphpframework
那些年,我們一起玩的萬花筒(Kaliedoscopic)
那些年,我們一起玩的萬花筒(Kaliedoscopic)那些年,我們一起玩的萬花筒(Kaliedoscopic)
那些年,我們一起玩的萬花筒(Kaliedoscopic)

The document discusses an Android developer's experiences using OpenCV for image processing tasks in Android applications. It mentions using OpenCV for tasks like converting between RGB and YUV color spaces, applying filters like Laplacian, and chaining or running tasks in parallel. OpenCV provides high performance image processing and avoids issues with fragmentation in the Android camera APIs. Examples are given of using OpenCV to record video and do face detection.

javataipeisoftware
Low cost, high-risk actions
Every technical action makes it easier or harder to :
- Quickly modify the code base and make the PMs/CXOs happy.
- Make you and your teammates happy when they fix a bug.
So, while coding ...
Anti-patterns in php
Composer
Please, please, do not use the Death Star,
The Death Star is a bomb waiting to explode in the
team face
always use version constraints.
Composer
Please do not edit composer files manually at all
Please, please, use composer commands, they are super easy.
“The new composer package is working locally but not working on the server”

Recommended for you

Myphp-busters: symfony framework
Myphp-busters: symfony frameworkMyphp-busters: symfony framework
Myphp-busters: symfony framework

The document discusses common myths about the Symfony framework. It addresses criticisms that Symfony is hard to learn, extremely coupled, focuses only on configuration rather than programming, is restrictive, performs poorly, and claims it is the ultimate tool. For each myth, the document provides counter arguments explaining why Symfony is easy to learn with documentation and community support, has become less coupled over time, involves significant programming beyond just configuration, and allows for flexibility and customization. It also notes performance depends on caching and configuration choices.

phpuk2009frameworkphp
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and Spock

Ho to use Groovy and Spock framework for testing Java projects. Examples of using Storm testing facility.

stormspockgroovy
BDD in PHP - Behat
BDD in PHP - BehatBDD in PHP - Behat
BDD in PHP - Behat

BDD + PHP = Behat Behavior Driven Development (BDD) is a technique for testing and developing software using an agile approach. Behat is a BDD testing tool for PHP that allows writing tests in a natural language format called features. Behat tests in PHP look like scenarios written in plain English with structured keywords.

bddphpbehat
Extending classes
● Each parent should not many children. It becomes hard to change the
parent even with 100% testing coverage.
● System design is thrown out of the window with the overuse of inheritance,
easy solutions like visibility change for the sake of easiness over-power the
design and leads to GOD-classes eventually very easily.
● This is the exact recipe to create a bad monolith
Extending classes
Inheritance is not the only way
to extend a functionality.
Also taxes are high
on inheritance these days.
Extending classes
Inheritance is not the only way
to extend a functionality,
for example composition.
https://en.wikipedia.org/wiki/Composition_over_inheritance
Fun Fun Function: Composition over Inheritance
Depending on the environment
Avoid depending on the environment, for example
Instead: you can use environment variables
“I can not test it, It works only on PROD”

Recommended for you

composer_talk_20160209
composer_talk_20160209composer_talk_20160209
composer_talk_20160209

Composer allows PHP developers to declare and manage dependencies of PHP packages and libraries. It provides tools for installing, updating, and managing dependencies of PHP applications and packages. The document discusses how to use Composer to declare dependencies in a composer.json file, install dependencies, publish your own packages, and consume packages published by other developers. It highlights benefits like dependency management, autoloading, and keeping dependencies updated.

REPL-driven development with pry
REPL-driven development with pry  REPL-driven development with pry
REPL-driven development with pry

Ideas and techniques for using a REPL in general and pry specificially, to improve your development workflow and solve problems faster.

rubyprogramming
CI
CICI
CI

Continuous Integration (CI) is a software development practice where developers regularly merge their work into a central repository. This allows for automated builds and tests which catch errors early. CI helps reduce integration problems, improves code quality, and allows for more frequent deployments. The document discusses implementing CI with tools like Jenkins, build scripts, unit testing, code analysis, and notifications to improve the development process.

Standardization
https://xkcd.com/927/
Standardization
Standardization
Standardization
API with no OpenAPI/Swagger specs is not an API.
But It’s a good way to waste time and frustration everyone.
https://github.com/zircote/swagger-php
https://api-platform.com/

Recommended for you

Lessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's AssLessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's Ass

This document discusses lessons learned from apps that performed better than Titanium apps in terms of cross-platform concerns, memory management, slow initialization times, multiple contexts, and code structure. It provides solutions for each problem area, such as not aiming for 100% code reuse across platforms, planning for platform differences, closing windows and nulling references to help Titanium cleanup memory, deferring script loading, avoiding multiple contexts, and building a suite of custom components for code structure. The document concludes with a demo and code walkthrough.

titaniumjavascript
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testing

Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your Drupal site. These stories can then be auto-tested against your website, whether in the midst of development, or on a live site. And yes, it’s as cool as it sounds! Behat, if embraced by enough Drupal folks, has the potential to vastly improve the way we build and test Drupal websites. Testing language can be developed by module maintainers, and allow nearly codefree testing to be developed by everyone, as needed, per site. Behat IS NOT unit testing nor a specification testing tool. Behat is a Scenario-oriented BDD framework with functional testing capabilities as part of a communication process between stake-holders and developers. Think Agile User Stories meets Selenium. Behat is currently used to test Drupal.org, allowing a variety of coders to work on a single site, and ensure that no existing functionality will break as they add new features. Or as it's migrated from one version to another. Imagine that on your site. We will review Behat (and Mink, and related code), how to use it with Drupal, Drush, and the existing modules/code to support that. We will demo live testing, and so how easy it is to write tests, with and without code.

drupaldrupal 7behat
BDD with Behat
BDD with BehatBDD with Behat
BDD with Behat

This document introduces Behavior Driven Development (BDD) and Behat, a tool that implements BDD for PHP projects. BDD works by writing feature descriptions, or stories, in a simple language anyone can understand before writing any code. Behat uses the Gherkin syntax to write stories. It provides a six step process to write and test stories through the creation of feature files, object definitions, step definitions, and running tests. Stories are written from the outside-in, focusing development on key business requirements and keeping code simple.

pdxphpbddphp
Standardization
Kafka messages without avro schema is the best way to make debugging a
nightmare.
Also please do not serialize 1 MB of data in kafka please, Kafka is not MySql.
Testing
Testing positive cases only
is not great idea
Logging
Logging
“It’s not working”

Recommended for you

scriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibilityscriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibility

Scriptcs is an open source project that enables a rich C# scripting experience. It allows users to script and execute C# code or use a REPL without needing compilation, projects, or solutions. Scriptcs uses a relaxed C# syntax and provides features like loading scripts and assemblies through directives. It aims to provide a simpler scripting workflow compared to a typical C# development experience that requires setting up projects in an IDE. Scriptcs code can be distributed easily and run on any machine with the scriptcs CLI installed. The documentation provides demonstrations of key scriptcs features and how to extend it through script packs and modules.

monoroslynscriptcs
Node & Express as Workflow Tools
Node & Express as Workflow ToolsNode & Express as Workflow Tools
Node & Express as Workflow Tools

Node & Express as Workflow Tools “Enterprise” and “Node.js” are generally two terms which are rarely seen together, but developing on an (what are considered) “enterprise level” stack doesn’t mean you can’t sneak some Node.js into your workflow. This talk will cover using Node.js, Express, Grunt/Gulp, Commander to build custom workflow tools, mock APIs, and test suites to allow you to maintain sanity while working with more traditional environments. We will cover a simple use case for using Node and Express to smooth Front-end development workflow, and how to package your custom tool as an NPM module for others to install. Presented live at FITC's Spotlight: MEAN Stacks event held on March 28th, 2014 More info at FITC.ca

 
by FITC
2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire

A workshop held in StartIT as part of Catena Media learning sessions. We aim to dispel the notion that large PHP applications tend to be sluggish, resource-intensive and slow compared to what the likes of Python, Erlang or even Node can do. The issue is not with optimising PHP internals - it's the lack of proper introspection tools and getting them into our every day workflow that counts! In this workshop we will talk about our struggles with whipping PHP Applications into shape, as well as work together on some of the more interesting examples of CPU or IO drain.

phpblackfiresymfony
Logging
“We do not know what happened”.
“This is my best guess”.
“It’s only 1 customer of 1000, I’m sure he need to clear the cache.”
Logging
Logs are insurance policy,
you don’t care about it till you need them, then it’s too late.
Bare minimum: please please log any failures to perform external operations or
operations impacting business process.
(dbs, , kafka, curl, … )
Logging
Example of stressful and also useless logging messages
“Error happened”
“Order not processed”
“Life is hard”
Logging
Log level matters,
if everything is WARNING or ERROR then nothing is important.

Recommended for you

2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire

We aim to dispel the notion that large PHP applications tend to be sluggish, resource-intensive and slow compared to what the likes of Python, Erlang or even Node can do. The issue is not with optimising PHP internals - it's the lack of proper introspection tools and getting them into our every day workflow that counts! In this workshop we will talk about our struggles with whipping PHP Applications into shape, as well as work together on some of the more interesting examples of CPU or IO drain.

phpsymfonyblackfire
10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf

The document discusses 10 code anti-patterns that developers should avoid in software development. These anti-patterns include: 1) The Golden Hammer where the same solution is used for different problems, 2) Spaghetti Code which is messy and unorganized, 3) Reinventing the Wheel by creating custom solutions instead of using existing libraries, 4) Dependency Hell which occurs when too many third-party libraries are imported, 5) God Classes that have too many responsibilities, 6) Hard Coding values instead of externalizing them, 7) Boat Anchor code that is written but not needed, 8) Lava Flow legacy code that is risky to change, 9) Copy-Paste Programming without reviewing code, and 10) Cargo Cult Programming

programming
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?

Conférence présentée lors du summer meetup de l'AFUP à Limoges le 19 juin 2018. Son objectif est de présenter plusieurs outils permettant de gagner rapidement en efficacité au quotidien.

phpdockerquality
Observability
“Do you know that your website is down ?”
“A customer called and said he sees something in checkout says 503.”
Observability
Create alert for website downtime.
Also watch the business impact,
“no orders in the last hour”.
Simplest tool is uptimerobot , similar tools.
Observability
Watching/having-and-alert for error logs.
Simplest tool is sentry.io, similar tools.
Continuous integration
The team discussed best practices, and after a lengthy discussion, they agreed.

Recommended for you

12 tricks to avoid hackers breaks your CI / CD
12 tricks to avoid hackers breaks your  CI / CD12 tricks to avoid hackers breaks your  CI / CD
12 tricks to avoid hackers breaks your CI / CD

This document discusses 12 tricks hackers use to compromise continuous integration and continuous delivery (CI/CD) systems. It outlines attacks such as installing malware via libraries, leaking secrets, executing malicious code in pipelines, consuming cloud services to cause outages, zip bombs, memory bombs, fork bombs, and compromising APIs. The document emphasizes the importance of limiting permissions, monitoring systems, and assuming insider attackers when hardening CI/CD pipelines and infrastructure.

securitycontinuous integrationcontinuous deployment
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)

My presentation on 'Enterprise PHP' at the PHP London Conference 2008 (http://www.phpconference.co.uk)

Dictionary Within the Cloud
Dictionary Within the CloudDictionary Within the Cloud
Dictionary Within the Cloud

The document discusses the goals and development of an online dictionary application being built by three developers called the Giraffes. It aims to provide dictionary functionality through the cloud to replace installed software and reduce disk space usage. The application displays dictionary results for selected text within the browser using JavaScript. Future plans include browser extensions, additional dictionaries, language support, and APIs for other developers and users to integrate new dictionaries.

Continuous integration
Best practices are amazing, but we are humans, we always do mistakes.
“We are only humans” said by ahmed , 11 sep 2020
Automate anything you can in your application pipelines, save your team the
hassle.
Gitlab ci, bitbucket ci, circle ci, buildkite ci, …..
Containers
Docker is a company with a tool after it’s name.
The technology name is containers.
Please use “containers” instead of “docker”.
Containers
In short, containers images are compressed archives contains
- your application code itself
- The binaries that run it (php fpm)
- The binaries config (php.ini)
Containers
Please use aggressive opcache options on docker/containers on PROD
Opcache.validate_timestamps => 0
Each deployment is a new container with new memory,
no need to worry about this.

Recommended for you

Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate

* What is boilerplate? * Common setup steps * Common build steps * Practices to ensure efficient development * Tools * Python demo

pythonboilerplatefastapi
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011

This document provides an overview of building mobile applications using PhoneGap. It discusses how PhoneGap works by instantiating a chromeless browser and implementing a bridge to allow calling native device APIs from JavaScript. It also covers topics like plugins, debugging mobile apps, performance considerations, and the PhoneGap API for accessing device features like the camera, contacts, and geolocation. The document advocates for a mobile-first approach using modern web standards and technologies when building apps with PhoneGap.

txjsjavascriptjs
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.

This document discusses the journey of transitioning infrastructure management at Namecheap to an immutable infrastructure as code model using tools like Terraform, Docker, and Jenkins. Key points include taking over a project from an outsourcing company, setting up immutable infrastructure with infrastructure as code, configuring CI/CD pipelines as code in Jenkins, and lessons learned around testing, chaos engineering, and encouraging team feedback. The overall goals were to make infrastructure hard to break, easy to repair, and easy to modify.

Containers
Storage in containers are ephemeral,
please do not attempt to write on it or use for anything,
even for logging, especially for logging.
Use GCS or AWS S3 or anything else.
Send logs to centralized logging.
Containers
Containers startup time should be very very small
In other words:
Composer install on container startup is a bad idea.
Npm install on on container startup is a a bad idea.
Containers
The same container image must be
deployable to production, staging and local.
If not, debugging becomes impossible and testing extremely hard.
More resources
Video: PHPUnit Best Practices (Sebastian Bergmann)
Video collection: Best practices in PHP
Article: Eliminating Visual Debt

Recommended for you

Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps

DevOps aims to automate the process between software development and IT operations. This includes continuous integration, continuous delivery, and infrastructure management. The document discusses definitions of DevOps, tools for source control, continuous integration, deployment, testing, monitoring and containers/orchestration. It emphasizes creating automation to reduce errors and speed up development cycles. Automation should be implemented gradually by focusing on the most painful manual tasks each sprint.

What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...

This document discusses compilers and their capabilities. It notes that compilers support multiple languages as inputs and targets, can perform many optimizations, and include tools to help developers write better code. Modern compilers are highly customizable and include sanitizers to detect bugs and undefined behavior at runtime. The document emphasizes that compilers are complex programs that can outperform attempts by developers to manually optimize code.

accucompilerstoke
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals

This document discusses strategies for modernizing front-end codebases in an incremental way. It suggests starting with basic modularization by splitting code into logical chunks, then concatenating and minifying modules. Next steps include loading modules on demand using various module systems. Graceful deprecation is recommended over breaking changes. The document also advocates trying new frameworks on side projects first before adopting one. Maintaining good development practices like testing, linting, code style rules and performance testing is emphasized over choosing any particular framework.

Questions ?
Thank you for listening
Twitter: ama_abdou
WWW: ahmd.io

More Related Content

What's hot

The Power Of Refactoring (PHPNW)
The Power Of Refactoring (PHPNW)The Power Of Refactoring (PHPNW)
The Power Of Refactoring (PHPNW)
Stefan Koopmanschap
 
Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!
Julien Biezemans
 
HTML5 for dummies
HTML5 for dummiesHTML5 for dummies
HTML5 for dummies
Ran Bar-Zik
 
Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self
John Anderson
 
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper KulikowskiTGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
Trójmiejska Grupa Testerska
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
Giulio De Donato
 
Follow these reasons to know java’s importance
Follow these reasons to know java’s importanceFollow these reasons to know java’s importance
Follow these reasons to know java’s importance
nishajj
 
Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)
Stefan Koopmanschap
 
那些年,我們一起玩的萬花筒(Kaliedoscopic)
那些年,我們一起玩的萬花筒(Kaliedoscopic)那些年,我們一起玩的萬花筒(Kaliedoscopic)
那些年,我們一起玩的萬花筒(Kaliedoscopic)
PRADA Hsiung
 
Myphp-busters: symfony framework
Myphp-busters: symfony frameworkMyphp-busters: symfony framework
Myphp-busters: symfony framework
Stefan Koopmanschap
 
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and Spock
Eugene Dvorkin
 
BDD in PHP - Behat
BDD in PHP - BehatBDD in PHP - Behat
BDD in PHP - Behat
Łukasz Kużyński
 
composer_talk_20160209
composer_talk_20160209composer_talk_20160209
composer_talk_20160209
Bradley Wogsland
 
REPL-driven development with pry
REPL-driven development with pry  REPL-driven development with pry
REPL-driven development with pry
Stephen Mariano Cabrera
 
CI
CICI
Lessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's AssLessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's Ass
Kevin Whinnery
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testing
nyccamp
 
BDD with Behat
BDD with BehatBDD with Behat
BDD with Behat
Richard Shank
 
scriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibilityscriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibility
Filip W
 
Node & Express as Workflow Tools
Node & Express as Workflow ToolsNode & Express as Workflow Tools
Node & Express as Workflow Tools
FITC
 

What's hot (20)

The Power Of Refactoring (PHPNW)
The Power Of Refactoring (PHPNW)The Power Of Refactoring (PHPNW)
The Power Of Refactoring (PHPNW)
 
Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!Cucumber.js: Cuke up your JavaScript!
Cucumber.js: Cuke up your JavaScript!
 
HTML5 for dummies
HTML5 for dummiesHTML5 for dummies
HTML5 for dummies
 
Automate Yo' Self
Automate Yo' SelfAutomate Yo' Self
Automate Yo' Self
 
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper KulikowskiTGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
 
It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
Follow these reasons to know java’s importance
Follow these reasons to know java’s importanceFollow these reasons to know java’s importance
Follow these reasons to know java’s importance
 
Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)Myphp-busters: symfony framework (PHPCon.it)
Myphp-busters: symfony framework (PHPCon.it)
 
那些年,我們一起玩的萬花筒(Kaliedoscopic)
那些年,我們一起玩的萬花筒(Kaliedoscopic)那些年,我們一起玩的萬花筒(Kaliedoscopic)
那些年,我們一起玩的萬花筒(Kaliedoscopic)
 
Myphp-busters: symfony framework
Myphp-busters: symfony frameworkMyphp-busters: symfony framework
Myphp-busters: symfony framework
 
Testing Storm components with Groovy and Spock
Testing Storm components with Groovy and SpockTesting Storm components with Groovy and Spock
Testing Storm components with Groovy and Spock
 
BDD in PHP - Behat
BDD in PHP - BehatBDD in PHP - Behat
BDD in PHP - Behat
 
composer_talk_20160209
composer_talk_20160209composer_talk_20160209
composer_talk_20160209
 
REPL-driven development with pry
REPL-driven development with pry  REPL-driven development with pry
REPL-driven development with pry
 
CI
CICI
CI
 
Lessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's AssLessons Learned From Applications That Kicked Titanium's Ass
Lessons Learned From Applications That Kicked Titanium's Ass
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testing
 
BDD with Behat
BDD with BehatBDD with Behat
BDD with Behat
 
scriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibilityscriptcs - scripted C#, REPL and script extensibility
scriptcs - scripted C#, REPL and script extensibility
 
Node & Express as Workflow Tools
Node & Express as Workflow ToolsNode & Express as Workflow Tools
Node & Express as Workflow Tools
 

Similar to PHP Mega Meetup, Sep, 2020, Anti patterns in php

2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
Marko Mitranić
 
2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire
Marko Mitranić
 
10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf
Ahmed Salama
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
AFUP_Limoges
 
12 tricks to avoid hackers breaks your CI / CD
12 tricks to avoid hackers breaks your  CI / CD12 tricks to avoid hackers breaks your  CI / CD
12 tricks to avoid hackers breaks your CI / CD
Daniel Garcia (a.k.a cr0hn)
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
Ivo Jansch
 
Dictionary Within the Cloud
Dictionary Within the CloudDictionary Within the Cloud
Dictionary Within the Cloud
gueste4978b94
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
Stanislav Petrov
 
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011
Brian LeRoux
 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.
Vlad Fedosov
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
Omid Vahdaty
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...
Sławomir Zborowski
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
cgack
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
devObjective
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
ColdFusionConference
 
Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skype
Mário Almeida
 
Old Is the New New
Old Is the New NewOld Is the New New
Old Is the New New
Kevlin Henney
 
Advantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworksAdvantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworks
Katy Slemon
 
Is Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic GascIs Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic Gasc
Pôle Systematic Paris-Region
 
Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020
Daniel Garcia (a.k.a cr0hn)
 

Similar to PHP Mega Meetup, Sep, 2020, Anti patterns in php (20)

2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire2019 StartIT - Boosting your performance with Blackfire
2019 StartIT - Boosting your performance with Blackfire
 
2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire2019 PHP Serbia - Boosting your performance with Blackfire
2019 PHP Serbia - Boosting your performance with Blackfire
 
10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf10 Code Anti-Patterns to Avoid in Software Development.pdf
10 Code Anti-Patterns to Avoid in Software Development.pdf
 
Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?Comment améliorer le quotidien des Développeurs PHP ?
Comment améliorer le quotidien des Développeurs PHP ?
 
12 tricks to avoid hackers breaks your CI / CD
12 tricks to avoid hackers breaks your  CI / CD12 tricks to avoid hackers breaks your  CI / CD
12 tricks to avoid hackers breaks your CI / CD
 
Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)Enterprise PHP (PHP London Conference 2008)
Enterprise PHP (PHP London Conference 2008)
 
Dictionary Within the Cloud
Dictionary Within the CloudDictionary Within the Cloud
Dictionary Within the Cloud
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011
 
DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.DevOps Fest 2020. immutable infrastructure as code. True story.
DevOps Fest 2020. immutable infrastructure as code. True story.
 
Introduction to DevOps
Introduction to DevOpsIntroduction to DevOps
Introduction to DevOps
 
What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...What every C++ programmer should know about modern compilers (w/ comments, AC...
What every C++ programmer should know about modern compilers (w/ comments, AC...
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Android reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skypeAndroid reverse engineering - Analyzing skype
Android reverse engineering - Analyzing skype
 
Old Is the New New
Old Is the New NewOld Is the New New
Old Is the New New
 
Advantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworksAdvantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworks
 
Is Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic GascIs Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic Gasc
 
Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020
 

More from Ahmed Abdou

Opesnource and jobs
Opesnource and jobsOpesnource and jobs
Opesnource and jobs
Ahmed Abdou
 
Cloud and Devops
Cloud and DevopsCloud and Devops
Cloud and Devops
Ahmed Abdou
 
About Linux , Shake your brain
About Linux , Shake your brainAbout Linux , Shake your brain
About Linux , Shake your brain
Ahmed Abdou
 
Future is now,Future is Opensource
Future is now,Future is OpensourceFuture is now,Future is Opensource
Future is now,Future is Opensource
Ahmed Abdou
 
You're open source
You're open sourceYou're open source
You're open source
Ahmed Abdou
 
المصادر المفتوحة , فرصة
المصادر المفتوحة , فرصةالمصادر المفتوحة , فرصة
المصادر المفتوحة , فرصة
Ahmed Abdou
 
Menufya SFD 2012
Menufya SFD 2012 Menufya SFD 2012
Menufya SFD 2012
Ahmed Abdou
 

More from Ahmed Abdou (7)

Opesnource and jobs
Opesnource and jobsOpesnource and jobs
Opesnource and jobs
 
Cloud and Devops
Cloud and DevopsCloud and Devops
Cloud and Devops
 
About Linux , Shake your brain
About Linux , Shake your brainAbout Linux , Shake your brain
About Linux , Shake your brain
 
Future is now,Future is Opensource
Future is now,Future is OpensourceFuture is now,Future is Opensource
Future is now,Future is Opensource
 
You're open source
You're open sourceYou're open source
You're open source
 
المصادر المفتوحة , فرصة
المصادر المفتوحة , فرصةالمصادر المفتوحة , فرصة
المصادر المفتوحة , فرصة
 
Menufya SFD 2012
Menufya SFD 2012 Menufya SFD 2012
Menufya SFD 2012
 

Recently uploaded

Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
Eric D. Schabell
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
welrejdoall
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
Larry Smarr
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
ScyllaDB
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
Matthew Sinclair
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
Stephanie Beckett
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
Adam Dunkels
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
huseindihon
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 

Recently uploaded (20)

Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
Observability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetryObservability For You and Me with OpenTelemetry
Observability For You and Me with OpenTelemetry
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
Manual | Product | Research Presentation
Manual | Product | Research PresentationManual | Product | Research Presentation
Manual | Product | Research Presentation
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
The Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive ComputingThe Rise of Supernetwork Data Intensive Computing
The Rise of Supernetwork Data Intensive Computing
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024What’s New in Teams Calling, Meetings and Devices May 2024
What’s New in Teams Calling, Meetings and Devices May 2024
 
How to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptxHow to Build a Profitable IoT Product.pptx
How to Build a Profitable IoT Product.pptx
 
find out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challengesfind out more about the role of autonomous vehicles in facing global challenges
find out more about the role of autonomous vehicles in facing global challenges
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 

PHP Mega Meetup, Sep, 2020, Anti patterns in php

  • 3. Who is this guy ? ● Ahmed ● In the industry for about 9 years, I worked as SRE, PM but mostly Software engineer. ● I love all languages but PHP a little bit more. ● Opensource advocate.
  • 5. ● Low cost, high-risk actions. ● Composer. ● Inheritance. ● Standardization ● Testing ● Logging ● Observability ● Continuous integration ● Containers Anti-patterns in php
  • 6. Low cost, high-risk actions Anti-patterns in php
  • 7. PHP is easy and makes everything sounds that everything will work correctly on it's own. Low cost, high-risk actions
  • 8. Low cost, high-risk actions After you deploy your app to production, always expect: - To be asked to extend certain feature. - Add new feature. - To get bug reports and be able to understand it and fix it.
  • 9. Low cost, high-risk actions Every technical action makes it easier or harder to : - Quickly modify the code base and make the PMs/CXOs happy. - Make you and your teammates happy when they fix a bug.
  • 10. So, while coding ... Anti-patterns in php
  • 11. Composer Please, please, do not use the Death Star, The Death Star is a bomb waiting to explode in the team face always use version constraints.
  • 12. Composer Please do not edit composer files manually at all Please, please, use composer commands, they are super easy. “The new composer package is working locally but not working on the server”
  • 13. Extending classes ● Each parent should not many children. It becomes hard to change the parent even with 100% testing coverage. ● System design is thrown out of the window with the overuse of inheritance, easy solutions like visibility change for the sake of easiness over-power the design and leads to GOD-classes eventually very easily. ● This is the exact recipe to create a bad monolith
  • 14. Extending classes Inheritance is not the only way to extend a functionality. Also taxes are high on inheritance these days.
  • 15. Extending classes Inheritance is not the only way to extend a functionality, for example composition. https://en.wikipedia.org/wiki/Composition_over_inheritance Fun Fun Function: Composition over Inheritance
  • 16. Depending on the environment Avoid depending on the environment, for example Instead: you can use environment variables “I can not test it, It works only on PROD”
  • 20. Standardization API with no OpenAPI/Swagger specs is not an API. But It’s a good way to waste time and frustration everyone. https://github.com/zircote/swagger-php https://api-platform.com/
  • 21. Standardization Kafka messages without avro schema is the best way to make debugging a nightmare. Also please do not serialize 1 MB of data in kafka please, Kafka is not MySql.
  • 22. Testing Testing positive cases only is not great idea
  • 25. Logging “We do not know what happened”. “This is my best guess”. “It’s only 1 customer of 1000, I’m sure he need to clear the cache.”
  • 26. Logging Logs are insurance policy, you don’t care about it till you need them, then it’s too late. Bare minimum: please please log any failures to perform external operations or operations impacting business process. (dbs, , kafka, curl, … )
  • 27. Logging Example of stressful and also useless logging messages “Error happened” “Order not processed” “Life is hard”
  • 28. Logging Log level matters, if everything is WARNING or ERROR then nothing is important.
  • 29. Observability “Do you know that your website is down ?” “A customer called and said he sees something in checkout says 503.”
  • 30. Observability Create alert for website downtime. Also watch the business impact, “no orders in the last hour”. Simplest tool is uptimerobot , similar tools.
  • 31. Observability Watching/having-and-alert for error logs. Simplest tool is sentry.io, similar tools.
  • 32. Continuous integration The team discussed best practices, and after a lengthy discussion, they agreed.
  • 33. Continuous integration Best practices are amazing, but we are humans, we always do mistakes. “We are only humans” said by ahmed , 11 sep 2020 Automate anything you can in your application pipelines, save your team the hassle. Gitlab ci, bitbucket ci, circle ci, buildkite ci, …..
  • 34. Containers Docker is a company with a tool after it’s name. The technology name is containers. Please use “containers” instead of “docker”.
  • 35. Containers In short, containers images are compressed archives contains - your application code itself - The binaries that run it (php fpm) - The binaries config (php.ini)
  • 36. Containers Please use aggressive opcache options on docker/containers on PROD Opcache.validate_timestamps => 0 Each deployment is a new container with new memory, no need to worry about this.
  • 37. Containers Storage in containers are ephemeral, please do not attempt to write on it or use for anything, even for logging, especially for logging. Use GCS or AWS S3 or anything else. Send logs to centralized logging.
  • 38. Containers Containers startup time should be very very small In other words: Composer install on container startup is a bad idea. Npm install on on container startup is a a bad idea.
  • 39. Containers The same container image must be deployable to production, staging and local. If not, debugging becomes impossible and testing extremely hard.
  • 40. More resources Video: PHPUnit Best Practices (Sebastian Bergmann) Video collection: Best practices in PHP Article: Eliminating Visual Debt
  • 41. Questions ? Thank you for listening Twitter: ama_abdou WWW: ahmd.io