Want a job? Reverse a string ...
having read the blog above, remind me of an interview I had which exactly, asked me to write a code which reverse a string. The code I wrote was a simple for loop doing exactly what was asked, so simple a code that I'm so sure it won't have any bug.
The blog I read made me think, was recursive really the code that was expected by my interviewer (which then became my boss for the shortest time of my employments' life... ever :p)
Anyway, that's not what I'm talking about here, the point of interest is recursive.
Recursive, imho, is very useful, sometimes an undisputable way to solve a problem efficiently. BUT... it is not the silver bullet which will work efficiently for every problem. Yes, it will work undisputably well for layouting components (e.g. Swing, JSF), some mathematical stuffs (e.g. permutation), deleting folder and its content and many other things.
Wise programmer will try to write a simple, elegant and performing code. Less bugs, easy to maintain, faster code, less memory consumed aren't those the traits we all want for our code (there are some more...).
Only unwise programmer will try to write a recursive code for reversing a string, or maybe....
only an interviewee who knows where this question lead to, will write it that way (and hoping that he will get the job at some high salary :p).
It's really funny remembering that I've had this kind of test in my interview... If I did write a recursive code for reversing a string... was I a super programmer? or even a genius?