Sunday, April 22, 2012

About the GAP

Almost 20 days since I posted last. Was very busy interviewing the first set of people into my company Ardhika. Was looking for fresh graduates since I do not want to waste time with people who say they know "Springs" or "swings" etc. 


First I started with an objective of getting people with some Java knowledge and after seeing 10 got frustrated and became more positive in getting somebody with knowledge of some logic and teach them Java. Then I saw 

  • Almost all stumbled to write a function to add 2 numbers
  • Cannot write a Person class with firstName, lastName and age as attributes
  • Always start the class with a PSV main(). For those who dont know what that PSV is it is the short form of "public static void". Similarly the other trick is SOP stands for "System.out.println"

I start with a question to write the person class above. After they write I will ask them to support my code
Person p = new Person("Bala", "Sundarasamy", 41);


Except 3 most of them fumbled at this point. Remember most of these people were not from a good financial background. Yet they have paid from 20K to 50K on Java courses outside their curriculum. 


If they are 50% into writing a constructor with my help (I was also judging whether they listened to me and took my help) I would ask them to support my code


System.out.prinln(p); 


which should print "Bala Sundarasamy is 40 years old". This is where all of them except 1 got  caught completely by surprise. Most of them tried to roll their own print function in Person class.
Then i ask them whether they know anything by name "toString". 


To my surprise one guy who got 98% in SCJP immediately said he does not know. Should try if anyone with an OCJP will know. Hope Oracle would have made a difference!


As a person who respects my mother tongue I did the interview in Tamil.  Finally selected 3 and they will have to undergo learning (self) for 2 months before they can become productive. Hope my teaching skills are still intact!


Forget about writing class, I asked one of these candidates to count the vowels in a given string. For some reason he started with last character. Then I could immediately guess he had written mostly string reverse function in his academics and interviews. And he confirmed later that my guess was correct!


Why are these academicians not doing any justice to sons and daughters of farmers , electricians and other people who are financially not doing well by providing them a good education for the money that they are spending on us? 


The education system is completely crippled! And none of them respect the responsibility they have towards the society.


I am not sure most of lack the skills of teaching but definitely are irresponsible.


OK, How do you teach some one to reverse a string?



  1. String is an array of characters
  2. Go to the last element
  3. access one by one and add it to a new string - reduce the index of source string and increase the index of destination string in every iteration

How do we go to the end of string? I would say find the length of the string and length -1 is the index of the last character. This particular piece of information must get into the students head strongly. 


But this is how it is taught to people in higher secondary (C++).



char name[] = “Pascal”, reverse[7];
int i= 0;
while (name[i] != ‘\0’)
    i++;
reverse[i] = ‘\0’;
—i;
int j = 0;
while (i>= 0)
   reverse [i—] = name [j++];

Why cant they use the strlen() function? In fact it is discussed in the page before this.

Most of the C programs dealing with strings will make extensive use of the strlen() function. But this book never used it! 



And here is another piece of GEM!


This class is called "strings" but deals with only one string.



class strings
{
char s[10];
public :
strings()
{
s[0] = ‘\0’;
}
strings(char *c)
{
strcpy(s,c);
}
char * operator+(strings x1)
{
char *temp;
strcpy(temp,s);
strcat(temp,x1.s);
return temp;
}
};

Look at the + operator overload.

I thought it should return an object of type "strings" but return a char*.  There is no memory allocated. I think the authors did not do that because of their peculiar aversion towards strlen() function. Had they used another "strings" object to hold the result they would have got at least 10 bytes and their main() would have worked.


But they have got a main method like this to test this class and + operator.


void main()
{
clrscr();
strings s1(“test”),s2(“ run\0”);
char *concatstr ;
concatstr = s1 + s2;
cout << “\nConcatenated string ...”
<< concatstr;
getch();



After going through the book several times I am sure of one thing I dont have to teach these guys the clrscr() and getch() after they complete engineering and come for a job. 


Imagine what would have happened if some author of a school text book misrepresented a fact about any of the political leaders or skipped a poem or a lesson written by them!



2 comments:

  1. Hi Bala,

    You may know this.. Most of the lecturers ( in my experience ) doesn't like any pre-built functions available in the languages and they just pass it to their students... I was penalized for using line() function in C as my lecturer believed I should get the co-ordinates and then write my own function to draw a line as he instructed.... Guess what he used setpixel() in his function to draw a line and I never understand in what way the built-in function setpixel() is better than the simple line()...

    ReplyDelete
  2. Built in graphics functions in C (Turbo or Microsoft) directly write to the video memory. Probably the lecturer wanted you to practice a loop construct more than effectively using the libraries.

    ReplyDelete