aspose file tools*
The moose likes Java in General and the fly likes What is the relation between abstraction and security? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is the relation between abstraction and security?" Watch "What is the relation between abstraction and security?" New topic
Author

What is the relation between abstraction and security?

chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Hi all, my name is Chaitanya. I was interviewed recently on java. The interviewer asked me a question, "What is the advantage of abstraction?".

I said that "abstraction is hiding the implementation details. Suppose that we have an abstract class with an undefined method and a child class is extending the abstract class, inturn another class is extending the child class. The programmer need not know at which level of hierarchy the method is implemented. This is called as abstraction."

The other advantage of abstraction I know is that there can be any number of implementations. For example take List interface of the collection framework. In the interface there are methods declarations for what a List must do. Now ArrayList and LinkedList are implementing the List interface. Here we are having 2 different implementations. ArrayList is speed in searching, LinkedList is speed in manipulations. Like this we can have any number of implementations in our application using abstraction,

The interviewer said that the answer is partially right. But the actual answer is "the main advantage/use of abstraction is to provide security to the code" and he was telling about some stuff related to showing the design to the client. I did not understand it actually. Since it was an interview I did not ask him to explain in detail. I have read few threads in coderanch and few forums. But did not find any answer related to security with abstraction.

Can anyone tell me? Thank you all in advance, good day.


Love all, trust a few, do wrong to none.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8427
    
  23

chaitanya karthikk wrote:The interviewer said that the answer is partially right. But the actual answer is "the main advantage/use of abstraction is to provide security to the code" and he was telling about some stuff related to showing the design to the client...

Personally, I'd say you're probably better off not getting a job there, since he clearly doesn't know what he's talking about (unless you've misquoted him).

Questions of that sort are patently absurd anyway, since they're far too general. They're probably only using as a mantrap for you to fall into.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 19066
    
  40

chaitanya karthikk wrote:The interviewer said that the answer is partially right. But the actual answer is "the main advantage/use of abstraction is to provide security to the code" and he was telling about some stuff related to showing the design to the client. I did not understand it actually. Since it was an interview I did not ask him to explain in detail. I have read few threads in coderanch and few forums. But did not find any answer related to security with abstraction.


Sounds to me that the interviewer transitioned to a customer use case discussion (and did a poor job at it). Regardless, you need to engage when the interviewer does this. You need to be very interested in the use case (or just show that you are interested); you need to brain storm about the use case, etc. This means that if you don't understand, you need to ask.

I understand that you don't want to ask, since that may show that you don't understand, but there are huge issues with that. First, you can't engage, which in turn, may show that you don't understand anyway. Second, the deflecting of the topic may show lack of interest, either in the company, technology, or their customer. And finally, it is an opportunity to show how you think through something that you don't understand.

Henry

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

chaitanya karthikk wrote:
The interviewer said that the answer is partially right. But the actual answer is "the main advantage/use of abstraction is to provide security to the code" and he was telling about some stuff related to showing the design to the client.


That is absolutely false. The main purpose of abstraction, in my opinion, is to decouple design from implementation. It gives us the ability to say what something does without specifying how it does it. I'm sure there are other valid opinions on the "main use" of abstraction, but "to provide security to the code" is absolutely not one of them.

Additionally, what the interviewer was talking about isn't really "security" in any commonly used sense of the word. It's more about protecting intellectual property. And, when you get right down to it, the example he gave of showing the design do the client (but presumably not the code that implements it) is precisely what I'm talking about.

So I'd say the main use of abstraction is to decouple design from implementation, and one advantage of doing that (but definitely not the main one) is that it can help provide the kind of intellectual property protection the interviewer was talking about. I agree with Henry that this would have been a good chance for you to engage the interviewer (perhaps stating what I just did) for the goals of 1) Demonstrating your understanding of the concepts and ability to adapt that understanding to different situations and usages, and 2) to learn more about the perspective of the interviewer and the company.
chaitanya karthikk
Ranch Hand

Joined: Sep 15, 2009
Posts: 806

Thank you all.

Now I understood that abstraction has nothing to do with security. It is used to decouple the design with implementation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the relation between abstraction and security?