Is null a valid JSON text ?

Recently I was working on an issue where a service would return null when called with some parameters and the consuming service would have an issue, because the response read from the HTTP response stream would be a string containing the 4 characters “null” and only had a check whether the string was null and if not was using a JSON converter to parse the JSON text which would result in an exception being thrown. The question we were discussing here is what should be the JSON representation of a null object.

What is JSON ?

JavaScript Object Notation (JSON) is a lightweight, language independent text format for the serialization and exchange of structured data. It is derived from the object literals defined in the ECMAScript Programming Language Standard and defines a small set of formatting rules for the portable representation of structured data.

JSON is described in a few standard documents:

JSON text vs. JSON value

A JSON text is a sequence of tokens representing structured data transmitted as a string. A JSON value is be an object, array, number, or string, or one of the three literal names: false, null or true.

In RFC 4627, a JSON text was defined as serialized object or array. An JSON object value having to start and end with curly brackets and a JSON array value having to start and end with square brackets. This effectively meant that “null” was not a valid JSON text.

But even in RFC 4627, null was a valid JSON value.

Changes in RFC 7159

RFC 7159 was published in March 2014 and updates RFC 4627. The goal of this update was to remove inconsistencies with other specifications of JSON and highlight practices that can lead to interoperability problems. One of the changes in RFC 7159 is that a JSON text is not defined as being an object or an array anymore but rather as being a serialized value.

This means that with RFC 7159, “null” (as well as “true” and “false”) becomes a valid JSON text. So the JSON text serialized value of a null object is indeed “null”. Unfortunately, not all JSON parsers / deserializers support parsing the string “null”.

Parsing null with JSON.NET

When using JSON.Net (Newtonsoft.Json), there are two ways to deserialize a JSON text:

  • JObject.parse: this returns a JObject which allows you to work with JSON results which structure might not be completely known.
  • JsonConvert.DeserializeObject: this is always to deserialize the JSON text to an instance of a defined class.

JObject.parse unfortunately throws an exception when trying to parse “null” (JObject.Parse(“null”)):

Newtonsoft.Json.JsonReaderException: ‘Error reading JObject from JsonReader. Current JsonReader item is not an object: Null. Path ”, line 1, position 4.’

But if you do not have a class corresponding to the JSON text you’re deserializing, you can either use “object” as type when calling JsonConvert.DeserializeObject or use the overload without generics:


In both cases, you will get an instance of JObject back (just like the return value of JObject.parse).


Export an App Service certificate to a pfx file with PowerShell

In order to debug a webjob running in an Azure App Service and accesses a service using a certificate, I needed to create a local copy of the certificate to be able to run the webjob on a local machine. The Azure portal unfortunately only provides these options:

  1. Import an existing App service certificate
  2. Upload a certificate
  3. Delete a certificate

So there is no option to download a certificate. But this can be used using PowerShell and the AzureRM module.

First, we’ll need to set a few variables with the data required to get the certificate:

$azureLoginEmailId = ""
$subscriptionName = "mysubscriptionname"
$resourceGroupName = "myresourcegroupname"
$certificateName = "nameofthecertificateiwanttodownload"
$pfxPassword = "mygreatpassword"

We’ll later use $pfxPassword to set a password in the created PFX file.

Then I need to login into Azure to be able to access the resources:


You will see a popup where you can enter your credentials.

Then you need to select the appropriate subscription:

Select-AzureRmSubscription -SubscriptionName $subscriptionName

Now, we’re ready to access the certificate resource which can be used to get the actual certificate from the key vault:

$certificateResource = Get-AzureRmResource -ResourceName $certificateName -ResourceGroupName $resourceGroupName -ResourceType "Microsoft.Web/certificates" -ApiVersion "2015-08-01"

The returned resource object has next to the location, name, ID, type and resource group name also a Properties member which contains details about the certificate:

  • subjectName
  • hostNames
  • issuer
  • issueDate
  • expirationDate
  • thumbprint
  • keyVaultId
  • keyVaultSecretName
  • keyVaultSecretStatus
  • webSpace

All the pieces of information we need to retrieve the certificate from key vault are encoded in the keyVaultId except the keyVaultSecretName (which is also in the list above):


