How NOT to write function comments – Facebook!

Honestly, the new Facebook PHP SDK for the graph API has the worst example of documentation I’ve seen in many years. For example:

/**

* Set the Cookie Support status.

*

* @param Boolean $cookieSupport the Cookie Support status

*/

public function setCookieSupport($cookieSupport)

So the developer has followed the right conventions for a mutator. By naming the function setCookieSupport we can infer that we are setting a property called cookieSupport. This is backed up by the parameter named $cookieSupport (which some boilerplaters might just name $value). Great, so far so good.

So we think to ourselves, “What exactly IS cookie support? Of course I know what a cookie is, but how is the Facebook SDK using a cookie to persist an applications connection with a user’s login session. And why is the application claiming that the session exists but has expired when I’ve logged out and cleared my browser’s cookies. So in fact is it using the browser cookie or perhaps a CURL cookie internally? Or some other custom magic cookie – now I’ve really worried myself… I know! I‘ll RTFM @ GitHub.”

But when we turn to the function description, expecting a insightful summary of functional usage, examples of how, when and why this function should be used and when it should not, ideally including any gotchas and bugs or the consistent difficulties that the hundreds of tired and now hairless forum-dwellers are reporting, imagine our crushing disappointment when we are faced with:

Set the Cookie Support status.

No shit. Additional information imparted by the astoundingly lazily created documentation that I couldn’t have guessed from the code: zero.

Thanks for wasting 3 more seconds of my life Facebook.

Leave a Comment