Is it best to use a pre created class / api for database interaction (e.g Pear MDB2 or php’s PDO) or create your own?
I will be only be using mysql with 1 database and perform relatively simple SELECT, INSERT, UPDATE, DELETE queries.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For small personal projects, I prefer to use my own DB interface class over a pre-built, but other people swear by pre-built APIs. By creating your own class, you are almost guaranteed to be reinventing the wheel. Using a pre-built API typically only requires that you learn how to issue your commands within that API. If you are working with a team of programmers, I recommend using a well documented API and incorporating its use into your best practices and procedures. In my experience I have felt that team programming and home-brewed DB classes don’t mix well.
One thing I will say, if you have never written a class like this, I recommend doing so as a learning opportunity just to get some behind the scenes comprehension. The experience I gleaned from writing my own class has definitely helped me more than a few times when debugging work done by other programmers who used an API that I was unfamiliar with.
[Edit – Fixed some really bad grammar]