PHP 5 DOM and exposing properties

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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?



Re: PHP 5 DOM and exposing properties

*** Michaelp escribió/wrote (Wed, 9 Apr 2008 23:29:38 -0700 (PDT)):
Quoted text here. Click to load it

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 :)

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor en cubitos:

Re: PHP 5 DOM and exposing properties

Michaelp wrote:
Quoted text here. Click to load it


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.

Site Timeline