So by splitting it to an array using / as a separator, you get resource group name for the key vault in the 5th element from the end and the key vault name in the last element.

So you can extract them like this:

$keyVaultId = $certificateResource.Properties.keyVaultId
$keyVaultData = $keyVaultId.Split("/")
$keyVaultDataLength = $keyVaultData.Length
$keyVaultName = $keyVaultData[$keyVaultDataLength - 1]
$keyVaultResourceGroupName = $keyVaultData[$keyVaultDataLength - 5]

You also get the secret name like this:

$keyVaultSecretName = $certificateResource.Properties.keyVaultSecretName

Now we can grant our user permissions to perform a “get” operation on the key vault:

Set-AzureRmKeyVaultAccessPolicy -ResourceGroupName $keyVaultResourceGroupName -VaultName $keyVaultName -UserPrincipalName $azureLoginEmailId -PermissionsToSecrets get

And you can fetch the secret containing the certificate:

$keyVaultSecret = Get-AzureKeyVaultSecret -VaultName $keyVaultName -Name $keyVaultSecretName

This secret contains a Base64 representation of the certificate which you can convert back to a certificate object using:

$pfxCertObject=New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @([Convert]::FromBase64String($keyVaultSecret.SecretValueText),"", [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)

Now, the only step left is to write the certificate to a local PFX file:

[io.file]::WriteAllBytes(".\appservicecertificate.pfx", $pfxCertObject.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Pkcs12, $pfxPassword))

And there you are !

If you have found this page, you probably have also seen a couple of MSDN blog entries about a similar topic:

That’s also where I started but since I had to adapt the code from these two blog entries, I decided to document it in this blog post. Hope this helps !


WP Advertize It 1.0

One of my first plugin was a plugin called WP Advertize It which allows you to define HTML/JavaScript code blocks and embed them in your site at different locations. The plugin itself is not limited to displaying ads but the reason why I created it was to embed ads in my site (so that it can pay for the maintenance costs by itself). I’ve been using this plugin in many of my sites over the years.

We’ve now released a new version of the plugin which among new functionality also comes with an AngularJS based settings page. This first makes the settings UI more responsive and also made it easier to build a more modern UI. Of course, one of the goals of UI AngularJS was to check how well it can integrate in a WordPress context but it also comes with some benefits.

If you’re interested in checking how this works, you can download the plugin in the WordPress plugin repository and check the code !


WordPress: 2D and 3D taxonomy cloud

Some time ago, I published a WordPress plugin called WP Category Tag Cloud.

With this plugin, you can display a configurable 2D or 3D cloud of taxonomy terms (like tags, categories or any custom taxonomy) and filter them by tags or categories.

My first use case was to display a list of tags and only show tags used in posts belonging to a give category. For example, if you have two areas in your web site (like a business web page and a blog), and you separate these two by using different categories but the tags can partly overlap, you can use this plugin to define a widget which will only show tags used in posts of the blog category.

And over time, there were a few other use cases which came from web sites I am hosting or from user requests. So this plugin provides many options to define how the cloud should be rendered and what should be contained in the cloud.

The cloud elements can be displayed in many different ways:

as a flat list separated by spaces: [showtagcloud taxonomy=category format=flat number=10 order_by=count order=DESC]

as a bulletted list: [showtagcloud taxonomy=category format=list number=10 order_by=count order=DESC]

as price tags: [showtagcloud taxonomy=category format=price number=10 order_by=count order=DESC]

as rectangular tags with rounded corners: [showtagcloud taxonomy=category format=rounded number=10 order_by=count order=DESC]

as horizontal bars: [showtagcloud taxonomy=category format=bars number=10 order_by=count order=DESC]

as a 3D HTML5 based tag cloud: [showtagcloud taxonomy=category format=array number=10 order_by=count order=DESC]

You can also see this one in action in the side bar of this blog.


Additionally, you can set many options to tweak the way the cloud is displayed:

randomly colorize terms: [showtagcloud taxonomy=category format=flat number=10 order_by=count order=DESC colorize=1]

make less used terms less opaque: [showtagcloud taxonomy=category format=flat number=10 order_by=count order=DESC opacity=1]

