Page 2 of 2

Posted: Tue Nov 01, 2005 11:04 am
by dallasx
I should have referred to it as a class property earlier... sorry about that.

If you read this and are confused just ignore it.

My old German teacher once told me that the way you remember foreign languages (also applies to programming languages) is that you develop "donkey bridges" (whatever the hell that is). A "donkey bridge" would be a silly way that you remember something. For example, she told us that to remeber how to pronounce the common "EI" and "IE" in words by this dumb phrase: "If two vowels go a walkin', the second one does the talkin'." Meaning that the second vowel is the one that you pronounce.
EI sounds like I (eye)
IE sounds like E (gee)

So.. here is my "donkey bridge" with class properties and varaibles.
----------------------------
The way I think of class properties and local variables is this:

Class properties are the end of the line, the values you want.
Variables are used to funnel the values into the properties.


An illustration:
Filling a car's oil tank up. Upper case words will be the real life thing and the [brackets] will represents PHP.

You use a FUNNEL=[variable] to fill the OIL TANK=[class property]

That's a redneck way of saying it.

Let me know how that explaination was, anybody...

Posted: Tue Nov 01, 2005 1:33 pm
by blacksnday
Thanks to everyone for explaining it so nicely.
Just this thread alone is giving me a huge heads-up compared to where I was
yesterday with OOP.

The way I tend to learn... is to do it now, and figure it out later. lol
Which is what I have done so far.
My main submit page I have been able to transfer all to OOP... however
not as extensive as I would like to eventually, its still my
'Learning Building Blocks'

btw... just 2 months ago I knew nothing about php
but now have created custom BB tags, a custom AdWord system, a shoutbox,
and the rest of my news script.

I learned by spending hours reading tuts, then just coding and reflecting back on it
later once my mind was able to asorb it.
So Im sure that with examples of OOP here, and with my current submit page
transformation done already...
I'm getting it :D

Some friends of mine have argued that my code doesnt need OOP,
but the way it keeps growing, and the way I am getting sick of
making craploads of functions that do nearly identical stuff, and
how I am frying my brain with all my forms and seperate code for each...
I know i need OOP and need it fast :D

Thanks all for the great help!

Re: I LOVE OOP

Posted: Tue Nov 01, 2005 3:23 pm
by McGruff
dallasx wrote:Now I love classes.
You'll love them even more once you get into unit testing - if you haven't already.

Re: I LOVE OOP

Posted: Tue Nov 01, 2005 4:39 pm
by dallasx
McGruff wrote:
dallasx wrote:Now I love classes.
You'll love them even more once you get into unit testing - if you haven't already.
unit testing??

Posted: Tue Nov 01, 2005 6:08 pm
by feyd
read the threads in the unit testing board... ;)

Posted: Wed Nov 02, 2005 6:25 am
by timvw
dallasx wrote:
An illustration:
Filling a car's oil tank up. Upper case words will be the real life thing and the [brackets] will represents PHP.

You use a FUNNEL=[variable] to fill the OIL TANK=[class property]

That's a redneck way of saying it.
Actually in OOP i wouldn't care about the properties/data of a class.
I would care about the interface (public methods/behaviour) , fe: public Fill($amount) or public Empty($amount).