Sitemap

Member-only story

Smarter Than the AI

protected Doesn’t Protect Anything

A design smell wearing a keyword: in OOP it’s a second public API nobody documents; in TypeScript it isn’t even private.

9 min readJun 13, 2026

More and more code is being generated with AI, and that’s making me see certain long-forgotten techniques come back to life, but also code smells I thought were already buried. In this article I want to talk to you about protected, where it comes from, what it’s for, and how I keep seeing it appear more and more often in AI-generated TypeScript code. A keyword that, despite having a lot of potential, also often gives off a certain whiff.

What does protected do?

Classic object orientation provides a whole series of mechanisms and properties to organize code. The idea is simple: we have independent objects that can only interact with each other by passing messages. The initial benefit is that how each object is implemented stays hidden, and the only thing objects need to know is how to talk to each other, reducing the coupling to the details. And this translates into programming languages adding a series of mechanisms to keep the details hidden.

The most basic implementation is public and private. In object-oriented programming we can decide…

--

--

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.