A lot of ink has been spilled talking about the perils and pitfalls of offshore development. Businesses love paying the wage arbitrage game, and shipping software development tasks to an outside vendor and paying half the wage they would for a dedicated employee.

Of course, the key difference is the word “dedicated”. You could have the most highly skilled offshore developer imaginable, but at the end of the day: they don’t care. They don’t care about you, or your business. They don’t care if their code is good or easy to maintain. They’re planning to copy-and-paste their way up the ranks of their business organization, and that means they want to get rotated off your contract onto whatever the next “plum” assignment is.

Jules H worked for a company which went so far as to mandate that every project needed to leverage at least one offshore resource. In practice, this meant any project of scale would shuffle through half a dozen offshore developers during its lifetime. The regular employees ended up doing more work on the project than they would have if it had been developed in-house, because each specification had to be written out in utterly exhaustive detail, down to explaining what a checkbox was, because if you simply told them to add “a checkbox”, you’d get a dropdown or a text area instead.

Jules got called in when someone noticed that the “save” functionality on one page had completely broken. Since the last change to that application had been a year ago, the feature hadn’t been working for a year.

The page used a client-side MVC framework that also tied into a .NET MVC view, and due to the way the page had been implemented, all the client widgets treated everything as stringly typed (e.g., "true", not true), but all the server-side code expected JSON data with real types.

The code which handled this conversion was attempting to access a field which didn’t exist, and that was the cause of the broken save functionality. That was easy for Jules to fix, but it also meant he had to take a look at the various techniques they used to handle this stringly-typed conversion.

var parseBoolean = function(string) {
  var bool;
  bool = (function() {
      switch (false) {
          case string.toLowerCase() !== 'true':
              return true;
          case string.toLowerCase() !== 'false':
              return false;
      return bool;

When I first glanced at this code, I thought the biggest WTF was the switch. We switch on the value false, which forces all of our cases to do !==, only to return the opposite value.

But that’s when I noticed the return. The entire switch is, for some inexplicable reason, wrapped in an immediately invoked function expression- an anonymous function called instantly.

Jules made the bare minimum number of changes to get the save function working, but showed this to his management. This particular entry was the final straw, and after a protracted fight with upper management, Jules’s team didn’t have to use the offshore developers anymore.

Of course, that didn’t mean the contract was cancelled. Other teams were now expected to fully leverage that excess capacity.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!