SlideShare a Scribd company logo
Modularity problems
Architecture of corporate Symfony-applications
Who I am
● Senior Software Engineer @ Upwork
● 10+ years of PHP (Pear -> ZF 1 -> Symfony 1 -> Yii 1 -> ....)
● 4+ years of Symfony 2
● Also experience in Java (Spring, GWT, ...), C# (.Net), Ruby (Rails), JS (...)
● KNU, Faculty of Cybernetics, Theory of Programming
How to perceive this speech
This speech ...
● … is not a manual
⇒ use Google please!
● … covers some problems of modularity
⇒ it doesn’t cover a lot of stuff.
● … displays some Symfony problems
⇒ but we love Symfony anyway =)
What is “framework”?
Library vs Framework
Library
useful pieces of
code in one place
Framework
set of libraries, tools
and principles of
application
development
Framework
● It is a platform
● It defines application structure
● It unites components
● It offers tools
● It describes best practices
Modules
Modules (plugins, extensions, bundles etc.) is a
way to extend a framework.
Symfony modules
Component is Symfony library.
You need Composer to use Component.
Bundle is Symfony module.
You also need Composer to use Bundle.
But you must enable Bundle in your AppKernel
How does Bundle extend our framework?
● Commands
● Controllers
● Public services
○ also tagged services (event listeners, annotation processors etc.)
● Service Container processing
○ add support of custom service tags
○ preconfigure other modules (prepend)
● Other common code and assets (careful!)
Symfony 2.x ⇒ 4.x
● Flex
○ Flex is a tool to simplify bundle installation.
● Bundle-less
○ Application is not a bundle
○ Symfony 4.x application directory structure is self-sufficient
Corporate Symfony applications
Specifics of big product companies
● A lot of developer teams
● A lot of code
● A lot of different applications may fit in one project
● “Core” team
Example structure of corporate applications
Symfony
Team 1
Application 1
Team 1 library
Team 2
Application 2Common library 1
Common library 2
Example problems
● Create a bundle to process some common incoming
HTTP headers
● Make an update of some widely used bundle and make
everyone to upgrade
● Create a bundle with common layouts/assets (careful!)
Corporate is not opensource
● We don’t try to create an universal solution
● Bundles can depend on corporate architecture
● Some corporate bundles can go opensource
Standard complications
Versioning
How could we prevent breakage of our application by our
dependencies?
APP Bundle-1
Team 1
We’ve broken
everything...
because we can!
Use semantic
versioning!
https://semver.org
Dependencies
What if one bundle depends on another?
APP Bundle-1 Bundle-3
Team 1 Team 2
Bundle-2
Please add Bundle-3
to your AppKernel
Migration
APP Bundle-1 Bundle-3
Team 1 Team 2
Bundle-2
OK! Will try to
add that to the
next sprint
We released
major version of
Bundle-3. Please
update!
Coupling and cohesion
High cohesion
= modules must have exact purpose and clear functionality
Low coupling
= modules have to be independent from others
SOLID on bundle level
S: Bundle should have single purpose
O: Bundle should provide an API and be protected from external changes
L: Bundle should be a bundle
I: Bundle should not make us use unnecessary features
D: Bundle should depend on APIs (interfaces) instead of other bundles
Solution:
create libraries for common interfaces
Depend on libraries in your bundle instead of other bundles
Interfaces rarely break
Example: PSR-3 (logging interface)
Service as a dependency
BundleX BundleY
Service-Y2
LibraryZ
InterfaceZ
Service-X1 Service-Y1
Service as a dependency - Symfony way
my_chat:
dependencies:
http_client: "my_http.client"
formatter: "html.formatter"
Pass service name to bundle configuration
Note: use “alias” feature to reference a service by a
name
Framework-agnostic code
● Your code should be independent from framework
(controllers too)
● But bundles still depend on Symfony (bundles extend
your framework)
Unusual complications
Dependency hell
● Great amount of dependencies
● Great amount of consumers of your dependency
○ Hard to ask all consumers to update ASAP
● Lack of proper versioning
○ Legacy code
● Requirement of a different major versions of the same
dependency
● Dependencies created by different teams using
different approaches
Dependency hell - Best practices
● KISS
● Work hard if you want to create a shared library
● Implement versioning ASAP
● Provide style guidelines
Listeners
● Listener priority
○ Example: what is the priority of a security listener?
○ How to ensure that your listener will be the first one?
○ Conflict of listeners order at the same priority
● Standard “kernel” events vs own dispatchers
● How to disable a listener?
○ master/slave requests
○ by condition from another listeners
● How to be sure that listener processed an event?
Listeners - Best practices
● Avoid listeners (if you can)
○ lazy initialization
○ explicit pipelines
○ before/after
● Final listeners
● Provide exact API
○ define priority value
Assets & Twig
● Assetic
○ Removed for Symfony 4
○ Webpack Encore doesn’t do the same stuff
● Twig
○ Static HTML code(templates) depends on your JS/CSS framework
○ Hard to manage SSR and CSR
○ You still need another templating engine for JS
● Asset management
○ npm vs composer
○ Is Encore useful?
Assets & Twig - Best practices
● Don’t provide assets by bundles
● Avoid using of templates by bundles
● Move common static web stuff to separate project
(under npm)
Bundle testing
How to test a bundle?
Tester Bundle
Bundle testing - Best practices
public function testMyBundle()
{
$container = $this->createContainer();
$container->registerExtension(new MyExtension());
$container->loadFromExtension('my', []);
$container->compile();
$this->assertTrue(is_a(
$container->getDefinition('my.service')->getClass(),
MyInterface::class,
true
));
}
Other funny complications with bundles
● Register a route from a bundle
● A/B testing and graceful feature delivery
● Advanced bundle configuration processing
○ Type check
○ What about compile time validation?
● Optional dependencies
● What is “bundle API”? Can we define it well?
● Common application configuration
● ...
Conclusions
So where are we now?
● Modules (bundles) is a good way to extend a framework
- Now we know how to use them well
- Now we know the difference between modules and libraries
● Complications
- We know the complications that may appear when project grows
- We will try to avoid complications on early stage
What about Symfony
● Symfony is not an ideal framework
- But still the best one (for PHP)
- It’s made by people (not gods)
- It can be improved
- Now we can see parts that can be improved
What about us?
Be smart!
Thanks!
Any questions?

