News for hackers. Stuff that matters.
Re:Want cleaner code? Use the rule of six by upsideDownBlue on Saturday September 24, 2022 @01:02PM (#32964493)
I enjoyed the article and agreed that working memory places a fundamental limit on the intelligibility of otherwise equivalent pieces of code. As a former psychologist with experience of memory research (though not quite this area), it might be useful to others if I add that:

- The size of the short-term store is normally said to be 7 plus or minus 2 (the 'magic' number 7)

- The Working Memory model has somewhat overtaken the 'short term' memory model, and it is unusual to see them being presented alongside each other like this (though 'short term memory' remains a useful, good-enough metaphor for explaining certain key aspects of memory)

- Chunking is typically viewed as a memory-supported division of stimuli (what you're reading, hearing etc.) into meaningful units based on LTM memory representations. A good example is a chess expert 'chunking' the layout of a chess board with many pieces in perhaps one or two units (e.g. 'It's the mid game configuration of [famous players] in [famous game], except the king's position is different'). We would expect more expert programmers to 'chunk' increasingly large units, I think (e.g. 'Oh, this is just the [famous sorting algorithm]').

- A single chunk is usually considered to take up a 'slot' in short term memory

If anyone wants papers/sources for the above, let me know.

Re:Want cleaner code? Use the rule of six by ethbr0 on Saturday September 24, 2022 @01:08PM (#32964554)
Not high priority, but I'd love any references or names / key words I could look into it with.

I'm traditional wide comp sci by academic training, but spend my day job as a low-code enabler for non-programmers with varied backgrounds.

The working memory model explains and fits well with what I see them get and struggle with in day to day work, and I'd welcome references I could use to optimize my approach.

Re:Want cleaner code? Use the rule of six by ooloncoloophid on Monday September 26, 2022 @04:11AM (#32980648)
An overview of the model and its history: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4207727/

The Wikipedia entry for WM is also very good: https://en.wikipedia.org/wiki/Working_memory

It's a bit tricky to tell what you're doing exactly - perhaps drop me an email if you have any queries (using this account; my original parent post was on a throwaway account because I had login problems).

Re:Want cleaner code? Use the rule of six by pramodbiligiri on Saturday September 24, 2022 @04:47PM (#32966422)
Check out Anders Ericsson’s book on Deliberate Practice or Barbara Oakley’s A Mind for Numbers.
Re:Want cleaner code? Use the rule of six by gilch on Saturday September 24, 2022 @02:08PM (#32965157)
This means it should be the rule of five. We can't count on everyone having full capacity all the time.
Re:Want cleaner code? Use the rule of six by ooloncoloophid on Monday September 26, 2022 @04:13AM (#32980656)
I see what you mean - five will fit with more room left over. But much like a hand that has a capacity to hold 7 or so marbles, if you grasp only five at a time, your overall productivity will (almost certainly) slow.