FlashKeepers

Computer Science · College

Object-Oriented Programming, Unit 2: Encapsulation and Access Control

Object-Oriented Programming, unit: Encapsulation and Access Control. Core concepts, terminology, and worked-example cues a college student meets for this unit, building on prior units without repeating them. Front: a term, concept, or short problem cue. Back: the definition, explanation, or answer.

16 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone
What is encapsulation?
Bundling data and methods together while restricting direct access to internal state
Why is encapsulation useful?
It protects an object's internal state from unintended interference and misuse
What is access control, in OOP?
Rules determining which parts of a program can access a class's members
What does the 'private' access modifier do?
Restricts a member's visibility to within its own class only
What does the 'public' access modifier do?
Allows a member to be accessed from anywhere the object is visible
What does the 'protected' access modifier do?
Allows access within the class and its subclasses, but not from unrelated code
What is information hiding?
Concealing internal implementation details from outside code that uses an object
What is a data abstraction, in the context of encapsulation?
Exposing only relevant, essential details of an object while hiding complexity
Why are instance variables commonly made private?
To prevent external code from directly modifying an object's state in invalid ways
What is validation logic often placed in, when using encapsulation?
Setter methods, to ensure only valid values are assigned to instance variables
What is a package (or namespace), in relation to access control?
A grouping of related classes, sometimes affecting default access visibility
What is coupling, in software design?
The degree to which different classes or modules depend on each other's internals
Why does encapsulation reduce coupling?
It hides internal details, so other code depends only on a class's public interface
What is an interface's role in supporting encapsulation?
It defines what a class can do without revealing how it does it
What is immutability, in object design?
Designing an object so its state cannot be changed after creation

1 more cards in the app