blog tumblog github @santosh79
February 16th 2014

Clean Code - Conditionals

This is part of a series of micro-blogs (somewhere between a tweet and a full on blog) on Clean Code. In this post, I’m going to focus on one big culprit in obfuscated, not clear clean code — Conditionals (i.e. if statements). Let’s look at an example:

December 22nd 2013

Curry Functions in JS


Returning a function from a function creates magic.

Down the rabbit hole

One of the foundations on which most of functional programming is built is partial or curried functions. An example is better than a thousand words, so here goes (this one’s from the Underscore Docs)

September 15th 2012

Understanding the this reference in Javascript

The this reference in Javascript is probably one of the most confusing scoping concepts for people coming new to the language. Understanding, the this reference lets you unlock the mysteries of Object Oriented Javascript and gain a better/more intuitive understanding of how the object model is structured…

May 20th 2012

Fight against Software Complexity

Why does software in the industry suck so much? Having worked at couple of startups and big companies as well, I can quite honestly say that of all the projects/repos that I had worked on, there was but one that didn’t suck. The one that didn’t suck, was I’m sure in no small part due to the fact that it was written by just one person, the CTO of the company, and since it was a license-based SDK, there was a vested interest in keeping things organized. Open source software projects, when compared with industry projects, are way easier to understand and in much better shape…

March 6th 2012

Memory leaks during Event emission

Javascript has garbage collection, so there’s no way we can leak memory right? Wrong. Memory leaks are pretty easy to create in Javascript much like in any other language that has garbage collection. The problem isn’t that bad when running Javascript on the client – unless you are having a blatantly obvious memory leak that kills your browser everytime the page loads. Writing Javascript on the server on the other hand, means you really have to focus on making sure you are not leaking any memory since your server process is going to be pretty long running…

January 2nd 2012

Comparison of MRI and JRuby GC's for a MMO Game Server

I’ve been looking at using Ruby for building up a stateless game server in a MMO setting. Ruby to many people, means Rails, which in turn means, a web app. The typical web app request when viewed through the lens of memory (allocation & deallocation) and IO (DB writes & reads) looks as follows:

December 28th 2011

Exploring Java's concurrent packages via JRuby

Threads are back in style these days. If you were like me, a Java engineer getting into Ruby couple years back, you probably would have seen your fair share of JVM bashing by a few people who relished beating on all things Java, while peddling their half-assed gems as software masterpieces. This is not to say that Java, especially it’s community, loves to over-engineer the crap out of everything they can lay their hands on, but (and this is a pretty big BUT) the JVM is a seminal piece of software. Okay, if you are still hanging around after this rant, I thank you for affording me this indulgence…

November 23rd 2011

Philosophy and Test Driven development

For someone coming to test driven development for the first time & even for those who have been dogmatically following it through the course of their work, the question “What do I test?”, still remains. In this blog, I am going to take a shot at answering that question using tools that Philosophy provides, specifically those employed by Immanuel Kant in his ground-breaking First Critique of Pure Reason. Those coming from a philosophical background, can see me drawing a hugely controversial line in the sand, and choosing to remain on the side against the empiricists by my previous statement. Over the course of this blog, I will go on to defend this position and expand on why an empirical approach to Test Driven development is flawed…