My First step to create a class, how 2 start and from where

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
vsaggu
Forum Newbie
Posts: 14
Joined: Mon Jun 17, 2002 5:12 am
Location: NZ
Contact:

My First step to create a class, how 2 start and from where

Post by vsaggu »

Helo every1 in dev network,

i want to konw how i should start to work on classes from the basic. imean from where exactly to start ...

i hope u al in this network wil not disappoint me.

i need ur support plz

thnx
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have a look in the OOP and classes discussion from the Theory and Design forum (above)
User avatar
vsaggu
Forum Newbie
Posts: 14
Joined: Mon Jun 17, 2002 5:12 am
Location: NZ
Contact:

Post by vsaggu »

no, i hvent. u know what. i hve understood the basic of classes and oops. but the thing is how to implement in real code. like first i want to start wth normal functions and then mysql connections
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

vsaggu wrote:no, i hvent. <span style='color:blue' title='ignorance is bliss'>you</span> know what. i hve understood the basic of classes and oops. but the thing is how to implement in real code. like first i want to start wth normal functions and then mysql connections
If you had read up and understood the basics of classes and OOP, you would know about functions. I suggest buying a copy of Harry Fueck's PHP Anthology which will give you all the background you need to get going.
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

Have you learned how to speak proper English first? That's pretty much a prerequisite to programming.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

no need to get personal, theda.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

i would first create a class to handle a mysql connection, its quite easy and should give you a good idea how to use classes. then you can add on handling querys and whatnor
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I would start using ADOdb..

And then write a class that is able to generate SQL.. (For example, an SQL query has a couple of clauses.. Having can only be used when GroupBy exists.. Might be a nice exercise to train relationships/dependencies etc ;))
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I've never tried to use a class, or even understood why I would need to. I guess I should get on the ball, eh.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

scrotaye wrote:I've never tried to use a class, or even understood why I would need to. I guess I should get on the ball, eh.
You'll get there.

My book recommendation is "Introduction to Object Oriented Programming" by Timothy Budd.

As for need, Object Oriented Design or Responsibility Driven Design helps one visualize a complex system into component parts each having it's own area of responsibility or function if you prefer. When a complex system is envisioned and created in this manner, it's easier to design, maintain, and extend. Furthermore, the components lend themselves to use in other systems as they (ideally) should be as stand alone as possible.

Hope that helps. :wink:

Cheers,
BDKR
User avatar
vsaggu
Forum Newbie
Posts: 14
Joined: Mon Jun 17, 2002 5:12 am
Location: NZ
Contact:

hey

Post by vsaggu »

whats the matter with u theda, and thnx patrikG. i wil try to find this book first.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I learned by doing, and I learned to do, by reading. Here is a great book...

PHP5 and MySQL Bible... which can be found on Amazon...

http://www.amazon.com/exec/obidos/tg/de ... s&n=507846
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

I have a few good links on my website you might find interesting.

http://www.jonhibbard.com/link/view.php ... n=phplinks


The OOP links are located near the bottom...
theda
Forum Contributor
Posts: 332
Joined: Sat Feb 19, 2005 8:35 am
Location: USA

Post by theda »

I can't stand horrendous grammar and 'net speak.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post by BDKR »

One armed space goat wrote: I learned by doing, and I learned to do, by reading. Here is a great book...
I think the PHP engine calls that a circular reference. :D
Err... or at the very least, you're saying you learned to do by reading.
Post Reply