"Joe Stump" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sure ...
>
> I'm of the belief that OOP (in PHP anyways) has great use for core
> libraries. Core libraries, by their nature, generally don't output HTML.
> It's a core libraries job to separate logic and presentation. How portable
> is your library that outputs HTML for a guy who wants PDF/WAP/XML output?
>
> For instance, I have a product class that does various things to format
> product *data* prior to my procedural scripts putting it into my Smarty
> templates. If that product class outputted the data in HTML it would be
> useless to me for WAP users or a script that generated PDF versions of our
> online catalog.

Core libraries are of course first candidate for OOP, but I think there are
many other places where you can use it successfully. Take for instance how
it is used in TemplateTamer.

In it, you define a class responsible for the generation of the page. In
typicall usage you have a common class that all page classes inherit from,
and which defines elements of page common to all pages on the site, and
specific page classes implement only the parts they differ in. When the site
grows, it is common to refine the hierarchy of page classes, so you have one
page class on the top, then a few below it describing main sections of the
site, and then on the bottom concrete page classes.

Another OOP usage in TT can be in creating classes that represent GUI
components. For instance on one site I have worked, I have created a
JobAdForm object, that handles for reponsible displaying form and editing of
JobAd object. Than when I needed similar but litle more extended version for
superuser pages, I have just created a subclass SuperuserJobAdForm, and
overided necessary parts, but inhertied 95% of code.

So I think there is usage for OOP also in "gui" parts of the code, where it
can also help better organization of code, and reuse between the pages or
components on the same site.

rush
--
http://www.templatetamer.com/




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to