Why I Hate Software Developers

Being a Software Developer I know how slow and counter productive developers get with time. Its not that we don’t get time to meet the deadline(although exceptions are always there), it is just our thought of thinking ourselves as highly efficient and over qualified.
We always hate testers since they put us back to work and make us clean up our own mess. But it is just their job to put developers on job and guide the software development on a right path. Sometimes I feel, it is the testers who put the developers on the right track.
But wait, sometimes even testers get lazy too. The code in alpha and pre releases gets their nod to be released but when the code is in production suddenly some tester would raise a finger on a very trivial issue that should have been found during the pre release stage.
This time I as a developer think how stupid and lazy the tester was for not to find this trivial bug, but eventually this thought comes back to me as a boomerang asking why on earth did the developer not notice such a blunder. At this time I feel serious identity crisis for myself.


The Dream:

There is a saying “Good developers write their own code, but the best developers utilize already written code“. Now having said that I must admit, almost every coder has a dream to right the code from scratch and never wants to manage and clean up someone’s mess.
Apparently very few lucky ones get that chance, rest of us have to cope up with the situation. The situation gets even worse when the code has already been changed by more than four or five different people. The person currently working on the code has to somehow understand and manage the coding styles and thinking of coders before him.
The best thing is that the current developer will surely manage to get the code working. This situation remains almost every time the developers change their jobs. There is a worst thing about this: no manager will let you get away with this silly argument, even though they themselves understand the situation very well.


What exactly did you do? This is just a minor change; This is a general question asked by several managers. The problem gets worse if the change is related to UI. The developer has to take care of several others elements nearby to move one simple button from left to right. In the outcome(from a user’s or manager’s perspective) it is just a re-positioning of a button, but it is the developer who knows the pain behind it.
Yes it is true that a good coding practice can reduce the amount of work, but don’t forget that the code has already been modified by several other developers who are not in the project any more, so the current person in the developer’s cap has to bear it.


Despite of all these things and situations we somehow learn to “MANAGE” and not to break any existing functionalities of the software. With time we get mature and acquire better skill sets to provide better solutions to problems and sometimes you get appreciations too for that. This little piece of appreciation helps developers a lot to again start thinking themselves as a better creatures, hence the cycle of fall and rise continues. We don’t get out of it and that’s why I hate software developers or more specifically myself.


A B C of Delhi and Women Prosperity

Women Safety

To clarify what A B C mean:

A: Aam Aadmi Party(AAP)

B: Bhartiya Janata Party(BJP)

C: Congress
Recently the Delhi had Assembly Elections and every participating party was promising to bolster the Women Security. The reason was clear: the recent rapid increase in incidents of rapes in the Indian Capital. Not just in Delhi, the whole country is facing this problem; the safety for women, and their encouragement including their security, education and support. The ABCs had included their own ways to tackle this giant problem; BJP promised to change the way people are provided the education at the early age saying that  primary way of education decides the way person behaves. On the other side, AAP promised to install 1.5 m CCTV cameras in the state, which people reacted saying nearly impossible thing to do and a breach in personal privacy. The AAP gave the explanation referring to U.S. President’s recent visit to India when nearly 14 thousand CCTV cameras were installed in the state and were removed after the visit was over.

It was the AAP who conceded never before win in the history of Delhi, winning 67 assembly seats out of total 70. Its worth mentioning here that BJP the party, to which the Indian Prime Minister belong, proposed the name of a woman Kiran Bedi, for their Chief Ministerial  candidate. Kiran Bedi was the first IPS officer of India and has a very good and strict image in India. But none of these worked out for BJP and they were reduced to a single digit(3) in terms of total seats won by them.

On the other side it was the AAP not more the a three year old party, whose basis of foundation was to fight against corruption, with very young leaders and workers. They promised to continue their fight against corruption and provide security for women.

The last party to look for was Congress to which Rahul Gandhi represent and had ruled Delhi for more than 15 year. They didn’t even won even a single seat in the elections, so probably no point in talking about it further.

Women in India

In India(India Society), women are thought of next to goddess. Even being a very large and tremendously diversified country, India has almost same status for women in almost every part of India. But recently, as I travelled to different parts of the country, I have seen various difference between the behaviours towards women.

One thing that I was unable to ignore is the difference between education of girls. In some parts girls are provide a maximum of 10th grade education and in some parts they are highly qualified engineers and scientists. Also their involvement in politics is quite different at various places. As I travelled to southern part I could see loads of hoardings of political people. It is a very easy thing to notice that out of 100 of these political or social hoardings you won’t find even a single face of woman in first 98. One can find even an eighteen year old boy’s face in the hoardings. So in a typical publicity board you can find around 15-20 male faces but not even a single woman. Its not that women have bad reputation in that area or they are not willing to work in politics. Here  women stay(or may be are kept) at home and come out only for celebrations like weddings with a big amount of gold and jewellery. It makes me feel as they are just a piece of showcase on particular events or family gathering, just to show how much gold the family possesses.  But in the same society there are women who are software professionals doing amazing jobs at high positions.

