14

Parnas wrote down the test in 1972 and most codebases still fail it. A module is characterised by the design decision it hides from every other module. That's the whole rule. Private fields, protected methods, a tidy export list, none of that counts for anything if the decision underneath is still visible to everyone who calls in.

The getter and setter pair. A class takes a field private, then exposes read and write for it. Every caller can reach in and set the thing, so the module has fused itself to every callsite that knows about its insides, exactly as if the field had been public. The keyword did the syntactic part and nobody did the design part. The field is private and the decision is not.

A module exporting a helper that one caller uses is the same failure at the file level. The boundary is theatrical. If only one caller needed it, the helper belongs inside that caller, and leaving it on the public surface tells every future reader that it's part of the contract when it isn't.

Agents have made this worse rather than better. Handed a class with a getter for every field, an agent reads the getters as the vocabulary of the module and builds on them. A person might notice the shape is thin and go and look, an agent takes the surface as the contract, because the surface is what it was given. Two getter-and-setter classes and the decision that was supposed to be hidden is now the interface for the next twenty files.

The surface is the meaning, because the surface is what gets copied.

https://prickles.org/tenet/encapsulation/F6

you are viewing a single comment's thread
view the rest of the comments
[-] stembolts@programming.dev 5 points 20 hours ago

Python, "You can't see _me."

[-] joshcodes@programming.dev 2 points 9 hours ago

Also python: "we're all consenting adults here".

this post was submitted on 13 Oct 2026
14 points (88.9% liked)

Programming

28803 readers
117 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS