News for hackers. Stuff that matters.
Re:The Wrong Abstraction (2016) by ijidak on Sunday July 05, 2020 @12:47PM (#23740010)
> Having the same "unit conversion" function duplicated in 3 parts of the code can be disastrous.

This.

I feel like it's really about cognitive load to remember and recognize the differences.

Duplication in 3 distant files, places a heavy load on the developer to:

1. Discover the duplication 2. To grasp the reason for the differences in the 3 different locations. 3. Remember these things

Whereas when the duplication is in the SAME file, #1, #2, and #3 can become very manageable cognitively.

Now the question changes to..

Is the cognitive load of dealing with the different special cases in a single de-duplicated method GREATER than simply leaving them in separate methods?

Often the answer is duplication WITHIN a file is less of a cognitive load.

Whereas duplication ACROSS files is a heavy cognitive load.

Minimizing cognitive load minimizes mistakes. And minimizes developer fatigue. Thus boosting productivity.

At least, that's my development philosophy, even though I've never seen it in a design pattern or a book.

It just seems to make sense.

There are no comments on this comment yet.