More Related Content

What's hot

Learning typescript
Learning typescriptLearning typescript
Learning typescript
Alexandre Marreiros
 
Distributing OSGi
Distributing OSGiDistributing OSGi
Distributing OSGi
Bram de Kruijff
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
Offirmo
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
Udaya Kumar
 
Typescript 101 introduction
Typescript 101   introductionTypescript 101   introduction
Typescript 101 introduction
Bob German
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on android
Richard Chang
 
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San JoseTypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
Steve Reiner
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
Laurent Duveau
 
Typescript ppt
Typescript pptTypescript ppt
Typescript ppt
akhilsreyas
 
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil BartlettHow to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
mfrancis
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScript
Gil Fink
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
Remo Jansen
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
Laurent Duveau
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
Patrick John Pacaña
 
Mono Repo
Mono RepoMono Repo
Mono Repo
Zacky Pickholz
 
Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)
Gaetano Giunta
 
TypeScript
TypeScriptTypeScript
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
Laurent Duveau
 
vb script
vb scriptvb script
vb script
Anand Dhana
 
Introduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston LeviIntroduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston Levi
Winston Levi
 

What's hot (20)

Learning typescript
Learning typescriptLearning typescript
Learning typescript
 
Distributing OSGi
Distributing OSGiDistributing OSGi
Distributing OSGi
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
 
Typescript 101 introduction
Typescript 101   introductionTypescript 101   introduction
Typescript 101 introduction
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on android
 
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San JoseTypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
TypeScript for Alfresco and CMIS - Alfresco DevCon 2012 San Jose
 
TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
Typescript ppt
Typescript pptTypescript ppt
Typescript ppt
 
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil BartlettHow to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
How to Make Your Code OSGi Friendly Without Depending on OSGi - Neil Bartlett
 
Getting Started with TypeScript
Getting Started with TypeScriptGetting Started with TypeScript
Getting Started with TypeScript
 
Introducing type script
Introducing type scriptIntroducing type script
Introducing type script
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
 
Mono Repo
Mono RepoMono Repo
Mono Repo
 
Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)Making Symfony Services async with RabbitMq (and more Symfony)
Making Symfony Services async with RabbitMq (and more Symfony)
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
vb script
vb scriptvb script
vb script
 
Introduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston LeviIntroduction to TypeScript by Winston Levi
Introduction to TypeScript by Winston Levi
 

Similar to Modularity problems

Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdfManaging Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Andrew Lamb
 
CFEngine 3
CFEngine 3CFEngine 3
CFEngine 3
Brian Repko
 
OSGi Sticker Shock Eclipse Con 2010
OSGi Sticker Shock   Eclipse Con 2010OSGi Sticker Shock   Eclipse Con 2010
OSGi Sticker Shock Eclipse Con 2010
ericjohnson
 
Николай Паламарчук "Управление зависимостями в больших проектах"
Николай Паламарчук "Управление зависимостями в больших проектах" Николай Паламарчук "Управление зависимостями в больших проектах"
Николай Паламарчук "Управление зависимостями в больших проектах"
Fwdays
 
Survey of Container Build Tools
Survey of Container Build ToolsSurvey of Container Build Tools
Survey of Container Build Tools
Michael Ducy
 
Node js meetup
Node js meetupNode js meetup
Node js meetup
Ansuman Roy
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
Diego Freniche Brito
 
Development and deployment with composer and kite
Development and deployment with composer and kiteDevelopment and deployment with composer and kite
Development and deployment with composer and kite
Christian Opitz
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build Technology
Philip Johnson
 
Tribal Nova Docker feedback
Tribal Nova Docker feedbackTribal Nova Docker feedback
Tribal Nova Docker feedback
Nicolas Degardin
 
Hibernate 1x2
Hibernate 1x2Hibernate 1x2
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
Deepak Chandani
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
mfrancis
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
prakashk453625
 
Framework
FrameworkFramework
Framework
Seungjoon Lee
 
Fighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless php
Fabio Pellegrini
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
Chris Cowan
 
Third party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationshipThird party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationship
Sascha Brinkmann
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Antonio Peric-Mazar
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
Ahmed Abdou
 

Similar to Modularity problems (20)

Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdfManaging Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
Managing Software Dependencies and the Supply Chain_ MIT EM.S20.pdf
 
CFEngine 3
CFEngine 3CFEngine 3
CFEngine 3
 
OSGi Sticker Shock Eclipse Con 2010
OSGi Sticker Shock   Eclipse Con 2010OSGi Sticker Shock   Eclipse Con 2010
OSGi Sticker Shock Eclipse Con 2010
 
Николай Паламарчук "Управление зависимостями в больших проектах"
Николай Паламарчук "Управление зависимостями в больших проектах" Николай Паламарчук "Управление зависимостями в больших проектах"
Николай Паламарчук "Управление зависимостями в больших проектах"
 
Survey of Container Build Tools
Survey of Container Build ToolsSurvey of Container Build Tools
Survey of Container Build Tools
 
Node js meetup
Node js meetupNode js meetup
Node js meetup
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Development and deployment with composer and kite
Development and deployment with composer and kiteDevelopment and deployment with composer and kite
Development and deployment with composer and kite
 
Introduction to Software Build Technology
Introduction to Software Build TechnologyIntroduction to Software Build Technology
Introduction to Software Build Technology
 
Tribal Nova Docker feedback
Tribal Nova Docker feedbackTribal Nova Docker feedback
Tribal Nova Docker feedback
 
Hibernate 1x2
Hibernate 1x2Hibernate 1x2
Hibernate 1x2
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Framework
FrameworkFramework
Framework
 
Fighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless phpFighting legacy with hexagonal architecture and frameworkless php
Fighting legacy with hexagonal architecture and frameworkless php
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Third party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationshipThird party libraries and OSGi - a complicated relationship
Third party libraries and OSGi - a complicated relationship
 
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
Workshop: Symfony2 Intruduction: (Controller, Routing, Model)
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
 

More from Юлия Коваленко

Архитектура фронтенда и дизайн-системы
Архитектура фронтенда и дизайн-системыАрхитектура фронтенда и дизайн-системы
Архитектура фронтенда и дизайн-системы
Юлия Коваленко
 
Blockchain
Blockchain Blockchain
Symfony 2018 slides
Symfony 2018 slidesSymfony 2018 slides
Symfony 2018 slides
Юлия Коваленко
 
