SCJP 1.4 85%
Originally posted by Ernest Friedman-Hill:
In the sentence you've quoted, the technical term "encapsulation" is really being misused, although it's a common mistake. In that sentence, it just means "implemented in". The business logic is implemented in Java Beans.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Aum Tao:
The accessor(getter) and mutator(setter) methods are generally used to provide encapsulation.
Originally posted by Stan James:
If you Google this question you'll find about as many definitions as there are "expert" authors and lecturers.
Tony Morris
Java Q&A (FAQ, Trivia)
If you want maintainability, flexibility, and extensibility (and of course, you do),
your design must include encapsulation. How do you do that?
■ Keep your instance variables protected (with an access modifier, often
private).
■ Make public accessor methods, and force calling code to use those methods.
■ For the methods, use the JavaBeans naming convention of
set<someProperty> and get<someProperty>.
SCJP 1.4 85%
Originally posted by Aum Tao:
Isnt' encapsulation provided by keeping the instance variables private and providing setter and getter/setter methods to access them?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ever (really really as in deep analysis) wondered why a simple web application that does nothing more than handle incoming HTTP requests with a HTTP response, requires: Spring framework, Velocity, Hibernate, etc. etc. *yawn* etc.?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi