Refactoring 009 - Protect Public Attributes
Forget about data structures, DTOs, POJOs, and anemic objects.

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.
Search for a command to run...
Forget about data structures, DTOs, POJOs, and anemic objects.

I’m a senior software engineer loving clean code, and declarative designs. S.O.L.I.D. and agile methodologies fan.
No comments yet. Be the first to comment.
Different stages need different brains.

One Second Brain doesn't scale past one skull.

Style errors double when nobody enforces them.

Know who speaks before the skill runs TL;DR: Always define a clear role at the top of every skill file so you know whose perspective drives the execution. Common Mistake ❌ You write a skill full of

Everyone is talking about Loop Engineering. Apparently, you don't need to program anymore. TL;DR: Loop Engineering is the hottest AI workflow pattern of 2026. But it hides a dirty secret. The Tweet

TL;DR: Avoid external manipulation
Encapsulation Violation
Anemic Models
public class Song {
String artistName;
String AlbumName;
}
public class Song {
// 1- Change the visibility of your attributes from public to private
private String artistName;
private String AlbumName;
// We cannot access attributes until we add methods
}
[X] Semi-Automatic
We can change the visibility with an IDE or text editor.
This is not a safe refactor.
Existing dependencies may break.
We can change encapsulated code easily.
The code is not repeated.
Some languages don't have visibility options.
This article is part of the Refactoring Series.