954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

A programmer should learn existing class or should create some ?

Hello,

Am not new to PHP but new to OOP, I have watched lot of tutorials for oop and as I saw, class is almost a new language!!
To be a pro programmer, I should learn existing class attributes or I should create my own??

example of default class attribute:
$dbh = new PDO("mysql:host=localhost;dbname=test","root","");
$sth = $dbh -> query("select * from page");
$result = $sth -> fetch();

example of my own classic class:
class db{
function connect(){
mysql_pconnect('localhost','root','');
}

function etc...

}

amirbwb
Light Poster
25 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

I just started in the scary world of OOP myself. I would imagine that a programmer, is exactly that, somebody who programmes. Any idiot can be a script bunny, using other people's scripts. However, if a class exists, works and suits your needs, why reinvent the wheel? Tweak it. My 2p.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,796 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

It is good to use existing class attributes to help you learn but only if you take the time to understand them and what they are doing so that in future you can create your own.

simplypixie
Posting Pro in Training
447 posts since Oct 2010
Reputation Points: 116
Solved Threads: 82
 

mm yeah i am actually finding some problem understanding, I think because of the course narrator, He's not a good teacher!!
Anw I will try to create my own class =) Thanks

amirbwb
Light Poster
25 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: