Re: Design for Large OO poject

From: Date: Sat, 10 Nov 2001 05:22:34 +0000
Subject: Re: Design for Large OO poject
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-74079@lists.php.net to get a copy of this message
Hi Daniel, Most OOP projects contain multiple hierarchies, not just one. Normally DB is not made the base class. Think in terms of whether the objects have is-type-relationships or use-part-relationships. Eg. Boring_News uses-the-part MySQL_DB, so Boring_News uses the MySQL_DB object as a member var. class Boring_News { $var db; ... } Sexy_Articles is-a-type-of News, so perhaps Sexy_Articles can be derived from the News class. class Sexy_Articles extends News { ... } Hope this helps. Bye, John Daniel Harik <gatop@hot.ee> wrote in message news:1343024288.20011108182448@hot.ee... > Hello guys, > > I've started large long-term project, i'm buildingd my own CMS (content > manegment system) with few more developers, compared to nuke i want > it to be fully object-oriented, so that adding more modules would be > easy and logical, i have built first beta version of it, i want to > maximize code reuse, so here is the structure of my classes > > class DB{} > class Member extends DB() > class News extends Member{} > class Poll extends News{} > ........................... > All new blocks and modules are added > in this place > ........................... > class NewBlock extends BitOlderBlock{} > > after this comes the class that's always in the end > > class Blocks extends NewBlock{} > > then i have a file that uses all this library > > looks like this: > --------------- > <? > include ("blocks.php"); > class mainPage extends Blocks{ > > function displayMainPage(){ > $this->heading(); > > $this->block_news(); > > $this->footer(); > } > > > } > $page = new mainPage; > $page->displayMainPage(); > ?> > > > -------------- > > > I'm very new for big Object-oriented projects, but i'm not new to PHP, > i was wondering if my design is good or bad, if you could show me > what's wrong with it i'd be very thankful > > Thank You very much, and have a nice day :-) > > > > > > > > -- > Best regards, > Daniel mailto:gatop@hot.ee >

« previous php.general (#74079) next »