SlideShare a Scribd company logo
1 of 46
1
2
3
4
5
6
7
8
9
10
11
Pseudocode
Symfony Framework
12
13
14
15
Pseudocode
Symfony Framework
16
17
18
19
Pseudocode
Symfony Framework
20
21
22
23
24
Pseudocode
Symfony Framework
25
26
27
28
Pseudocode
Symfony Framework
29
30
31
Pseudocode
Symfony Framework
32
33
34
35
36
Pseudocode
Symfony Framework
37
38
39
40
Pseudocode
Symfony Framework
41
42
43
44
Pseudocode
Symfony Framework
45
46

More Related Content

More from DevClub_lv

Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...
Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...
Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...DevClub_lv
 
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...DevClub_lv
 
Building resilient frontend architecture by Monica Lent at FrontCon 2019
Building resilient frontend architecture by Monica Lent at FrontCon 2019Building resilient frontend architecture by Monica Lent at FrontCon 2019
Building resilient frontend architecture by Monica Lent at FrontCon 2019DevClub_lv
 
Things that every JavaScript developer should know by Rachel Appel at FrontCo...
Things that every JavaScript developer should know by Rachel Appel at FrontCo...Things that every JavaScript developer should know by Rachel Appel at FrontCo...
Things that every JavaScript developer should know by Rachel Appel at FrontCo...DevClub_lv
 
In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...
In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...
In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...DevClub_lv
 
Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019
Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019
Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019DevClub_lv
 
V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...
V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...
V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...DevClub_lv
 
Bridging the gap between UX and development - A Storybook by Marko Letic at F...
Bridging the gap between UX and development - A Storybook by Marko Letic at F...Bridging the gap between UX and development - A Storybook by Marko Letic at F...
Bridging the gap between UX and development - A Storybook by Marko Letic at F...DevClub_lv
 
Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019
Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019
Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019DevClub_lv
 
Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...
Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...
Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...DevClub_lv
 
Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019
Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019
Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019DevClub_lv
 
Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019DevClub_lv
 
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...DevClub_lv
 
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINSHOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINSDevClub_lv
 
Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...
Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...
Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...DevClub_lv
 
Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...
Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...
Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...DevClub_lv
 
How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...
How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...
How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...DevClub_lv
 
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...DevClub_lv
 
Experience gained while building a p2p lending marketplace from scratch by Ul...
Experience gained while building a p2p lending marketplace from scratch by Ul...Experience gained while building a p2p lending marketplace from scratch by Ul...
Experience gained while building a p2p lending marketplace from scratch by Ul...DevClub_lv
 
„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...
„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...
„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...DevClub_lv
 

More from DevClub_lv (20)

Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...
Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...
Emergence of IOT & Cloud – Azure by Narendra Sharma at Cloud focused 76th Dev...
 
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
Cross Platform Mobile Development using Flutter by Wei Meng Lee at Mobile foc...
 
Building resilient frontend architecture by Monica Lent at FrontCon 2019
Building resilient frontend architecture by Monica Lent at FrontCon 2019Building resilient frontend architecture by Monica Lent at FrontCon 2019
Building resilient frontend architecture by Monica Lent at FrontCon 2019
 
Things that every JavaScript developer should know by Rachel Appel at FrontCo...
Things that every JavaScript developer should know by Rachel Appel at FrontCo...Things that every JavaScript developer should know by Rachel Appel at FrontCo...
Things that every JavaScript developer should know by Rachel Appel at FrontCo...
 
In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...
In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...
In the Trenches During a Software Supply Chain Attack by Mitch Denny at Front...
 
Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019
Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019
Software Decision Making in Terms of Uncertainty by Ziv Levy at FrontCon 2019
 
V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...
V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...
V8 by example: A journey through the compilation pipeline by Ujjwas Sharma at...
 
Bridging the gap between UX and development - A Storybook by Marko Letic at F...
Bridging the gap between UX and development - A Storybook by Marko Letic at F...Bridging the gap between UX and development - A Storybook by Marko Letic at F...
Bridging the gap between UX and development - A Storybook by Marko Letic at F...
 
Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019
Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019
Case-study: Frontend in Cybersecurity by Ruslan Zavacky by FrontCon 2019
 
Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...
Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...
Building next generation PWA e-commerce frontend by Raivis Dejus at FrontCon ...
 
Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019
Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019
Parcel – your next web application bundler? by Janis Koselevs at FrontCon 2019
 
Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019
 
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
 
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINSHOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
 
Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...
Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...
Messaging in .NET via MassTransit by Arturs Karbone at .NET focused 73rd DevC...
 
Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...
Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...
Building .NET Core tools using the Roslyn API by Arthur Tabatchnic at .Net fo...
 
How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...
How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...
How We Test Audio Quality In VoIP Applications by Rihards Skrebelis from Test...
 
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
“SOLID principles in PHP – how to apply them in PHP and why should we care“ b...
 
Experience gained while building a p2p lending marketplace from scratch by Ul...
Experience gained while building a p2p lending marketplace from scratch by Ul...Experience gained while building a p2p lending marketplace from scratch by Ul...
Experience gained while building a p2p lending marketplace from scratch by Ul...
 
„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...
„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...
„OWASP Top Ten in Latvia“ by Agris Krusts from IT Centrs SIA at Security focu...
 

“Spotting Design patterns in Symfony” by Oleg Andreyev from Intexsys at Modern PHP 66th DevClub.lv

