Ignorant Objects

--

Object ignorance means an Object-Oriented programming style where you strive to make objects know as little about one another as possible.

In more formal terms, this means reducing the number of dependencies in each object.

Objects with fewer dependencies know less about their surroundings and need a smaller context.

An object that’s context independent can be reused in novel ways.[¹]

You can tell how much context an object requires by looking at the setup needed to test it — lots of necessary contexts.

Little or no test setup indicates that the object is independent of context.[¹]

An object that’s context independent is not coupled to other parts of the application. These objects are amenable to being used in unexpected situations.

[¹]: Glenn Goodric (2021): A Q&A With Sandi Metz (https://superhighway.dev/sandi-metz-interview)

--

--

Rafael A. George Duval
Rafael A. George Duval

Written by Rafael A. George Duval

✍🏼 Building a Solo Digital Media Company 🧪 Snippets of Text [https://snippetsoftext.substack.com/subscribe]

No responses yet