| Author |
Regarding Encapsulation
|
Suguna Gollapally
Ranch Hand
Joined: Oct 31, 2006
Posts: 37
|
|
Which of the following are th benefits of tight encapsulation : 1. It provides for higher program performance 2. It results in reduced need for constructor methods 3. It involves the separation of the implementation of classes from the interface. 4. It allows greater security of programs by limiting the access to methods
|
 |
Deepak Chandrashekar Avanna
Greenhorn
Joined: Oct 11, 2006
Posts: 7
|
|
|
I believe option 4 is correct as the data is accessed through methods rather than directly with tight encapsulation. Any comments from others?
|
 |
Jae Stryker
Greenhorn
Joined: Oct 31, 2006
Posts: 21
|
|
|
I would agree - Number 4 is one of the benifits of encapsulation.
|
 |
David Grindley
Greenhorn
Joined: Oct 30, 2006
Posts: 14
|
|
I think answer 3 is definitely correct. Encapsulation hides how data is stored and manipulated by a class so it hides the implementation behind a class I'm not sure on option 4 since it depends upon how I read it! If you read it as the only way to use a class is via its methods, that is, you have no access to the actual variables in a class instance, then option 4 is correct. If you read it as only certain users of a program can access certain methods then I'm not sure that it could be defined as encapsulation. I would hate to find a question like that on the exam!
|
 |
Andy Morris
Ranch Hand
Joined: May 30, 2004
Posts: 78
|
|
Is this really an official mock or exam question? #3 doesnt sound like a benefit of tight encapsulation to me, rather it is a way of achieving tight encapsulation. Quite different really! Regarding #4, imo it depends on the meaning of the word security in this context. It's obviously a rather simple process using reflection to access methods that are protected as part of encapsulation, but if secure is being used in the 'robust' sort of meaning then I guess #4 could be considered true. I'd probably go with that if I had to answer it.
|
 |
Burkhard Hassel
Ranch Hand
Joined: Aug 25, 2006
Posts: 1274
|
|
I agree with David, 3 and 4. But I am more convinced than David that 4 is correct. Because I read "greater security" as he first read it, not as security from access by unauthorized users. I think security in the ideas of the makers of the exam stands for program safety - in respect of exceptions thrown, etc. A encapsulated int variable e.g. cannot be set to sub zero accidently, if the setter doesn't provide negative values. This kind of things. 3 is also correct as David said. Because the interface (API, do not mix up with interface {} ) shows only how the class can be used, and not how the class actually performs its tricks. David also wrote:
I would hate to find a question like that on the exam!
I'm afraid the sentence should start: "I will hate ..." Andi:
#3 doesnt sound like a benefit of tight encapsulation to me, rather it is a way of achieving tight encapsulation. Quite different really!
Hm... First you achieve it, and then you have the benefits? If this was from a mock exam, was the correct answer provided? If only one answer was allowed, I'd favourite 4 over 3 Yours, Bu.
|
all events occur in real time
|
 |
Maciej Zpolski
Greenhorn
Joined: Nov 02, 2006
Posts: 10
|
|
This question is from www.examulator.com (and other sites I think ) The correct answer is #3 About #4 they say, that encapsulation has nothing with security of programs.
|
Sorry for my english..
|
 |
Jae Stryker
Greenhorn
Joined: Oct 31, 2006
Posts: 21
|
|
It depends what is interrupted by 'Security of programs' - I really do not like the ambiguous question as they leave too much to interpretation. I suspose for it to be number 4 then it would have been worded 'Security of classes' � Still these q�s are never that clear.
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
|
I think #4 is more closely related to the concept of tight or loose coupling than encapsulation.
|
 |
Suguna Gollapally
Ranch Hand
Joined: Oct 31, 2006
Posts: 37
|
|
yes, this Question is from examsimulator.. I selected 3 and 4 options but it says wrong..ie y i just posted to have your opinion.. Thanks for the explanation
|
 |
 |
|
|
subject: Regarding Encapsulation
|
|
|