News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Ralph Schindler's Blog:
PHP Component and Library API Design Overview
January 19, 2011 @ 09:19:29

Ralph Schindler has written up a new post for his blog today looking at APIs and some things to consider when building them. These aren't the web service APIs you're thinking of - this is the interfaces your code uses to talk to it's own parts.

It's important to have a common understanding of the actual problem area. When we talk about names, we are really talking about the API. An API is a particular set of rules and specifications that a developer can follow to access and make use of the services and resources provided by another particular software program, component or library. Put another way, it is an interface between various software pieces and facilitates their interaction, similar to the way the user interface facilitates interaction between humans and computers.

He talks about the two different APIs you're usually building at the same time - a consumption API that is the method others use to consume it and the extension API, how the feature allows others to improve upon it. He shares his own API philosophy and a three tips he's learned along the way to make his APIs more robust:

  • Adopt A Common Namespace & Class Naming Scheme
  • Avoid Doing Too Much In the Constructor
  • Avoid final And private
0 comments voice your opinion now!
component library api design opinion consume extend


blog comments powered by Disqus

Similar Posts

Pádraic Brady: PHP Security: Taking PHP Security Seriously By Taking It Seriously

The Codist Blog: Followup To: I Will Never Understand the Appeal Of PHP

Marcelo Gornstein's Blog: Sniffing in PHP using libpcap: Thank you SWIG!

SitePoint Site Marketing Blog: Track Your Rank Using the Google API

PHPMaster.com: Database Interaction Made Easy with NotORM


Community Events





Don't see your event here?
Let us know!


introduction install community language refactor laravel series opinion code podcast configure threedevsandamaybe list framework testing release interview unittest wordpress developer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework