News for hackers. Stuff that matters.
Re:Simple Ways of Reducing the Cognitive Load in Code by joshmarlow on Tuesday June 28, 2016 @09:55AM (#11993785)
I'll second Sindisil's comment about nested functions.

I still often do the paragraph approach, but the thing about that is you rely on the comments to stay up to date to describe that paragraph.

I prefer to instead move that paragraph into a small nested function and name it to reflect what would be in that comment. I feel function names are easier to keep up to date than comments (ie, programmers don't just read past the function names like they do comments).

There are no comments on this comment yet.