Go Back   SitePoint Forums > Forum Index > Program Your Site > PHP > PHP Application Design
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Aug 10, 2006, 16:34   #1
mPeror
SitePoint Wizard
 
mPeror's Avatar
 
Join Date: Mar 2005
Location: Saudi Arabia
Posts: 1,756
APIs

I've always been that kind of programmer who keeps re-inventing the wheel, and avoid using APIs (for my own reasons), but now that i decided to start using them (to save time), I have a few questions:

1) How do you decide whether you should use an API or code something on my own?

2) Do you study the code behind APIs or just use them right away? and why?

3) If you don't or don't have time to study the APIs code - how do you determine its performance and security?

4) If you wanted to make a script that needed something you have never worked with before (say "session management" for example), would you use an API for it or try to learn how it works by coding it yourself the first time?


Your input is appreciated.
mPeror is offline   Reply With Quote
Old Aug 10, 2006, 18:50   #2
Mittineague
Google search user
silver trophybronze trophy
 
Mittineague's Avatar
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 9,421
learning tools

It depends on how often I might use something and how hard it is to learn, (and how interested I am in learning it). If I can do something relatively easy using something I'm familiar with, I don't bother spending lots more time learning something that may have helped me do it a little faster.
I just installed a phpBB forum on my site. I spent a couple of weeks MOD'ing it, and I've looked at most of the 300+ files. I certainly wouldn't want to write a clone app of it from scratch! But luckily it's open source, so I could use the MODs that were available and do a few things on my own to tweak it a bit.
I wouldn't recommend using too many apps "off the shelf" without at least checking the support forums for security issues first. And I also think the source should be studied enough to get a feel for things.
But then again, I enjoy writing code and learning new things (and I prefer to write using notepad as the editor!). Heck, I even like running my Java from the MS-DOS command line.
Mittineague is offline   Reply With Quote
Old Aug 11, 2006, 02:06   #3
dg_den_golotyuk
PHP Brainiac
 
dg_den_golotyuk's Avatar
 
Join Date: Jul 2006
Location: Kiev, Ukraine
Posts: 335
It is a matter of finding a golden middle. If you are to crate the soft on your own just for practising - you do not need to lear and implement some difficult API. But when you are to code a complex structured project - the APIs are almost on every step of the way
dg_den_golotyuk is offline   Reply With Quote
Old Aug 11, 2006, 02:45   #4
Kailash Badu
SitePoint Mentor
bronze trophy
 
Kailash Badu's Avatar
 
Join Date: Nov 2005
Posts: 2,505
I try to examine at least how the pieces of the framework are working. But only when I have sufficient time. If deadlines are tight you have no option then to use APIs as they are. For example, examining code behind various Pear packages gave me the real feel of how inheritance can be applied to build robust frameworks. It did improve my OO skills. But then you always don’t have time to do that.
Kailash Badu is online now   Reply With Quote
Old Aug 11, 2006, 19:54   #5
Immerse
SitePoint Evangelist
 
Immerse's Avatar
 
Join Date: Mar 2006
Location: Netherlands
Posts: 476
It depends really. I once integrated a popular forum into my site using it's API but it slowed my pages down 10-fold. So I coded a mini-API myself, and cut the slow down from 1000% to 10%. For another application I integrated the API was so well built and performed so well that I used it without a worry.
Immerse is offline   Reply With Quote
Old Aug 11, 2006, 23:59   #6
mPeror
SitePoint Wizard
 
mPeror's Avatar
 
Join Date: Mar 2005
Location: Saudi Arabia
Posts: 1,756
Thanks guys, although i wanted generic answers to my questions.

Anyone else?
mPeror is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 21:49.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved