The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 21, 2019, 06:15:19 AM

Login with username, password and session length


Pages: [1] 2
  Print  
Author Topic: OO PHP...I think I "get it"  (Read 5710 times)
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« on: December 31, 2007, 11:40:51 AM »

Persistence...the light comes on. Something clicked. I was rewriting some code to show to our good pal CDC and all of a sudden I had a "duh" moment. It was a function I posted to syndk8 to ping multiple blog search engines, and I decided I'd make it a class. Took me a little bit of time to rehash the whole thing and I uploaded it. Much to my surprise it worked flawlessly with no debugging required - that never happens. Then I totally got it. The way I'd structured the code and the way I could manipulate this new object. Too beautiful for words.

I think I'm getting it Perk.

Sorry for my rambling.
Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: December 31, 2007, 01:04:17 PM »

Post whatever you want here and let's have a discussion on it.

In '91 I was working with a guy named Ed Snible who took the time to work me through my OO A-Ha moment and it was just a beautiful thing. The whole point of this forum is to repay that gift - and if it's an OO A-Ha more the better.

I'm really pleased for you VS, and for more reasons than just this board Wink
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #2 on: December 31, 2007, 01:30:57 PM »

I remember my O-O aHA ... felt like winning at MISSILE COMMAND. Wink
« Last Edit: December 31, 2007, 01:33:12 PM by jammaster82 » Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: December 31, 2007, 01:37:42 PM »

 ROFLMAO ROFLMAO

I still use that one you know... did it again for my daughter's high school - they asked me in as a guest speaker for the AP programming class and that's the example I used. Twas great. Betcha I still have that code somewhere... now that I think about it, I believe I ported it to Kylix as well.

I'll look it up and see if I can find it for you Wink
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #4 on: December 31, 2007, 01:43:53 PM »

Its funny. My ah ha was a little backwards and as a smart ass response to a professor in college. We had to create a game using classes and after much arguing with the professor about how a class does not in itself make a program OO, I did the whole thing in 1 giant ass class. My progam's main was litteraly
Game = new gameclass

That was it.

The prof was pissed but gave me an A anyway.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #5 on: December 31, 2007, 01:46:29 PM »

For reasons I cannot yet mention, I can't post the code here. I expect to be able to in a couple days though. You guys are super.
Logged

hai
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #6 on: December 31, 2007, 01:47:58 PM »

P.S. I feel bad that I can't post it because I'm inordinately proud of it, but I don't feel as though it would be prudent until certain events transpire.

Suffice it to say I would not want anyone finding it on a public forum and assuming that my real life identity stole the code from my virtual persona.

MISSILE COMMAND!

ha! Don't know if you remember Perk but you told me about that one a couple weeks ago on the phone.

Anyway at risk of sounding dumb, the thing that finally clicked for me was the power of persistence. If I have a function, I can call it with some arguments. Whoop dee doo. When I have a class full of functions relating to that class with properties, I can handle it, manipulate it and use it through the entire "lifespan" of my application. I know, something that should be glaringly obvious, right? I just didn't get it until the other day and when I realized what I was doing I thought it was crazy cool.
« Last Edit: December 31, 2007, 01:51:45 PM by vsloathe » Logged

hai
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #7 on: December 31, 2007, 01:51:02 PM »

Actually NBs that's funny for me as well - JM is referencing the fact that I used the old arcade game "Missile Command" as my demonstration for how OO can look. At the highest level, it was literally a game class and you said $game->execute() and that was about it. All the game pieces were classes sitting on a stack that a timer rolled through - the game itself didn't even know what it was doing - it simply took a game object off the stack and said something like $obj->execute() - each game piece had it's own behavior defined but the class hierarichy.

The crowning moment in that demo was when we realize that the game mechanism coulda been Missile command, Asteroids or Space Invaders and nothing about it would change except for the articulation code of the game pieces.

Of course, since I was using those games as examples of OO coding I've just really dated myself as well  ROFLMAO
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #8 on: December 31, 2007, 01:51:50 PM »

P.S. I feel bad that I can't post it because I'm inordinately proud of it, but I don't feel as though it would be prudent until certain events transpire.

Suffice it to say I would not want anyone finding it on a public forum and assuming that my real life identity stole the code from my virtual persona.

You know the vulnerabilities here VS, don't play with fire. We can be proud in absence of the code Wink
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #9 on: December 31, 2007, 01:57:10 PM »

mine was sperm-wars... LOL
basically a cross between missile command and space invaders, but in a circle defending the egg. Mind you I got an A, but, I ended up in the dean's office to discuss the propriety of of my project choices...
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #10 on: December 31, 2007, 02:07:55 PM »

hahah had your guidance counselor only known
you would one day be nutballs... chickens/eggs?

well how about perkiset posts the kylix port of missiles.pas and we can look at that
then at least somebody gets some code.... hahaha

when you immigrate, id love to see it and maybe
a vnc walk through where i am stuck on kylix
install, maybe i have scratched cd or something
and i need a backup. Wink

Tparser is so much cooler than regular expressions.
« Last Edit: December 31, 2007, 02:12:13 PM by jammaster82 » Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #11 on: December 31, 2007, 02:11:28 PM »

I'll be home in a few days and go see if I can dig it up. the more I think about it the more sure I am about where it is
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #12 on: December 31, 2007, 08:17:37 PM »

posted from an iPhone. Perk, I am zoo fuckin wasted LOL. Definitely getting an iphone for the wifey.
Logged

hai
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« Reply #13 on: December 31, 2007, 08:27:09 PM »

JOIN  THE MAC TEAM....

    ....TOGETHER YOU CAN RULE THE GALAXY!!!!!......

 iPHONEz rule they even slip in under my mac
address filter on my router .... cant find it but
neighbor is standing in front of me downloading
off my shit.....

« Last Edit: December 31, 2007, 08:30:34 PM by jammaster82 » Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
DangerMouse
Expert
****
Offline Offline

Posts: 244



View Profile
« Reply #14 on: January 01, 2008, 06:39:56 AM »

Even though I've been coding no where near as long as you guys, and I'm still more in the experimental stage I can really empathise with that feeling VS! It's amazing when you build something that 'models' what your trying to achieve elegantly - when everything just slots into place and then even better, you realise that what you have is a generic solution to a problem that can be applied in all sorts of situations. 

Good stuff Smiley

DM
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!