Re: [PHP] PHP5 and the DOM model
- Date: Thu, 17 Apr 2008 16:43:55 -0700
- From: Nick Stinemates <nick@xxxxxxxxxxxxxx>
- Subject: Re: [PHP] PHP5 and the DOM model
On Thu, Apr 17, 2008 at 10:05:11AM +0200, Michael Preminger wrote:
> Hello!
>
> Seems that PHP gets more and more object oriented, which is good.
>
> I am now running a course in PHP, using PHP 5, where we are going to
> use the *DOM* interface. I am trying to teach them good OO practices,
> meaning that we insistently hide properties and expose them as get or
> set methods.
Get/set methods are more often than not breaking encapsulation and
should be avoided (unless purposefully designing Model object or
something similar.)
>
> Looking at the PHPs *DOM* implementation, I see that many of the
> properties are exposed directly, without even offering get methods.
Can you please provide an example of where this is happening?
>
> 1. Is there something I am misunderstanding orotherwise missing? (I
> havenot used *DOM* in PHP before).
>
> 2.This poses a pedagogical problem for me as a teacher. How do I
> explain this contradiction to my students?
Explain that the DOM API and PHP's binding to the DOM API are 2
different things with 2 different goals.
>
> Thanks
>
> Michael
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php