randomly tilt terms: [showtagcloud taxonomy=category format=flat number=10 order_by=count order=DESC tilt=1]

all of the above: [showtagcloud taxonomy=category format=flat number=10 order_by=count order=DESC tilt=1 opacity=1 colorize=1]


There are even more options available to make this widget look like the way you want it to. And new options are added in every new version.

In order to make sure the performance is good, you can have the widgets cached and define how long they should be cached. Of course, if you change any setting of a widget , it will be regenerated even if it was already in cache.

The widget can be displayed in the sidebar using a widget, in any post or page using a shortcode or anywhere else using the provided PHP function. For more details, please check the FAQ of the plugin.

There are still a few other features that I have on my list but I feel this plugin has already evolved over the past few weeks into one of the more flexible and powerful term cloud plugins for WordPress.

To give it a try, go to the plugin page on and download the plugin. The installation is as easy as searching for it in the plugin installation age in your WordPress installation (or uploading the folder wp-category-tag-could to the /wp-content/plugins/), activating the plugin through the ‘Plugins’ menu in WordPress and selecting the widget and configure it or using the PHP function or the short code.

If you try this plugin please do not forget to leave a review here. And if you find issues or have ideas how to improve the plugin, use the support feature on

About indian programmers

I recently read an article called Bad Indian Programmers. This article is written by an Indian programmer, so of course it’s not about how bad they would be but rather about why the perception is wrong. I’d tend to agree with some of the comments on this article that as a customer it doesn’t really matter why the supplier delivers good or bad quality but whether the quality you get is what has been agreed upon.

And I think this is the main issue. I’ve been contacted by multiple Indian software companies over the past few months telling that they have great web developers and asking whether I would be interesting in contracting them. Once you look at their web page, you first notice that it’s very often not complete and that their homepage is actually pretty bad. Does it mean that Indian programmers are just as bad as their reputation ? Well, not necessarily. I think you first have to understand that IT is still a booming industry in India (remember the late 90s in the US or in Europe). On the one hand this means that always more students study computer science and that the ratio of truly gifted individuals goes down. And as it is a booming industry, the number of companies and individuals who actually do not have a clue about what they are doing increases. It’s not a specific Indian phenomenon but it’s what also happens in countries with a real estate boom where many of the building companies actually do provide bad quality work.

When you consider this, you also have to know that although programming might be considered by some people as just typing code in an IDE, it is in fact something requiring highly qualified people. Thus, there is a huge difference between a good programmer and a poor programmer. It’s of course difficult to quantify this. My experience is that there is a ratio of about 20:1 between top and worst programmers. This is a phenomenon you can observe in any industry producing any kind of goods. You can buy a pair of shoes which will go in your trash can within a few months or buy one you will be able to wear for many years.

What you have to keep in mind is that you only get what you pay for. So if you get a dirt cheap guy to write code for you, you’ll just get dirt cheap looking code. You can get a new car for a few thousand dollars but you can’t expect to get a Ferrari, a Porsche or even a BMW. So of course to some extend the difference in cost of life in different countries can allow companies acting globally to get about the same quality for less money by outsourcing to a different country. But you have to understand that the job market has also gone global. So if you are a very gifted programmer and can get $80 or $100 an hour in a different country or stay where you are and get less than half, you’ll end up moving to a different country or staying where you are but charging more.

Whenever you buy something much cheaper, you have to ask yourself why it is so cheap. Many may think that they are very smart and just managed to find that one great offer. But very often is that what you save on the one side introduces some hidden costs or trade offs on the other side.

Another factor influencing the quality of the code produced by programmers is that all educational systems or IT ecosystems have different strengths. For example, Indian programmers tend to be good at math and logic. On the other side, American or European programmers are (still) better at Web programming than many Indian web programmers. It’s of course a general statement that doesn’t mean that you cannot find a very gifted web programmer in India. So you need to learn what the strength of your different suppliers are and where to outsource which part of your projects. If I had to design some complex piece of engineering, I’d probably go to a German company. If I wanted to go to mass production, I’d probably rather go to China rather than Germany.