Filesystem abstractions and msg queue sergeev - symfony camp 2018
Filesystem abstractions and msg queue   sergeev - symfony camp 2018Filesystem abstractions and msg queue   sergeev - symfony camp 2018
Filesystem abstractions and msg queue sergeev - symfony camp 2018
Юлия Коваленко
 
20181023 progressive web_apps_are_here_sfcampua
20181023 progressive web_apps_are_here_sfcampua20181023 progressive web_apps_are_here_sfcampua
20181023 progressive web_apps_are_here_sfcampua
Юлия Коваленко
 
Contract testing symfony camp 2018
  Contract testing symfony camp 2018  Contract testing symfony camp 2018
Contract testing symfony camp 2018
Юлия Коваленко
 
Database types-1 (1)
Database types-1 (1)Database types-1 (1)
Database types-1 (1)
Юлия Коваленко
 

More from Юлия Коваленко (7)

Архитектура фронтенда и дизайн-системы
Архитектура фронтенда и дизайн-системыАрхитектура фронтенда и дизайн-системы
Архитектура фронтенда и дизайн-системы
 
Blockchain
Blockchain Blockchain
Blockchain
 
Symfony 2018 slides
Symfony 2018 slidesSymfony 2018 slides
Symfony 2018 slides
 
Filesystem abstractions and msg queue sergeev - symfony camp 2018
Filesystem abstractions and msg queue   sergeev - symfony camp 2018Filesystem abstractions and msg queue   sergeev - symfony camp 2018
Filesystem abstractions and msg queue sergeev - symfony camp 2018
 
20181023 progressive web_apps_are_here_sfcampua
20181023 progressive web_apps_are_here_sfcampua20181023 progressive web_apps_are_here_sfcampua
20181023 progressive web_apps_are_here_sfcampua
 
Contract testing symfony camp 2018
  Contract testing symfony camp 2018  Contract testing symfony camp 2018
Contract testing symfony camp 2018
 
Database types-1 (1)
Database types-1 (1)Database types-1 (1)
Database types-1 (1)
 

Recently uploaded

“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

