I'm in a ranting mode today :) My defintion of encapsulation is quite
different from what 99% of OOP books write, and I actually get to argue alot
with people about this, and probably being labeled as mfalsaf. Most people
refer to encapsulation as info. hiding and it drives me crazy, they are
totally two separate things, and luckily through wikipedia I managed to find
an article that explains what I think encapsulation is (
http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html)

Encapsulation is the fundemental difference between OOP & Procedural to me.
If I were to write two lines of code to show the difference that explains it
all it would be

OOP: window.open()
Proc: open( window )

in procedural data & functions are two different animals. OOP bundles
(encapsulates) data members & methods. Hence they are put in a class
"capsule" together.

- Ammar

On 1/31/07, Ammar Ibrahim <[EMAIL PROTECTED]> wrote:
>
>
>
> On 1/30/07, Ala'a Ibrahim <[EMAIL PROTECTED]> wrote:
> >
> > well, I'm with Ammar on the dependancy problem, but not on the "I see no
> > point in making configuration an object", well i've been there, at some
> > point, you might ned our configuation from an exterrnal sorce, so putting it
> > in anobject is a goodpractise that would encapsulates whee is it comming
> > from.
>
>
> I agree, I do use configuration objects sometimes, or rather something a
> little bit more abstracted/scoped (factories for configuration that returns
> an instance based on the container). But I was commenting on the example
> that Faisal sent, it's too simple to need an object, and the object is being
> used exactly like an assoc. array. There's no scoping bonus here, if the
> object identifier $CFG was already used, you already got an issue, exactly
> like an array. There's no point in using an Object if an Array EXACTLY does
> the same thing.
>
> Abstracting the origin of data (if needed) is very useful, but an array
> can abstract data a well, I see no difference between the following
> $CFG = array ('db' => 'test1', 'dada' => 'test2' .... );
> and the example.
>
> But as Faisal said this is just a snippet, so my comment can be ignored :)
>
> - Ammar
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Jordan PHP Users Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/JoPHP
http://Jolug.org/
-~----------~----~----~----~------~----~------~--~---

Reply via email to