3 ms·
Interesting. I'm not sure if enterprise OO design patterns / clean code / solid / GoF / all golden OO etc.. is a help or hindrance in a typical build the wor
by sitepodmatt 9y ago
Interesting. I'm not sure if enterprise OO design patterns / clean code / solid / GoF
/ all golden OO etc.. is a help or hindrance in a typical build the world destroy the world per request model that is PHP. It might be in the spirit but if you're freshly creating all these objects and a big ass dependency graph from scratch per request for each request then you'd be better be sure the promise of PHP 7 VM being superbly improved holds true in your app's case. In other stacks you'd have a lot of this available for the next request at app level or cached somehow (already deserialized), in PHP you really are Creation Day 1 each hit. When you grow to something as complicated as an ecommerce frontend all nasty hacks come into play around the New World New Request model definitely undo a lot of benefits - see Magento as a good example (the cache system - essentially concat / rewriting PHP files) - people have even suggested let's go back to pure SQL and echo..
I initially thought this was going to be the use something else meme - http://devhumor.com/content/uploads/images/December2016/php-best-practices.jpg http://devhumor.com/content/uploads/images/December2016/php-...
- icebraining 9y agoWhich part of the linked article do you see advocating "creating all these objects and a big ass dependency graph"?
- wolco 9y agoHaving dozens of classes making up some big dependency class is probably not going to slow you down as much as you expect. Querying for data will be the bottle neck. Until you move to some in memory solution trying to reduce the number of classes called to increase speed will have little effect because that will be cached anyways.
- debacle 9y ago> if you're freshly creating all these objects and a big ass dependency graph from scratch per request for each request That's not how modern PHP works.
- icedchai 9y agoHow's it work then?
- debacle 9y agohttps://community.1and1.com/php-7/ https://community.1and1.com/php-7/ That article isn't great, but okay enough for this discussion. There's a great deal of interpreter level caching + object caching (in more advanced system) that allows modern PHP to reap a lot of the benefits of the "everything fresh every request" model while also being faster than pretty much anything but Lua and Perl.