Wednesday, June 14, 2006

Abstraction and Encapsulation

These days I conduct a lot of job interviews to fill up few vacant positions for developers in our group. Typical profiles that I get read something like:
<<S. RamaLinga Reddy>>
Hyderabad
BCA, MCA, PGDST, e-DAST, NSCT,NIIT…(yes IT qualifications in India look like degrees of a medical practitioner- the more the better)
5+ years in IT
Expert in C#/.NET, ASP.Net, VB.Net,C, C++, Java,
Knowledge of COM, DCOM, COM+, MTS, SQL Server, IIS, Windows, Unix (?), OOP, Design Patterns…
Responsible for FSD, LLD, HLD, CUT…
Wannabe S/W Architect
The first page is normally crammed with such accomplishments and aspirations. One Reddy I saw had included this too “H/W: Pentium-III, 633MHz, 128 MB RAM, 8.3 GB SCSI- II HDD, 32x CDROM, 1.44 (3.5 in) FDD, PCI BUS Architecture”. Next tens of pages lists the projects he has worked like: “Web Based Employee Attendance Management System”, “Employee Data Management System”, “Ticket Reservation Systems” and so on.

Yesterday, I interviewed one such candidate. As expected, he too had a well endowed resume not different from the above sample, though. I am reticent even during interviews. Hence, he was quizzed mostly by my colleague. I just had one question at the end:
What is the difference between Abstraction and Encapsulation?

Answer: Both are actually same…umm...like Encapsulation...is Encapsulating things in a class and...umm ... Abstraction is Abstracting somethings inside a class...umm...blah blah blah
End of interview!

I have been asking this question to every 5+ years I see. However, rarely I get a pleasing answer. No wonder we still remain a land of ‘Cyber Coolies’!

For the benefit of next candidate I have to interview, here are some links to look at:
http://www.itmweb.com/essay550.htm
http://www.javaworld.com/javaworld/jw-05-2001/jw-0518-encapsulation.html
http://www.artima.com/intv/abstreffi.html
http://forum.java.sun.com/thread.jspa?threadID=280797&messageID=1092364

It is important to learn how to abstract what you know and encapsulate what you don't before you appear for a job interview !

:-)