Editor's Notes

  1. Gooding evening everyone. My name is Oleg. Today I’ll tell you about Design Patterns and examples from Symfony Framework. But before we start I’d like say few words about me and our company.
  2. I’m coding for about 8 years I started my career at Intexsys in 2012, and for the last three years I’m Software Architects in my team. I’m working with Symfony since 2.0. Mostly I specialize in e-commerce.
  3. We at Intexsys are working on developing e-commerce and business automation systems. On this slide you can see some of our clients. One of important client is ecentria group, which operates with around ~16 stores, and larges store sell over 1mil products, and companies annual turnover is more then $300mil We are working with more then 100 developers, and almost 50 of developers are located here in Riga, and you’ll be able to meat some of them later tonight at our afterparty.
  4. How uses PHP? How uses Symfony? For those who does not work with PHP, or Symfony. READ SLIDE Since when I started working with Symfony it has evolved a lot, they developed Symfony Flex which is a composer plugin which helps developers to start Symfony in micro-style, they’ve developed Auto-wiring for Dependency Container, so you do not need to spend time on writing YAML and XML.
  5. Who does not know what Design Patterns are? [pause] The father of the pattern language movement Christopher Alexander wrote: READ SLIDE To keep it simple Design Patterns are well-tested solutions for common problems. Design patterns are not a silver bullet to all your problems. Do not try to force them Bad things may happen, if you do so. and keep in mind that design patterns are solutions to problems, not solutions finding problems.
  6. They help you get design ”right” faster They can speed up development process, because they provider clear picture on how you are implementing the design They imply code reuse, therefore better software design, better maintainability of your code They provider common language same for programmers.
  7. Today I’ll cover three main classifications, Behavioral, Creational, Structural, that can be applied to any language, but there are other classification like Security patterns, Concurrency patterns, Real Time patterns.
  8. READ SLIDE
  9. The main idea behind Chain of Responsibility, is to avoid coupling sender of a request to its receiver by giving more than one object a chance to handle the request.
  10. more than one object may handle a request, and the handler isn’t known a beforehand. You want to execute handlers in a specific order
  11. I’ll be showing you “pseudocode” on how logic could be implemented without COR, and then I’ll showing example from Symfony Framework with implemented pattern. Who can answer what's wrong with this code? [pause] SRP – it’s doing everything OCP – you’ll have to modify it to add new behavior it’s will be hard to test and maintain such code, because before covering handleAccess() you’ll need to cover all methods before. Such code is not flexible, because you cannot easily inject in handle
  12. Define a family of algorithms, encapsulate each one, and make them interchangeable.
  13. it's not uml
  14. many related classes differ only in their behavior. you need different variants of an algorithm. an algorithm uses data that clients shouldn’t know about. a class defines many behaviors, and these appear as multiple conditional statements in its operations
  15. Who can answer what's wrong with this code? [pause] DIP (Dependency inversion principle) SRP OCP
  16. Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
  17. When a change to one object requires changing others, and you don’t know how many objects need to be changed. When an object should be able to notify other objects without making assumptions about who these objects are.
  18. Who can answer what's wrong with this code? [pause] OCP SRP DIP (if you extract methods into separate classes)
  19. Separate the construction of a complex object from its representation so that the same construction process can create different representations.
  20. the algorithm for creating a complex object should be independent of the parts that make up the object and how they’re assembled. the construction process must allow different representations for the object that’s constructed.
  21. Who can answer what's wrong with this code? [pause] OPC DIP
  22. Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
  23. a class can’t anticipate the class of objects it must create. a class wants its subclasses to specify the objects it creates.
  24. Who can answer what's wrong with this code? [pause] SRP OCP DIP
  25. Ensure a class only has one instance, and provide a global point of access to it.
  26. Unlike global variables, Singleton guarantees that there is just one class' instance. No one, except Singleton itself, can replace the cached instance. there must be exactly one instance of a class, and it must be accessible to clients from a well-known access point. For example, a single database object, shared by different parts of the program. when the sole instance should be extensible by subclassing, and clients should be able to use an extended instance without modifying their code.
  27. Who can answer what's wrong with this code? [pause] Global state makes program state unpredictable, no control over global variable If your code has an external dependency that isn't explicitly introduced into the code then whoever gets the job of maintaining your code will have to go looking for it to figure out where it came from.
  28. structural patterns which focuses on building relations between classes
  29. Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
  30. to add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects. for responsibilities that can be withdrawn. when extension by subclassing is impractical. Sometimes a large number of independent extensions are possible and would produce an explosion of subclasses to support every combination. Or a class definition may be hidden or otherwise unavailable for subclassing.
  31. Who can answer what's wrong with this code? [pause] Why bad: Losing flexibility Coupling Making fragile base-class
  32. Provide a surrogate or placeholder for another object to control access to it.
  33. Who can answer what's wrong with this code? [pause] DataCollector is something that collects information in development environment for toolbar Why bad: Losing flexibility Coupling Making fragile base-class
  34. Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.
  35. you want to use an existing class, and its interface does not match the one you need. you want to create a reusable class that cooperates with unrelated or unforeseen classes, that is, classes that don’t necessarily have compatible interfaces. (object adapter only) you need to use several existing subclasses, but it’s impractical to adapt their interface by subclassing every one. An object adapter can adapt the interface of its parent class.
  36. Who can answer what's wrong with this code? [pause] DIP Code Coupled