Re: [PHP] Beginner Tutorials for using CLASSES in PHP4



On Sat, 2007-10-06 at 15:42 +0100, Tony Marston wrote:

OOP revolves around the concept of grouping code and data together in
logical units called classes. This process is usually referred to as
encapsulation,

Correct.

or information hiding,

INCORRECT

since its goal is that of dividing an
application into separate entities whose internal components can
change without altering their external interfaces.

No. The idea behind encapsulation is that the implementation, the code
behind a method, can change at any time without the outside world being
aware of it. Data is *NOT* the implemetation.

Tony is right here. Encapsulation is about hiding the details of the
implementation and this *can* include information hiding in cases where
the purpose of the member variables is likely to change. However,
encapsulation does not necessarily imply information hiding. That said
information hiding is often achieved using private members and
encapsulation. There is a strong relationship between the two, but they
are not the same thing.

Also, don't forget that abstraction, encapsulation, and information
hiding all have a price.

Cheers,
Rob.
--
............................................................
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
............................................................
.


Quantcast