answersLogoWhite

0


Best Answer

The ability to make changes in your code without breaking the code of all others who use your code is a key benefit of encapsulation. You should always hide implementation details. To elaborate, you must always have your variables as private and then have a set of public methods that others can use to access your variables. Since the methods are public anyone can access them, but since they are in your class you can ensure that the code works the way that is best for you. So in a situation that you want to alter your code, all you have to do is modify your methods. No one gets hurt because i am just using your method names in my code and the code inside your method doesnt bother me much.

If you want maintainability, flexibility, and extensibility (and I guess, you do), your design must include encapsulation. How do you do that?

• Keep instance variables protected (with an access modifier, mostly private).

• Make public accessor methods, and force calling code to use those methods rather than directly accessing the instance variable.

• For the methods, use the JavaBeans naming convention of set and get.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

Encapsulation may be of different types depending upon the use of the substance which you are encapsulating...some times some drugs are encapsulated with some pH specific substance so that they can act upon the specified site where their pH matches...eg. eudragit a kind of micro sphere used to cover up a drug which generaly act upon the pH of stomach when it reaches the stomach it gets burst and drugs get released to act.

And it may be used in case of enzyme to increase its industrial productivity.encapsulated enzyme can be used for may reaction and it is cost effective..as it does not get mixed up with the product so the purification cost saves..so it can be used for several reactions and simply removed out after each reactions.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the various principles of encapsulation?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

The three basic principles of object-oriented design?

Encapsulation,Inheritance and Polimorphisim...


What learning principles would you consider in a training program?

what are the various principles of learning what are the various principles of learning what are the various principles of learning what are the various principles of learning


What are the various elements of Object oriented programming?

Encapsulation, data hiding, inheritance and polymorphism.


What is the name of the process of building a frame around network layer information?

Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.


Should a class have any public variables in C?

No. Microsoft should disable (remove) the declaration of any instance variables as public. This will enforce the encapsulation of OO principles.


What is Object Oriented Programming without the principle of Polymorphism?

Polymorphism is an important principle in OOP; it would be hard to imagine OOP without it. Other important principles are inheritance, and encapsulation.Polymorphism is an important principle in OOP; it would be hard to imagine OOP without it. Other important principles are inheritance, and encapsulation.Polymorphism is an important principle in OOP; it would be hard to imagine OOP without it. Other important principles are inheritance, and encapsulation.Polymorphism is an important principle in OOP; it would be hard to imagine OOP without it. Other important principles are inheritance, and encapsulation.


Which command sets the encapsulation on a Serial interface back to the Cisco default?

encapsulation hdlc


What is just distribution in society and structured by various moral and legal and cultural rules and principles?

Just distribution in society, structured by various moral, legal, and cultural rules and principles.


3 pillars of object oriented programming?

abstraction, inheritance, encapsulation, and polymorphism.


Why encapsulation is needed in java?

Encapsulation is not needed in Java, or any other language. But it's useful. Encapsulation is used to minimise the number of potential dependencies with the highest probability of change propagation.


Is encapsulation a characteristic of procedural or object oriented programming?

Encapsulation is one of the four pillars of object-oriented programming. The other three are inheritance, polymorphism and abstraction.


What is the value of knowing the chemical principles in various activities?

we learn a lot