Get the latest tech news

Getter-Setter Pattern Considered Harmful


The Problem Many developers (like myself) who started their careers with OOP (Java, C#, ...) during the last decades will look at this code and find no ...

February 14, 2025 Many developers (like myself) who started their careers with OOP(Java, C#, ...) during the last decades will look at this code and find nothing wrong about it at first sight. The reason for that is, that we have been indoctrinated - almost brainwashed - with OOP and its getter-setter pattern to such an extent, that we kept ignoring the obvious problems for years: mutability and state. And by getting rid of this prefix we moved any mental reference to the dreaded getter-setter pattern (let's call it an anti-pattern from now on) completely out of the picture.

Get the Android app

Or read this on Hacker News