You are here: Re: To all OOP eggheads out there. I need A bit of design help « PHP Programming Language « IT news, forums, messages
Re: To all OOP eggheads out there. I need A bit of design help

Posted by A. Timurhan Cevik on 10/03/66 11:33

You can try abstract factory pattern to create the content.

Such as, you have an abstract factory class for the content
class Content(){}
class PagesContent : Content()
{}
class NewsContent : Content()
{}
class abstract AbstractContentFactory()
{
public abstract function returnNews();
...
}
class PublishedContentFactory : AbstractContentFactory()
{
public function returnNews()
{
news=new NewsContent();
news.status='Published'
return news;
}
}
class UnpublishedContentFactory : AbstarctContentFactory()
{
public function returnNews()
{
news=new NewsContent();
news.status='UnPublished'
return news;
}
}
and such. By this design, you can add new content and have classes
based on content and keeping publish status.

Another design would be keeping the publish status in a different class
and associating the content class with this class, if methods would be
the same for all content types.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация