Recalling all the placement discussions we all had, one general question: Rate yourself in the particular language. Recalling all the college placement interviews, I was asked, "Rate yourself in C++"
So my first question was always, what do you mean by rating, is it knowing the language or the ability to code. Mostly the interviewer gave me a diplomatic answer. I was not convinced myself as well. This was one quest I was since I was in college. Thanks to my colleagues and friends, I think, I can arrive at a specific answer.
Coding is an art, the way we use language constructs to minimize the efforts we are putting in. For example:
Problem Statement:
Given an array, sort it such that even numbers are in descending order and odd are in ascending.
Assuming we are given a function sort(array.begin(), array.end()), using conventional programming methods we won't be able to use this function. So If I am coding using C++, following will be the approach:
class modifiedInt{
public:
int element;
bool operator < (modifiedInt) const{
if (modifiedInt.element & 1) //Odd
if (modifiedInt.element < element)
return 1;
else
return 0;
else //even
if (modifiedInt.element > element)
return 1;
else
return 0;
//Similarly operator> operator== operator< can be defined
};
After the above definition, we can directly use sort function provided to us, Here Using language constructs, the coding is simplified.
This is a very simple example, where we are using language constructs to simplify our logic and increasing code portability, usability and scalability.
The knowledge of a language provides us a tool we can use in coding. They are the basic things which help an art become easy. Given an algorithm, its not so difficult to code. Knowing the language constructs only help in achieving our end goal.
So Next time, if we are asked how do you rate yourself in C++. Lets hope we would rate myself more comprehensibly.
Feedbacks/Comments are most welcome.
So my first question was always, what do you mean by rating, is it knowing the language or the ability to code. Mostly the interviewer gave me a diplomatic answer. I was not convinced myself as well. This was one quest I was since I was in college. Thanks to my colleagues and friends, I think, I can arrive at a specific answer.
Coding is an art, the way we use language constructs to minimize the efforts we are putting in. For example:
Problem Statement:
Given an array, sort it such that even numbers are in descending order and odd are in ascending.
Assuming we are given a function sort(array.begin(), array.end()), using conventional programming methods we won't be able to use this function. So If I am coding using C++, following will be the approach:
class modifiedInt{
public:
int element;
bool operator < (modifiedInt) const{
if (modifiedInt.element & 1) //Odd
if (modifiedInt.element < element)
return 1;
else
return 0;
else //even
if (modifiedInt.element > element)
return 1;
else
return 0;
//Similarly operator> operator== operator< can be defined
};
After the above definition, we can directly use sort function provided to us, Here Using language constructs, the coding is simplified.
This is a very simple example, where we are using language constructs to simplify our logic and increasing code portability, usability and scalability.
The knowledge of a language provides us a tool we can use in coding. They are the basic things which help an art become easy. Given an algorithm, its not so difficult to code. Knowing the language constructs only help in achieving our end goal.
So Next time, if we are asked how do you rate yourself in C++. Lets hope we would rate myself more comprehensibly.
Feedbacks/Comments are most welcome.