This difference in countries and educational system is something I noticed when I was at the university myself. I studied in France but did my last semester in a German university. What I noticed was that the programming exercises I got at the German university were so easy for me that I could finish most of them in less than an hour and could see most people spending the whole night trying to figure it out while I was surfing the web. On the other hand, I never had any kind of exposure to the design or architecture of complex software systems while at a French university and it was kind of a major focus point at the German university.

So the question is not only whether people are good or bad but it’s the matter of knowing what people are good at and not hiring them to work on things they are not so good at. And never forget that something being expensive doesn’t mean it’s good but on the other side something being very cheap most probably means it’s not so good (although there are always exceptions confirming the rule).

So who’s responsible for this not so good reputation of Indian programmers in the US or in Europe ? Partly Indian companies hiring people who don’t really know to code well and selling them as software experts. Partly American or European managers mostly interested in lowering IT budgets and not caring enough about quality. Imagine you buy a pair of Adidas shoes (which in this case might be spelled Addidas) for $10 while on vacation in Turkey and you have to trash them after 2 months of wearing them. Who’s at fault ? The guy who sold them promising it’s great original quality ? Or the guy blind enough to think he could get great original quality for that price ?

So outsourcing to India to lower IT costs can make sense. But you need to understand that even in India it’s very difficult (if not impossible) to get great programmers for less than $20 an hour. So first focus on finding a great Indian programmer. He will definitely be cheaper than an equally qualified programmer in Europe or in the US but be prepared to pay a decent amount of money for decent quality.

Also note that it’s very easy to find absolutely bad programmers both in the US and in Europe which will still cost you quite some money…

Targeted Spam Comments

I haven’t deleted spam comments for a while so I had thousands of them. I usually always have a look at the first 5 of them before deleting them all. Who knows maybe some of them are false positives. Of course checking a 5 of 3000 gives you pretty but odds to actually find the few comments which are genuine comments falsely identified as spam. But you don’t have to think in a rationale way 24/7.

Today I did find some comments (in the first five comments displayed) which were interesting. This is the first one:

My programmer is trying to convince me to move to .net from PHP. I have always disliked the idea because of the costs. But he’s tryiong none the less. I’ve been using WordPress on a variety of websites for about a year and am concerned about switching to another platform. I have heard very good things about Is there a way I can import all my wordpress posts into it? Any help would be greatly appreciated!

It’s easy to identify it as Spam (at least for a human) because it was posted on a post not even remotely related to PHP, .NET or WordPress. I guess Akismet rightly identified it as Spam because it has seen this comment on multiple sites.

But I’m not sure whether this kind of Spam is specifically targeting blogs like mine because I often write posts about WordPress. Or is it just a coincidence and I’d get such a comment even if my blog was about wineries in Uzbekistan…

Just below this spam comment was another comment which is less targeted:

Hellо thеre! Τhis is kind of off toρic
but Ӏ neeԁ some adѵice frrom аn еstablisheԁ blog.
Is it verу ԁifficult tο sett up your own blog?

I’m not very techіncal but I сan figurе things οut
prеtty quіck. I’m thinking abοut making myy oωn bbut I’m nοt
surе ωhеrе tο start.
Do you have anу tips or suggеѕtiоns?

And a bunch of links. This one is also obviously spam (see the ω ?). What’s interesting about it is that lately most of the spam comments I get are like this. A few weeks ago, it was full of things related to buying handbags, penis enlargement, insurance and such things. I still do get lots of those but they do not make 99% of the spam comments anymore.

The conclusion: Spammers have learnt from the online ad industry and have learned to adapt the spam comments to the general context of the page.

Over-optimization and time or money savings

You all know the situation (well I do hope for you you don’t): You need to buy something for X dollars and you need to fill out a few forms have it approved by a few people, then have the purchase department do the purchasing and you get what you ordered at your desk within a few weeks or months. Some times things grow out of proportion and you need a very long time to order something worth $40 and end up having to wait forever and the whole overhead costs you well above $40. If you also count the costs linked to having to wait for the item to be ordered and stalling other activities, it could become much more expensive.

Ordering a $40 license for some library actually was my first contact with the procurement at a big company. For someone just coming from the university it was very difficult to understand ordering such a small software could generate such efforts and costs.

