Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Principles of PHP Package Design - Elcodi Community Day

1,219 views

Published on

With many great tools available for sharing packages of PHP code, it is now up to you as a developer to design these packages well. You have to decide what to put in a package, when to split a package and on what other packages you can safely depend.

You will learn how to make good decisions about your package design and release reliable, highly usable and therefore highly esteemed packages of PHP code.

Published in: Technology
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Principles of PHP Package Design - Elcodi Community Day

  1. 1. Principles of PHP Package Design Object oriented design for packages Matthias Noback - Noback's Office Elcodi Community Day - 10/25/2014
  2. 2. Matthias Noback Noback's Office PHP developer, consultant Writer, speaker Proud father · · · 2/50
  3. 3. Blog php-and-symfony.matthiasnoback.nl 3/50
  4. 4. A Year With Symfony leanpub.com/a-year-with-symfony 4/50
  5. 5. Tight coupling Coupling to a framework 5/50
  6. 6. Code 6/50
  7. 7. Squiggly lines 7/50
  8. 8. Code 8/50
  9. 9. Packages There are many different kinds 9/50
  10. 10. Class design 10/50
  11. 11. Package design Nothing? butunclebob.com 11/50
  12. 12. Principles of PHP Package Design leanpub.com/principles-of-php-package-design 12/50
  13. 13. Package design Cohesion 13/50
  14. 14. Package design Coupling 14/50
  15. 15. A - Cohesion principles Perspective: the package in isolation 15/50
  16. 16. 1 - The Release Reuse Equivalence Principle The granule of reuse is the granule of release 16/50
  17. 17. 1 - The Release Reuse Equivalence Principle Version control and hosting Composer package definition Meta-files Auto-loading · · · · Semantic versioning Quality control · Branches Tags Backward compatibility - - - · 17/50
  18. 18. 1 - The Release Reuse Equivalence Principle If you don't have the time to turn your reusable code into a proper package... Don't release it. 18/50
  19. 19. 2- The Common Reuse Principle Classes that are used together are packaged together If you use one class of a package, you will use all its other classes too. 19/50
  20. 20. 2- The Common Reuse Principle Smell: Feature strata 20/50
  21. 21. 2- The Common Reuse Principle Example of feature strata: the Symfony Security Component 21/50
  22. 22. 2- The Common Reuse Principle Smell: Classes with different dependencies 22/50
  23. 23. 2- The Common Reuse Principle Example of different dependencies: Gaufrette 23/50
  24. 24. 2- The Common Reuse Principle Different dependencies: Gaufrette { "name": "knplabs/gaufrette", ... "suggest": { "knplabs/knp-gaufrette-bundle": "to use with Symfony2", "dropbox-php/dropbox-php": "to use the Dropbox adapter", "rackspace/php-opencloud" : "to use Opencloud adapter", "herzult/php-ssh": "to use SFtp adapter", "phpseclib/phpseclib": "to use PhpseclibSftp adapter", "aws/aws-sdk-php": "to use the Amazon S3 adapter", "amazonwebservices/aws-sdk-for-php": "to use the legacy Amazon S3 adapters", "doctrine/dbal": "to use the Doctrine DBAL adapter", "microsoft/windowsazure": "to use Microsoft Azure Blob Storage adapter", "ext-zip": "to use the Zip adapter", "ext-apc": "to use the APC adapter", ... }, ... } 24/50
  25. 25. 2 - The Common Reuse Principle Leszek Prabucki's response 25/50
  26. 26. 3 - The Common Closure Principle Classes that change together are packaged together 26/50
  27. 27. 3 - The Common Closure Principle Reasons for change The application's features change The business rules change The web framework's best practices change The persistence library's configuration changes ... · · · · · 27/50
  28. 28. 3 - The Common Closure Principle Smell: code for multiple application layers Web User Interface Command-line interface Model Infrastructure services · · · · 28/50
  29. 29. B - Coupling principles Perspective: the package in relation to other packages 29/50
  30. 30. 4 - The Acyclic Dependencies Principle The dependency graph of packages must have no cycles 30/50
  31. 31. 4 - The Acyclic Dependencies Principle 31/50
  32. 32. Stability Something is stable if it's resistant to change. 32/50
  33. 33. 5 - The Stable Dependencies Principle An irresponsible package 33/50
  34. 34. 5 - The Stable Dependencies Principle A dependent package 34/50
  35. 35. 5 - The Stable Dependencies Principle An instable package: irresponsible and dependent 35/50
  36. 36. 5 - The Stable Dependencies Principle A responsible package 36/50
  37. 37. 5 - The Stable Dependencies Principle An independent package 37/50
  38. 38. 5 - The Stable Dependencies Principle A stable package: responsible and independent 38/50
  39. 39. 5 - The Stable Dependencies Principle Depend in the direction of stability 39/50
  40. 40. 5 - The Stable Dependencies Principle Counter example 40/50
  41. 41. 6 - The Stable Abstractions Principle What is more likely to change? Something concrete or something abstract? A class or an interface? · · 41/50
  42. 42. 6 - The Stable Abstractions Principle Abstractness should increase with stability 42/50
  43. 43. Summary Reuse/release equivalence principle Common reuse principle Common closure principle Acyclic dependencies principle Stable dependencies principle Stable abstractions principle · Reuse only code that you can release - as a product. · - All code in a package is reused at the same time. · - Code in a package only changes for a few reasons. · - No cycles in the dependency graph. · - Only depend on more stable packages. · - More stable packages are also more abstract. 43/50
  44. 44. Word of advice You can't maximize them all at the same time. Keep them in mind while you are working on a package. 44/50
  45. 45. Principles of PHP Package Design leanpub.com/principles-of-php-package-design I'm impressed. — Robert C. Martin 45/50
  46. 46. Principles of PHP Package Design Get a 10 dollar discount: http://leanpub.com/principles-of-php-package-design/c/symfony-barcelona 46/50
  47. 47. Questions? twitter @matthiasnoback leanpub leanpub.com/principles-of-php-package-design 47/50
  48. 48. Image courtesy Clean Coders GitHub BitBucket Packagist PoEAA But Uncle Bob Robert Martin · · · · · · · 48/50
  49. 49. 50/50

×