Comment

Comment by jeremydeanlakey

The central idea around cognitive load is very good, central to writing good code.

But it's deeply mistaken to oppose smaller (or more correctly: simpler) classes/functions and layered architecture.

Layered architecture and simple (mostly small) classes and methods are critical to light cognitive load.

e.g. You should not be handling database functionality in your service classes, nor should you be doing business logic in your controllers. These different kinds of logic are very different, require different kinds of knowledge. Combining them _increases_ cognitive load, not decreases.

It's not mainly about swapping out dependencies (although this is an important benefit), it's about doing one thing at a time.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton