Why OO? WAS Re: [thelist] php design question

David U. davidu at everydns.net
Tue Nov 19 20:42:01 CST 2002

Steve Lewis wrote:
> how can you embrace encapsulation while embracing the principle of
> separation of content and display?

How can you not? :-)

Here's an example:
$product = new productObject($product_id);

it may have some methods like:
$product->offerDiscount($user_id); // be nice to our favorite clients!

All of those methods could be wrapped in XML, XHTML, WML, PDF, XLS or any
other format you'd want.  They could be used on search pages, product pages,
email newsletters, YOU NAME IT!  They are content _in specific_.  With this
sort of planning you could implement a pretty decent MVCC application.


> good encapsulation seems to require your display formatting occur
> within the content class.  good separation seems to require your
> content to not be formatted in by a call to content.toString() or
> content.get() or whatever you want to call it.
> --Steve

More information about the thelist mailing list