Similarly, some colleague of mine experienced how long it can take to order a plane ticket and how much effort can be spent to get a cheap flight at all costs. The summary is that to book an intercontinental flight which would otherwise require one stop, it took 3 weeks to book the flight, the flight was booked less than 24 hours before departure, the journey involved 3 flights, an airport change and a 2 car drives instead of two flights. This saved about one third of the price on the ticket price but caused the journey to last much longer and involved people working on the ticket for weeks.

Examples in the business world tend to be more extremes that what would happen to a private person. As a private person, the problem is mostly to figure out whether it’s worth driving to a shop miles away to buy vegetables which are 5 cents per kilo cheaper. Or not driving to the closest gas station but checking the price in the whole city and driving over there.

The big question is how much does optimization cost and how much does it save us. It’s actually a pretty simple logic. If optimizing costs more than it saves you, there is no real point. But it’s not always that easy. Consider this:

  • You find a point which can be optimized and could save you money. Half way through the optimization, you see that it will not save you as much as expected and you shouldn’t actually not have started the optimization. Now the question is whether you go through with it, rollback, just stop it. It means you need to assess what are the benefits and costs of finishing the optimization in comparison to rolling it back or just stopping where you are.
  • If you have a yearly target related to the yearly budget, it is better from a target achievement point of view to have people who are already budgeted for spend days trying to save a few dollars on items which are coming on top of the fix budget. Of course from a global point of view it makes no sense but it does help you achieve this budget goal.

One thing to be kept in mind is that there are basically two ways to improve your financial situation:

  1. Reduce costs by saving
  2. Increase income by investing

The first one is limited as soon as you reach a certain level of ROI. The second one has more potential but is more risky as there is no guarantee that the ROI will be there at all.

The same issue occurs when you plan to implement time saving actions. You need to find out whether the initial costs will be recovered in the long term. If you manage to reduce the time needed to perform a recurring activity by 50% and have to spend 300% of that time to optimize it, then it only makes sense if you perform the activity at least 6 times. This is a common question when it comes to writing automated tests. This becomes even more complex when the one time activity requires multiple runs. This happens e.g. when you right automated UI tests and you need to adapt the tests when the UI changes. It all boils down to the savings you achieve by automating, how often the automated tests have to run and how often and at which costs you have to adapt the tests.

Here’s a nice overview from xkcd:

One year

Last month, it was the first anniversary of the domain. Over the past year, there were many times where I had so much to do that I couldn’t write much but I guess I’ve managed to always get back to blogging before it was too late and it cost me too much effort to write again.

Judging by the amount of Spam I’m getting, the blog has become quite successful (just ignore the figures for may 2013 as I took the screenshot some time ago. I assume it will be around 20000 spam comments at the end of the month):

Spam history

Actually I really thought in November that Akismet stopped working since I was getting some unfiltered Spam comments. But I then realized, it was just because the number of Spam comments exceeded 5000 a month. So 12 missed spam comments is only like 0.25%… Fortunately, it wasn’t only the amount of Spam comment which increased but also the number of visitors. Now about 8000 unique visitors a month:

visitors one year

Of course you can see that the number of visitors is not really growing anymore but I guess it’s already not bad for a technical blog where I only write once in a while.

Comparing the first 6 months of the blog with the past 6 months shows a few interesting facts:

  • The number of visitors increased by over 200% (i.e. multiplied by more than 3).
  • US visitors still account for over 20% of visitors and are thus by a large margin the #1 country in the statistics.
  • Although they have absolutely increased, the number of visitors from the US and Germany have relatively to the total number of visitors decreased by resp. 12% and 21%.
  • India has taken over Germany as #2.
  • The highest relative increase in the top 10 countries was China moving from 1.75% to 2.5%. So still a small absolute number of visitors compared to the US, India or Germany, but with a high growth.
  • The #1 browser is still Google Chrome (and it’s share has actually slightly increased to 41%). Firefox is still #2, very stable at 30%. Safari lost ground from 17% to 14%. IE gained 2% (currently at 11.7%). Of all 5 browsers with over 1% share, Opera had the better relative improvement moving from 1.32% to 1.75%.
  • On the operating system front, there are only 3 of them with more than 1% share (Windows, Mac OS X, Linux). iOS went down from 2.9% to 0.63% (I’ll have to check whether it’s related to how my blog looks like on mobile devices, since Android also decreased from 1% to almost 0%). Windows is still #1 and actually growing from 48% to 53.5%. Mac OS X is quite high on my site because I own a MacBook Pro and tend to write more about Mac OS X than Windows.
  • Regarding the screen resolution: 1920×1080 replaced 1440×900 as #1. 1366×768 had the highest relative increase from 9.43% to 12.55% (from #5 to #3).
  • 90% of the traffic is now search traffic (from 75% in the previous 6 months). Referral traffic went from 14.3% to 3.1%. I guess it’s mostly because the position of my blog articles in Google’s search results is much better. Search traffic still come almost only from Google, which is still above 99%.