Modularity problems

  • 1. Modularity problems Architecture of corporate Symfony-applications
  • 2. Who I am ● Senior Software Engineer @ Upwork ● 10+ years of PHP (Pear -> ZF 1 -> Symfony 1 -> Yii 1 -> ....) ● 4+ years of Symfony 2 ● Also experience in Java (Spring, GWT, ...), C# (.Net), Ruby (Rails), JS (...) ● KNU, Faculty of Cybernetics, Theory of Programming
  • 3.
  • 4. How to perceive this speech This speech ... ● … is not a manual ⇒ use Google please! ● … covers some problems of modularity ⇒ it doesn’t cover a lot of stuff. ● … displays some Symfony problems ⇒ but we love Symfony anyway =)
  • 6. Library vs Framework Library useful pieces of code in one place Framework set of libraries, tools and principles of application development
  • 7. Framework ● It is a platform ● It defines application structure ● It unites components ● It offers tools ● It describes best practices
  • 8. Modules Modules (plugins, extensions, bundles etc.) is a way to extend a framework.
  • 9. Symfony modules Component is Symfony library. You need Composer to use Component. Bundle is Symfony module. You also need Composer to use Bundle. But you must enable Bundle in your AppKernel
  • 10. How does Bundle extend our framework? ● Commands ● Controllers ● Public services ○ also tagged services (event listeners, annotation processors etc.) ● Service Container processing ○ add support of custom service tags ○ preconfigure other modules (prepend) ● Other common code and assets (careful!)
  • 11. Symfony 2.x ⇒ 4.x ● Flex ○ Flex is a tool to simplify bundle installation. ● Bundle-less ○ Application is not a bundle ○ Symfony 4.x application directory structure is self-sufficient
  • 13. Specifics of big product companies ● A lot of developer teams ● A lot of code ● A lot of different applications may fit in one project ● “Core” team
  • 14. Example structure of corporate applications Symfony Team 1 Application 1 Team 1 library Team 2 Application 2Common library 1 Common library 2
  • 15. Example problems ● Create a bundle to process some common incoming HTTP headers ● Make an update of some widely used bundle and make everyone to upgrade ● Create a bundle with common layouts/assets (careful!)
  • 16. Corporate is not opensource ● We don’t try to create an universal solution ● Bundles can depend on corporate architecture ● Some corporate bundles can go opensource
  • 18. Versioning How could we prevent breakage of our application by our dependencies? APP Bundle-1 Team 1 We’ve broken everything... because we can!
  • 20. Dependencies What if one bundle depends on another? APP Bundle-1 Bundle-3 Team 1 Team 2 Bundle-2 Please add Bundle-3 to your AppKernel
  • 21. Migration APP Bundle-1 Bundle-3 Team 1 Team 2 Bundle-2 OK! Will try to add that to the next sprint We released major version of Bundle-3. Please update!
  • 22. Coupling and cohesion High cohesion = modules must have exact purpose and clear functionality Low coupling = modules have to be independent from others
  • 23.
  • 24. SOLID on bundle level S: Bundle should have single purpose O: Bundle should provide an API and be protected from external changes L: Bundle should be a bundle I: Bundle should not make us use unnecessary features D: Bundle should depend on APIs (interfaces) instead of other bundles
  • 25. Solution: create libraries for common interfaces Depend on libraries in your bundle instead of other bundles Interfaces rarely break Example: PSR-3 (logging interface)
  • 26. Service as a dependency BundleX BundleY Service-Y2 LibraryZ InterfaceZ Service-X1 Service-Y1
  • 27. Service as a dependency - Symfony way my_chat: dependencies: http_client: "my_http.client" formatter: "html.formatter" Pass service name to bundle configuration Note: use “alias” feature to reference a service by a name
  • 28. Framework-agnostic code ● Your code should be independent from framework (controllers too) ● But bundles still depend on Symfony (bundles extend your framework)
  • 30. Dependency hell ● Great amount of dependencies ● Great amount of consumers of your dependency ○ Hard to ask all consumers to update ASAP ● Lack of proper versioning ○ Legacy code ● Requirement of a different major versions of the same dependency ● Dependencies created by different teams using different approaches
  • 31. Dependency hell - Best practices ● KISS ● Work hard if you want to create a shared library ● Implement versioning ASAP ● Provide style guidelines
  • 32. Listeners ● Listener priority ○ Example: what is the priority of a security listener? ○ How to ensure that your listener will be the first one? ○ Conflict of listeners order at the same priority ● Standard “kernel” events vs own dispatchers ● How to disable a listener? ○ master/slave requests ○ by condition from another listeners ● How to be sure that listener processed an event?
  • 33. Listeners - Best practices ● Avoid listeners (if you can) ○ lazy initialization ○ explicit pipelines ○ before/after ● Final listeners ● Provide exact API ○ define priority value
  • 34. Assets & Twig ● Assetic ○ Removed for Symfony 4 ○ Webpack Encore doesn’t do the same stuff ● Twig ○ Static HTML code(templates) depends on your JS/CSS framework ○ Hard to manage SSR and CSR ○ You still need another templating engine for JS ● Asset management ○ npm vs composer ○ Is Encore useful?
  • 35. Assets & Twig - Best practices ● Don’t provide assets by bundles ● Avoid using of templates by bundles ● Move common static web stuff to separate project (under npm)
  • 36. Bundle testing How to test a bundle? Tester Bundle
  • 37. Bundle testing - Best practices public function testMyBundle() { $container = $this->createContainer(); $container->registerExtension(new MyExtension()); $container->loadFromExtension('my', []); $container->compile(); $this->assertTrue(is_a( $container->getDefinition('my.service')->getClass(), MyInterface::class, true )); }
  • 38. Other funny complications with bundles ● Register a route from a bundle ● A/B testing and graceful feature delivery ● Advanced bundle configuration processing ○ Type check ○ What about compile time validation? ● Optional dependencies ● What is “bundle API”? Can we define it well? ● Common application configuration ● ...
  • 40. So where are we now? ● Modules (bundles) is a good way to extend a framework - Now we know how to use them well - Now we know the difference between modules and libraries ● Complications - We know the complications that may appear when project grows - We will try to avoid complications on early stage
  • 41. What about Symfony ● Symfony is not an ideal framework - But still the best one (for PHP) - It’s made by people (not gods) - It can be improved - Now we can see parts that can be improved