PHP 5 DOM and exposing properties

PHP 5 DOM and exposing properties

am 10.04.2008 08:29:38 von Michaelp

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.

Looking at the PHPs DOM implementation, I see that many of the
properties are exposed directly, without even offering get methods.

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?

Thanks

Michael

Re: PHP 5 DOM and exposing properties

am 10.04.2008 20:49:55 von webmasterNOSPAMTHANKS

*** Michaelp escribió/wrote (Wed, 9 Apr 2008 23:29:38 -0700 (PDT)):
> 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?

PHP is not a pure object oriented language focused from the beginning on
building huge applications and designed by the greatest computer science
minds in the world. PHP is basically a very simple scripting language
created by a guy to handle his online resumé that was successful and
evolved... quite a lot. Just like chickens evolved from unicellular life
and have wings that cannot fly.



P.S. Thank god you can still write a CV processor in PHP in less than three
years :)


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--

Re: PHP 5 DOM and exposing properties

am 10.04.2008 23:21:26 von Jerry Stuckle

Michaelp 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.
>
> Looking at the PHPs DOM implementation, I see that many of the
> properties are exposed directly, without even offering get methods.
>
> 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?
>
> Thanks
>
> Michael
>
>

Michael,

I tell them the same thing I tell my students about the Microsoft
Foundation Class library - it's not necessarily a great example of OO
techniques, but it's what you've got.



--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================