DEV Community


Discussion on: What is the difference between public, protected, and private in Java?

fpuffer profile image
Frank Puffer

While this makes sense, I still don't get your point.

If I understand you correctly, you suggest to make all fields and methods of a class public because encapsulation does not provide much value.

This means that every part of your codebase is potentially directly connected to any other part. How do you keep the design from turning into a Big Ball of Mud? You mention interfaces. But how do you make sure everybody uses them and does not access the classes directly?

Forem Open with the Forem app