In other parts, girls are made to marry in a very early age even before they are eighteen. So there is no chance for them to study and learn. One of the biggest reason is the illiteracy and social status of parents, but even so called educated people also do this to their daughters. One reason of this is also related to security of women. The parents give explanation of child marriage that, being married at early life the woman is provided security by her husband as the parents are not able to keeps their daughter safe. In some states like Haryana, the local justice system have been accusing the females for the rape and other security issues. They say, “the woman or the girl must have provoked the males. She should not have wore those tight clothes or jeans.” Instead of punishing the culprits, the girl is forced to marry the person who raped her or the girl’s family is expelled from the society as their girl has ruined the respect of the village or society. Also sometimes the food especially fast food are made the reason for these incidents. In these situations it is still really hard to imagine the life of a girl or woman.

Back To Delhi

Now coming back to the state of Delhi, as the it is one of the central states in India so it has a mixture of almost every culture of India society. Because of this, Delhi has all the unique virtues and problems too, especially related to women and girls security and education. After the Delhi votes, the very first job of the new Chief Minister is to ensure the safety for the females. It is said about Delhi that even males are not safe in Delhi even if your are driving to home in your own car.  In these scenarios its really hard to root out the problem, probably that is why the AAP has promised to install 1.5m CCTV cameras in the state.


After the elections and in the light of recent events, the women are hoping that something will change in Delhi. We all are hoping that streets in the night will be safer for everyone to some extent at least.

After this long post “Even God made women as a reason to ensure the prosperity of the Human kind, be it Sita in Ramayana or Draupadi in the Mahabharata or the holy Ganga“.

JavaScript Programmer ? Do you also ignore semicolon?

A little story of two JS Programmers ==> Alice and Bob

Bob: Hey Alice. You know what, I have learned JavaScript very well. It’s very easy and fun.

Alice: Good, but you still need to be careful while writing you JS program.

Bob: Are you kidding me ? Careful with JavaScript? Several times I escape putting the semicolons at the end of the statement and you know it still works like charm.

Alice: You must be kidding. You shouldn’t forget to put the semicolon after the statement.

Bob: I am serious, who wants to put that reoccurring and irritating semicolon.

Alice: Of course JS ignores such things at several places, BUT  it doesn’t mean you should abuse this behavior.

Bob: Why not? I can do the following and it works perfectly fine:

    console.log("Hello! I missed the semicolon.")
    console.log("Hello! I missed the semicolon too.")
    Hello! I missed the semicolon.
    Hello! I missed the semicolon too.

What harm does it do?

Alice: Well, I think nothing till now. Bob can you do me a favor? Can you just put both the statements in the same line as it is?

Bob: Sure!

    console.log("Hello! I missed the semicolon.") console.log("Hello! I missed the semicolon too.")


    SyntaxError: Unexpected identifier

Bob: What!!!!!!!!!??????????
Bob: But wait, putting two statements in the same line is itself not good.
Alice: Fine(probably he doesn’t know about minification). Ok tell me the purpose of this code:


Bob: Its just a way to convert the string to number.
Alice: Exactly. Now what do you expect from of the following code written in your style:

    var a = 0
    var b = 1

Bob: Its too straight forward: 0 is assigned to variable “a” and the value 1 is assigned to the variable “b”.
Alice: Are you sure?
Bob: Wait ! Wait ! Wait ! Wait !. Oh I see the problem.
Bob: Hmmmm! You are right I shouldn’t miss my best friend semicolon.

Better use of Memoization JavaScript

Referring to the post Generating Unique Strings (Ids) in JavaScript where we looked at how to generate unique strings in JavaScript. Also I mentioned the performance and memory issues with the approach.

So, here we are going to look a much better use or application of Memoization, but we won’t be using it for generating unique strings. We will be looking at another issue and will try to find an efficient way to handle it.

We all know that accessing DOM elements is pretty much costly in terms of performance. Lets look at an example of such an issue.

    function someFunction() {
        var text = document.getElementById("some-id").innerHTML;
        return text;

Now suppose the above function is executed several times(reason could be anything like, user clicks). Every time this function is executed, it traverses the DOM and then returns it, which makes it really inefficient.
Now, I hope we have the idea of how to solve problem. Exactly, we will simply access the element one time and store it in a cache rather than looking into the DOM again and again.
So, here is how to do it:

    function someFunction() {
        if(someFunction.cachedElement) {
            return someFunction.cachedElement.innerHTML;
        } else {
            var ele = document.getElementById("some-id");
            someFunction.cachedElement = ele;
            return ele.innerHTML;

This technique can be more efficient if we are looking for multiple elements for example by className of the elements. In that case, we just need to get all the elements only once and store them in an array. So next time when the function is called all the elements are returned from the cache rather than going through whole DOM.
Pretty fast haan, isn’t it!

Generating Unique Strings (Ids) in JavaScript

Well, there are tools in JavaScript that allow you to create unique ids or strings.

I will be using to two ideas to create these unique strings.

Method 1: Memoization

The idea is to generate some random string and checking if it has already been generated the recursively generate another one and test again. If the generated string has not been already generated, then simply cache it somewhere and return it to the calling function.

Here is an example of it:

function getUniqueId() {
    getUniqueId.cache = getUniqueId.cache ? getUniqueId.cache : [];
    var randomString = "ID" + Math.random().toString().substr(2);
    if(getUniqueId.cache.indexOf(randomString) === -1) {
        return randomString;
    } else {
        return getUniqueId();

Method 2: Closure
Closures are on of the coolest things available in JavaScript. Closures allow us to access local variables of a function when you are out of he scope of the function.
Doesn’t it sound a little crazy: “How can a local variable of a function can be accessed while we are not in the scope of that function i.e., the variable is out of the current scope!”.

Well its true that we cannot access the out of the scope variable of a function, But the variables and functions local to that variable can access it right. This is the concept we will be using to generate our unique Id or string.

Here it is.

    var getUniqueId = (function () {
        var local = 0;
        return function () {
            return local++;

In the function above we are returning a reference to a local function, for which the variable local is in the scope and can still increment it. So every time we call the getUniqueId function actually the inner function also gets called and every time we get the incremented value.

Issues with these approaches:

Both of the above concepts are pretty cool to use, but you know nothing comes for free. Both have some performance and memory(space) issues with them.

If we carefully analyze the situation when we use closures, we are accessing an out of scope function and we all know that accessing out of scope variables is much costlier as compared to accessing local variables and functions in terms of performance as JavaScript engine has to search for the variable which is sitting far-far away from the current scope.
The situations worsens if the function has been defined in the global scope, because we have to go all the way to the global scope to get it.

Now if we take a look at the Memoization approach, we will see as the list of cached items increases, the function will tend to slow down. This slowness is because of the fact that before returning the the generated string, it has to traverse the whole cache. This slowness increases as the size of the cache grows.

There are some memory issues too with theses approaches because we in case of Memoization are maintaining a cache and in case of Closure the JS engine has to preserve a whole scope and its members.

So using these tool with care is necessary or our program would run into other issues.

PS: Lets get lazy a bit
Now here is the laziest(and easiest) way to generate unique strings:

function getUniqueId(padding) {
   return padding + (new Date()).getTime();

I hope this last function is very self explainatory.

Two Dimensional Arrays in JavaScript

JavaScript does not provide any direct notion of creating multi dimensional arrays as provided by languages like, C and Java. But there are ways to solve this problem and create a multi dimensional array.
Below we are trying to create a two dimensional array. The idea is simple and can be applied to create arrays with more than two dimensions:

function init2DArray(
    var twoDArray;
    var cols = 10, rows = 15;
    var indexI;
    twoDArray = new Array(cols);
    for (indexI = 0; indexI < cols; indexI += 1) {
        twoDArray[indexI] = new Array(rows);
        for( indexJ = 0; indexJ < rows; indexJ += 1) {
            twoDArray[indexI][indexJ] = 0;

Now since we have got the 2D array, we may want to initialize it with something (may be with a default value).
Simply add the add the following code in the for loop after the first line:

for( indexJ = 0; indexJ < rows; indexJ += 1) {
    twoDArray[indexI][indexJ] = 0;

I have tried to make the code above error free but if anly problem persists, please post it in the comments. Also please feel free to suggest any optimization in the code.

The College on Mountains-GBPEC

GBPEC (Pauri) – Thats what we or should I say “everyone” calls it.

Thats Where I Lived and Learned


I don’t need to say how one would feel if one studies at this place, the picture says it all.
I (probable most of the college students) still don’t know the person who captured this amazing scene.

Other than this amazing weather I tried to list some of the small but really pretty nice things that make my college awesome.
Here are they:

  • The Campus Shop: You can get almost everything you need for a hostel life: stationary, ice-creams(in super chilled weather), and two of the most important things buckets room heaters
    The best memories I can re-collect from this campus shop are “being called and interrogated by the seniors” and “college girls in their cool casuals
  • The Post Office: This is probably the mean of getting money sending application forms and getting money. Some times we also got Ubuntu CDs which we ordered on-line absolutely free of cost.
  • The Anand Valley: This was the place of breakups and makeups and new love birds of the college and a party place for decent guys. The Magi and the Mutter Paneer I still can’t forget.
  • The Temple: This was probably on the highest peak in the college. First year boys cleaning it(seniors used to make only us do this) and girls preparing and decorating it. Boys come to this temple to get a glimpse of their crushes. The night long Janmashtmi Pooja everyone loved it.
  • Durga Restaurant: This is the place right in the beginning of the way from main road to college. Parties, night long pool games with seniors and friends was amazing. This is the place I came to know most of my seniors.
  • and Auditorium (best known as Audi): The first place of getting started: orientation, seniors, teachers, new unknowns(became friends later), celebrations, dance, acting, love proposals, rejections, flirts too etc. etc. almost everything starts here.

Here is another amazing view of the college captured on the same day as the one above:

Another amazing view

Simply saying an amazingly crafted place to spend your life.

Those days have passed but memories you can’t avoid them, sorry who wants to avoid them!