Now the second year of has started. It’s not anymore about building up the site but about keeping it at the level where it is. Let’s see how the summary of this second year will look like in a year from now…

On technical debt

A colleague of mine is currently working quite a lot with Sonar and has a nice plugin computing the technical in a project or parts of it.

Technical Debt is a nice metaphor coined by Ward Cunningham back in 1992. It’s now used by the whole software industry to describe the consequences of quick and dirty solutions leading poor software architecture and bad coding. The technical debt in a project introduces risk and basically means that in the mid to long term the health of your project will be negatively impacted because of unplanned work.

The great thing about technical debt is that you can quantify these parts of the software poorly designed and implemented in terms of money. It’s basically just like a financial debt. With financial debt, you spend money you haven’t earned yet (because it’s easier and faster) and this debt will cost you money again and again until you’ve got rid of the debt. With financial debt, it is similar. You take a shortcut, implement a quick and dirty solution (because it’s easier and faster) and end up paying for it every time you have to change the code to implement a new feature or fix a bug until you fixed the bad design/code and get rid of the debt.

And the quantity you get here is not only a list of violations (or a number of violations) but something you can express (just like a financial debt) in terms of cost of reimbursement. Now we come to the important part. Your management probably doesn’t understand a work, when you talk about code smells, code duplication, complexity… But when you speak in Dollars or Euros, they do get what it means.

So we’ve found the right tool to talk to management and convince them to fix things which are neither errors in the software nor new features, right ? Well, it’s not so easy. Just like with financial debt, it first sometimes makes sense to borrow money to get something out to the market before others. So it cannot really always be used to prevent violations and quick and dirty solutions. Second, as long as you are in growing phase (or at least as long as you haven’t noticed you’re not in it anymore), it’s mostly better to keep paying the interests and actually increase the debt to keep the grow pace high. The same thing happens with technical debt. Of course, from a cost perspective it’s cheaper to prevent technical debt or at least work on reducing it over time. But as long as your return on investment is high, you can get away with not doing it and focus on adding more features and conquering market shares.

The problem with the technical debt is also similar to the problem with the debt of industry nations. Of course, it’d be better to have no debt and if you keep increasing your debt instead of reducing it, you’ll get to the point that your debt is so high that you’ll not be able to repay it and will have to pay interests forever. And as with nation debts, politics does play a big role with technical debt. Especially the fact that in management as in politics, leaders are rarely sitting in the same seat forever. Politician doesn’t care about the debt in total because he’ll be long gone when the time comes where you cannot increase it anymore and need to pay back (if it ever happens).

Also, if you are the one spending money to reduce the debt instead of spending the money to support growth, you’ll end up with a negative record as noone will honor you debt-reducing activities but everybody will complain that you didn’t support grow as you should have. The same happens with technical debt. If you are a manager responsible for a product with a non-negligible technical debt, will you rather tackle the debt issue and spend a whole year fixing the dirty design and code or will you rather ignore the problem pay the interest and be the one who gain market share by having X great features implemented ?

So, is the message just to ignore technical debt and keep doing it quick and dirty to reach the goal faster even if the technical debt increases ? Well, there’s maybe a way between Mother Theresa and the filthy capitalist. Just like with financial debt, with technical debt, you pay different interest rates depending on what caused the debt (or in the financial case, where/when you borrowed the money). So one solution is to reduce the debt on which you pay a high interest rate i.e. fix the violations which will cause high maintenance costs and first live with the many violations (which in total represent a huge amount of money) which are less costly in the long term.

