Search this blog...

Bachelor of (Reverse) Engineering

Just a thought - What makes newly graduated engineers (or "freshers" in layman terms) such bad programmers. Why is it that in the IT industry, experience counts more than anything else! Why is it that companies spend so much in training recently graduated engineers "freshers". More simply put,

Q. What is the main difference between a
"brilliant fresher" and an "experienced pro"?

The answer lies in the following fact. Most of what is taught in undergraduate courses (BE/B.Tech) is irrelevant to what one actually ends up doing as a "fresher" programmer. No one in his/her right mind would tell a fresher to design the framework of a new module. Also a programmer never has to write fresh code from scratch. The job at hand is, almost always, to fix bugs in existing code and sometimes to add a few "features" to existing software.
This means the good programmer needs to be:
  • Good at reading code quickly.
  • Good at identifying the relevant parts quickly.
  • Good at understanding code quickly.
It might be surprising to know, but seldom are these emphasized enough. Rarely does any "fresher" ever focus on these aspects. Instead you will always find one totally engrossed in any of the following:
  • Writing code as efficiently as possible.
  • Writing it so that it is easier to understand.
  • Writing it in newer languages.
  • Writing code using newer IDEs.

Ask any "fresher" whats so special about him and he is sure to reply that he can write better code than his peers. Little does he know that writing code is going to be the least of his worries (for the next few years atleast).

To drive the point home lets look at the following code-snippet:

for(j = 0; j < MAX; j++) {
    //some
    //code
    //here

   //ISSUE #xyzxyz FIX: change order
   i = (j < 2) ? !j : j;

    switch (i) {
        case 0:
        //case 0 code
        break;

        case 1:
        //case 1 code
        break;

        case 2:
        //case 2 code
        break;

        //rest of the code here

   }

}

The above snippet is what one would encounter on an average day. Note the following line:
i = (j < 2) ? !j : j;

Can You figure out what the ISSUE could have been.
And how the one-liner FIX solves it... ;-)

(more on this in later post)

6 comments :

  1. If you want to comment that its a Ternary operator, then plz don't. I know that you know that it is what is taught in BE.

    Think about what that "one-line" achieves...

    ReplyDelete
  2. SO BAD.
    ................................. NA

    ReplyDelete
  3. @Prashant !!BUZZINGA!! its (!) not (~)

    ReplyDelete
  4. i=1 when j=0
    i=0 when j=1
    i=j when j>=2

    So probably earlier switch-case was directly based on j, but for switch cases in case of '0' & '1', it needed to handled reversely (i.e. it should take '0' for calculation further when j=1 and vice versa)

    ReplyDelete
  5. @Anonymous Indeed!
    It is a hack-n-patch for the case U mention.

    ReplyDelete