- Visibility modifiers designate the accessibility of data members and methods - Not syntactically required, but strongly recommended to use them - Recommend always designate the data members and methods as public or private - Object-oriented design philosophy - Instantiable class design: designing behavior of instances - Methods that other programmers using your class should be able to call are declared public - Client programmers: programmers using your classes - Client program: a program that uses your classes - Declare methods private if they involve internal details that should be hidden from client programmers - Information hiding: making internal details invisible when knowing how they work is unnecessary for properly using the class - Encapsulate: hide internal details, but use them to offer an interface for the classes' functionality - Encapsulation mechanism - Allows easier code modification - Changes to the internal workings don't affect client programs - Need data members to implement methods - Considered internal details of class because client programmers don't need to know about them to use the class - Declare data members private - Behavior of instances determined by public methods - Internal details hidden from client programmers implemented with private data members and private methods - If declare an internal detail public, back door created that can break the functionality of the class - Must declare data members private to ensure class integrity - Works because client programmers can only alter the data via public methods - Class constants can sometimes be declared public in good style - Constant, so everyone already prohibited from modifying - Clean way to make certain characteristics of the instances known to the client programmers - Syntax for accessing public class data members . - Very common in Java - Distinguish private and public components in the class diagram - Plus symbol for public - Minus symbol for private Quick Check 1. No: client programs can't access private class data. 2. It should be declared private, because other people don't need to know about it to interact with me!