Also as long as the dept is combined with a high growth, it’s less of a problem (do you ever year about the public debt of nations with 2 digit growth figures ?). If you closely monitor your growth, you might notice a loss of speed and if your technical debt is high, you can bet that it’s partly due to it. At this point in time (when the debt starts to have a negative impact on growth), you’ll have to start dealing with it. Of course, you’re in a better position if you’ve been appointment to a position because growth is suffering. Then you can more easily implement long needed measures than if you were the guy delivering XX% yearly growth and now need to handle debt because growth is slowing down.

Another thing you have to keep in mind is that even though there are a lot of similar aspects, technical debt and financial debt are not exactly the same.
First, there are cases in technical debt, where you do not have to pay interests. It happens if your piece of code contains no error and never needs to be updated. Of course, in many cases, there will be errors even if it might well happen that new features never require change. So it’s a thing you need to evaluate when considering which technical debt has to be dealt with.
Second, if you are not sure you want to keep the software, you might end up getting rid of it and with it goes the technical debt (without having to repay it). Maybe you can compare it with a state bankruptcy…
Last, one big difference is that it’s easy to measure financial debt. But it’s not so easy to measure technical debt. You know the number of violations. But you do not know the actual cost to fix them. You just have to use some kind of half way reasonable averages.

So handling technical debt requires a lot of weighing and thinking but it’s at least good for some people: consultants and vendors. It is easier to scare businesses into buying consulting time or tools using technical debt than with purely technical issues.

When the Law of Demeter is applied to organizations

The Law of Demeter is a design guideline which can be summarized as the principle of assuming “least structural knowledge”. Wikipedia defines it with respect to object-oriented software as:

The Law of Demeter for functions requires that a method m of an object O may only invoke the methods of the following kinds of objects:

  1. O itself
  2. m’s parameters
  3. Any objects created/instantiated within m
  4. O’s direct component objects
  5. A global variable, accessible by O, in the scope of m

In particular, an object should avoid invoking methods of a member object returned by another method.

In a more general sense, it can be summarized this way:

  • Only talk to your immediate friends.
  • Do not assume anything about the internal structure of others.
  • Each unit should have only limited knowledge about other units.

The main goal of the law is to reduce errors due to wrong assumption regarding objects you do not really know about. You stick to stick to what you can control or things which are close to you.

Even in software, strictly sticking to the law of Demeter can sometimes lead to writing many small wrapper methods that do very little but delegate. It does improve encapsulation and decreases coupling but does result in wider interfaces.

When you transfer the law of Demeter to organizations, replacing objects by individuals or teams, you get something like this:

  • Focus on your tasks, the components you are responsible for.
  • When it comes to knowledge, focus on depth rather than width.
  • Use the information you’ve been given by the one triggering you but not more.
  • If someone tells you about an issue reported by someone else, keep talking to the middle man.

I guess it will sound similar for many readers.

The advantages of such an organization are:

  • You feel safe as you only work on things you know and can control.
  • If you get technical experts, you do not need to spend a lot of money on domain training.
  • If you have domain experts, you do not need to spend a lot of money on technical training.
  • Peace of mind: you leave them alone and they leave you alone.
  • You can have a fully distributed team, since dropping specifications over the fence is pretty much all you have to do.
  • As soon as you get instructions, you can directly start working without checking whether everything has been properly specified.
  • If something goes wrong, you can always blame it on the previous guy in the chain.
  • When a customer has a problem, he/she contacts the first level service team, which contacts the second level service team, …, which contacts the development team. So a developer who has no time to solve the problem just needs to request more information and will only be contacted again a few days.

Quite a long list of advantages… And what’s great is that you only have a few minor disadvantages:

  • Since the one at the end of the chain, knows nothing about the end customer, you’ll probably not build the right thing.
  • Information lost in translation.
  • You’ll only notice important missing pieces very late in development.
  • People keep blaming others and nobody feels responsible for anything.
  • You need months to solve service tickets which could actually be solved in days.

It doesn’t sound so bad, does it ? Especially, when you are not a customer or the owner of the company… Well, basically it’s great as long as you’re the one getting paid for this and not the one paying !

Important side note: If you’re offered stock options, just ask for cash instead, you do not want to become an owner of that company…