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...
I LOVE OOP
Moderator: General Moderators
- blacksnday
- Forum Contributor
- Posts: 252
- Joined: Sat Jul 30, 2005 6:11 am
- Location: bfe Ohio :(
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
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
Thanks all for the great help!
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
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
Thanks all for the great help!
Re: I LOVE OOP
You'll love them even more once you get into unit testing - if you haven't already.dallasx wrote:Now I love classes.
Re: I LOVE OOP
unit testing??McGruff wrote:You'll love them even more once you get into unit testing - if you haven't already.dallasx wrote:Now I love classes.
Actually in OOP i wouldn't care about the properties/data of a class.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.
I would care about the interface (public methods/behaviour) , fe: public Fill($amount) or public Empty($amount).