Re: OOP Design problems when integrating many (PEAR) classes

From: Date: Mon, 23 Feb 2004 17:36:34 +0000
Subject: Re: OOP Design problems when integrating many (PEAR) classes
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10872@lists.php.net to get a copy of this message
Tommy Ipsen wrote:
Hi I'm building a small (Getting big too fast) CMS system incorporating some of the PEAR classes as well as some others. My experience with OOD/OOP is fairly limited which is probably why I'm having problems putting all these classes together in a clever design/setup! These are the classes I need to use in my system: Core class
PEAR     - My thought was to build everything around this in order to use error handling, constructors and destructors
Basis classes - "built around/extending" the core class
Error     - My own Error handling routines incorporating Log and Mail
Log    - (PEAR) Used for logging errors as well as other "interesting stuff"
DB    - (PEAR) Used for DB connections (Should be able to connect to several DB's)
Mail    - (PEAR) Used for notifying webmaster of critical errors
(Since both Log and Mail should be called statically I guess they are not a problem to integrate?) Necessary classes - These are not as fundamental as the above classes but all of them are necessary
Config    - (PEAR) Used for parsing and editing config settings
I18N    - (PEAR) Used for handling multilingual sites - I'm only using the date/time features right now!
Smarty    - Used for templating - seperating logic and design
Help    - My own help class with help features for the CMS system
Menu    - My own menu class - something like HTML_Menu in PEAR
Optional classes - These classes should be easy to enable/disable in the system - perhaps via configuration
Backup    - My own backup class needed to backup db and file content as well as restoring the data
Search    - My own search class which should be able to search the content pages generated by Smarty
PDF    - My own "PDF-on-the-fly" class which should be able to generate PDF content on the fly
Stats    - My own extension of PhpOpenTracker used for monitoring the website visitors
...    - Different classes used for editing/showing specific content from db
My thinking and therefore my explanation of the problem above might be influenced by "procedural" thinking which I'm more used to than OO! I've read some articles on design patterns (www.phppattern.com) and I'm wondering whether "singleton" and "factory" might be what I need or if these concepts/methods only are recommended with PHP5? What I need are some ideas of how to design the fundamental parts of the system - ie. the parts consisting of the core class and the basic classes. If it's easy to show how to incorporate the necessary classes into this system please do so :-) This might be a stupid question with to little information about the problem - but I hope you're able to help with ideas, links to help articles/tutorials or even books recommended for reading! The last few days I've spent searching the net for articles on OOP design in PHP and right now I'm even more confused than when I've started... (Though I'm not sure this is a bad thing ;-)) If I need to explain anything further or some of the above seems totally stupid please don't hesitate to inform me of this - I'm learning every day and hopefully I will be able to see my errors when pointed out to me :-) Thanks in advance! Regards, Tommy Ipsen
Instead of re-iterating myself, I suggest checking out one of my old messages about the MVC framework. I've found it a very useful methodology for OO programming, even though it's meant for real GUI apps. If you have any quesitons about it, ask away. :-) http://marc.theaimsgroup.com/?l=php-general&m=107548315524119&w=2 -- paperCrane <Justin Patrin>

« previous php.pear.general (#10872) next »