Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://c2.com/cgi/wiki?ParallelInheritanceHierarchies" rel="nofollow">Parallel Inheritance Hierarchies</a> are considered a <em>code smell</em>, something that should be refactored.</p> <p>Martin Fowler suggests in "Refactoring":</p> <blockquote> <p>The general strategy for eliminating the duplication is to make sure that instances of one hierarchy refer to instances of the other. If you use <strong>Move Method</strong> and <strong>Move Field</strong>, the hierarchy on the referring class disappears.</p> </blockquote> <p>But I think you can go one step further. I don't know, what your decision was based on to make sub classes for each advertiser and their campaigns, but I would challenge this decision. A good practise to follow is to <a href="http://c2.com/cgi/wiki?CompositionInsteadOfInheritance" rel="nofollow">Favor Composition over Inheritance</a>.</p> <p>You could start like that:</p> <pre><code>class Advertiser { protected $authentication; } class AdvertiserCampaign { protected $authentication; } interface AdvertiserAuthentication { } class SpecialAuthenticationForAdvertiserUno implements AdvertiserAuthentication { } class NoSpecialAuthenticationForOtherAdvertisers implements AdvertiserAuthentication { } </code></pre> <p>Now the first difference between the advertisers is moved into another class. Go on with other differences until each advertiser is just an object of <code>Advertiser</code> composed in a different way. The same goes for the campaigns. I would like to be more concrete but as stated before, I have no idea why your advertisers all have their own classes in the first place.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload