by jmorris
12. August 2010 22:31
First off, I am the first to say that if you are a developer, sooner or later you will write a bug or krufty code; it goes with the business they say. At some point you'll either make an improper assumption, misuse a feature, or simply "have a holiday" or write an obvious or non-obvious bug I'll also offer straight up that I am not the best or most talented developer in the world. There are legions of developers that create amazing work that I will never in a million years, pretend to be able to produce.
That being said, I recently reviewed some code a third party vendor offered as an API and I am a bit shocked…The API is pretty simple; it's a single class for adding SEO metadata and attributes to videos embedded on a web page via Yahoo! SearchMonkey RDFa and Facebook Share so that the pages are more discoverable and relevant to search engines.
Let me share a few of issues with the code I discovered after I downloaded the API:
public class SEOFriendlyVideo{
static String partner_code;
static String secret_code;
static String embed_code;
static int cache_for_num_seconds;
static String title;
static String description;
static String metadata;
static String labels_html;
public SEOFriendlyVideo(String partnerCode, String secretCode, String embedCode) {
partner_code = partnerCode;
secret_code = secretCode;
embed_code = embedCode;
cache_for_num_seconds = 900;
fetch_data();
}
Setting static variables using a non-static public constructor? OMG! Whatever happened to thread safety? Note that this is meant to run on a web server, an inherently multi threaded environment!
From there things simply got worse; rest assured I did not use this ;)
9b289ec5-4d60-4d0e-94f6-0219f1e0ad55|0|.0
Tags: