Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Talk About Naming Things Talk

A Talk About Naming Things Talk

This was Mitchell van Wijngaarden's and my uncon talk at Dutch PHP Conference 2015.

It's a talk about naming and other important things.

Shawn McCool

June 27, 2015
Tweet

More Decks by Shawn McCool

Other Decks in Education

Transcript

  1. A Talk About Naming Things Talk Dutch PHP UnCon 2015

    Who are we even? Shawn McCool Human Mitchell van Wijngaarden Human
  2. A Talk About Naming Things Talk Dutch PHP UnCon 2015

    This talk is about naming things.
  3. A Talk About Naming Things Talk Dutch PHP UnCon 2015

    It can have dramatic consequences.
  4. A Talk About Naming Things Talk Dutch PHP UnCon 2015

    It can have dramatic consequences.
  5. class PaymentProcessor { public function process(PaymentProviderInterface $provider) { } }

    class PaymentProcessor { public function process(PaymentProvider $provider) { } }
  6. class PaymentProcessor { public function process(PaymentProviderInterface $provider) { } }

    class PaymentProcessor { public function process(PaymentProvider $provider) { } }
  7. class PaymentProcessor { public function process(PaymentProviderInterface $provider) {} } class

    PaymentProcessorClass { public function process(PaymentProviderInterface $provider) {} }
  8. class PaymentProcessor { public function process(PaymentProviderInterface $provider) {} } class

    PaymentProcessorClass { public function process(PaymentProviderInterface $provider) {} } class PaymentProcessorClass { public function processMethod(PaymentProviderInterface $providerVariable) {} }
  9. class PaymentProcessor { public function process(PaymentProviderInterface $provider) {} } class

    PaymentProcessorClass { public function process(PaymentProviderInterface $provider) {} } class PaymentProcessorClass { public function processMethod(PaymentProviderInterface $providerVariable) {} }
  10. public function __construct( PromotionRepository $repository, PromotionEligibilityChecker $checker, PromotionApplicator $applicator, ChannelContext

    $channelContext) { parent::__construct($repository, $checker, $applicator); $this->channelContext = $channelContext; }
  11. class CannotDrawFromAnEmptyDeck extends \Exception {} throw new CannotDrawFromAnEmptyDeck(); try {

    // do something } catch (CannotDrawFromAnEmptyDeck $e) { // oops }
  12. class CannotDrawFromAnEmptyDeck extends \Exception {} throw new CannotDrawFromAnEmptyDeck(); try {

    // do something } catch (CannotDrawFromAnEmptyDeck $e) { // oops }
  13. class CannotDrawFromAnEmptyDeck extends \Exception {} throw new CannotDrawFromAnEmptyDeck(); try {

    // do something } catch (CannotDrawFromAnEmptyDeck $e) { // oops }
  14. class CannotDrawFromAnEmptyDeck extends \Exception {} throw new CannotDrawFromAnEmptyDeck(); try {

    // do something } catch (CannotDrawFromAnEmptyDeck $e) { // oops }
  15. class CannotDrawFromAnEmptyDeck extends \Exception {} throw new CannotDrawFromAnEmptyDeck(); try {

    // do something } catch (CannotDrawFromAnEmptyDeck $e) { // oops }
  16. class CannotDrawFromAnEmptyDeck extends \Exception {} throw new CannotDrawFromAnEmptyDeck(); try {

    // do something } catch (CannotDrawFromAnEmptyDeck $e) { // oops }
  17. use Entities\Member; use Entities\Policy; use DTOs\BuyInsurancePolicy; use Repositories\CustomerRepository; use Repositories\PolicyRepository;

    use ValueObjects\Money; use ValueObjects\Currency; So, I heard you like namespace imports...
  18. class Member { public static function register() {} public function

    unregister() {} public function reregister() {} }
  19. Member.php class Member { public static function register() {} public

    function unregister() {} public function reregister() {} }
  20. Member.php class Member { public static function register() {} public

    function unregister() {} public function reregister() {} } class MemberOnlyRegisteredOnce extends \Exception {};
  21. namespace WhatIsANamespaceReally? { class Member { public static function register()

    {} public function unregister() {} public function reregister() {} } class MemberOnlyRegisteredOnce extends \Exception {}; function functions_toooooooooo() {} }
  22. A Talk About Naming Things Talk Dutch PHP UnCon 2015

    Find us here @shawnmccool @mitchellvanw =)