“Server side” languages in 2012

Yes, 2013 just began but this post is about my views on programming languages that I have reasonable amounts of professional experience in. This post was inspired by what one of my former colleagues had to say on couple of days ago. Note that it is not meant to be a rebuttal, it just happens to be the tipping point that got me writing. I come from a very varies lineage:.. Read More

Type safety & SLoC

I believe that SLoC is inversely proportional to code maintenance costs. There are situations where bad code needs more lines of code than good code. The argument for reduced SLoC is trivial in this case. Interestingly, the same holds true in situations wherein good code needs more SLoC than bad code. The need for an increased SLoC to keep things nice & clean suggests that trying to “maintain” this requires.. Read More

Django middlewares, a strange way to do things

One of the pitfalls of being a polyglot is that it is easy to fall into the trap of drawing parallels rather quickly and incorrectly. In this post, we shall compare java servlet filters, wsgi middlewares and django middlewares. The J2EE story The notion of servlets is well understood in java, it is a piece of code that handles an incoming request and provides some response. The most popular kind.. Read More

Object composition implementation styles

  In the first part, we looked at conceptual implications of the various styles of object implications. Now we shall look at a few common implementations of object composition in conjunction with the concepts presented in the earlier post. Association v/s composition First off, we shall start with an example in C to understand the difference struct node { int data; node *next; }; This is a fairly common definition.. Read More

Implications of object composition styles

Object composition is a concept older than object oriented programming itself. Let us start off with a well understood example of how to represent a rectangle on a Cartesian plane: struct point { int x; int y; } ; struct rectangle { point tl; /* top left corner */ point br; /* bottom right corner */ } Here the rectangle object is a composition of two point objects and tl &.. Read More

In search of a job queue

Job queues are an essential element in internet application design to execute long running tasks. This stems from the fact that web servers and consequently web applications are best suited for interactive applications. If a particular operation that needs to be carried out fits the description below, then it makes a good case for the usage of job queues For the most part, these tasks need to be carried out.. Read More

An introduction to the elements of thrift serialization

Apache thrift is a surprisingly popular data serialization and RPC library. I say surprising because at the time of this writing, there is hardly any decent documentation out there that explains the elements of thrift serialization. It is however easy to find tutorials that help you hit the ground running very fast. This article assumes you are conversant with simple examples. Tbase objects Data structures are defined using the thrift.. Read More

The fair coin paradox

One of the most commonly accepted yet fundamentally flawed ideas in probability theory is that of a fair coin. A fair coin is defined as a coin when when tossed sufficient number of times will return roughly the same amount of heads and tails. The trick here is that both the number of trials required to establish the fairness and the accuracy is left open ended. The evil coin Let.. Read More

Strings, lists & gatherers

Problem statement: You need to send a dynamically constructed stream of bytes over some I/O channel. An illustrative example As always, I shall take an example in the internet space and more specifically in HTML. Let us say that you have a classical two dimensional array whose dimensions are not known at compile time. The contents of this array happens to be strings. This 2d array needs to be printed.. Read More