My opinion is that You should import only "UnitComposite" and "Unit" should be imported before "UnitComposite" class definition. ArmyComponent "knows" only that it extends "UnitComposite" it shouldn't bother what's "above" that class...
On 7 Sty, 23:53, Josh <joshs.silver...@gmail.com> wrote: > Does anybody have an opinion on using App::import for an abstract base > class before defining the concrete sub-class? It seems like a way to > avoid including all abstract parents before creating a concrete > instance... but it violates good OO practices it seems? Do people have > an opinion on this? > > Outside of cake, I'd probably group these classes in the same file, or > perhaps group the abstract classes in one file and leaves in > another... to avoid unnecessary includes. > > Example (with a composite pattern where Unit and UnitComposite are > abstract and Army extends UnitComposite which extends Unit): > > App::import('Component', 'Unit'); > App::import('Component', 'UnitComposite'); > > class ArmyComponent extends UnitComposite...
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en