Scary Code

by jmorris 12. August 2010 13: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 ;)

Tags:

Comments (2) -

Charles Strahan
Charles Strahan United States
9/10/2010 12:43:48 PM #

That's pretty craptacular.  It's code like this that makes me wonder what the difference is between a "Senior Level Developer" and a complete novice...

... and then I realize something.  Hiring managers almost never test a developer's proficiency at developing software; they simply go down a check-list of arbitrary "qualifications" - years of experience, buzz-words, etc.  Even if they *did* test developers' skill level, a lot of crappy programmers would get through any way.  Why?  Because so many crappy 10-year-veterans have lowered their expectation of what's possible from an excellent, passionate programmer (faster development, fewer bugs, higher quality product, etc).

Alright, I'll get off my soapbox Smile.  I'd love to know what third party vendor that is so I can avoid purchasing their products, or, heaven forbid, find myself working for them someday.

jmorris
jmorris United States
9/10/2010 1:41:29 PM #

True, the company I work for is hiring so I have been doing a lot of interviews and you would be amazed at the lack of understanding of even the basics. Pretty much all of t he resumes look good on paper, but the applicant's rarely pass the written test.

Yeah, I'd love to reveal the source but the company I work for has a working relationship with them and I my point was (although not stated) never assume a 3rd party vendor is the expert.

Jeff Morris

Tag cloud

Month List

Page List