Download presentation
Presentation is loading. Please wait.
Published byHorace Stevens Modified over 9 years ago
1
Writing Code for Other People Tom Mullen The barriers and techniques of human intelligence are starting to be uncovered by psychologists. There are remarkable parallels between the cognitive model and principles established by software designers. It is as if the jigsaw puzzle that software designers have been working on has been turned over to reveal another picture on the back, the very same picture that psychologists have been building...
2
Overview Cognitive Psychology (Chunking and Memory) Analogies Psychologists Definition Code Structures Fundamental Metric Using the Cognitive Model
3
Overview Cognitive Psychology (Chunking and Memory) Analogies Psychologists Definition Code Structures Fundamental Metric Using the Cognitive Model
4
Elements of Cognitive Psychology
5
Chunking and Memory A chunk is “a collection of memory elements having strong associations with one another but weak associations with elements within other chunks” Structured Design Principle: “maximise cohesion and reduce coupling”
6
Chunking and Memory STM Capacity Limit CRC Model Refactoring STM Time Limit Indirection cost
7
LTM Structure Discrimination Nets
8
Cognitive Model
9
Summary Conjecture: Current software languages and design principles guide a programmer to produce code that is a direct textual representation of the memory network of the solution within the brain (subject to the constraints of short term memory).
10
Overview Cognitive Psychology (Chunking and Memory) Analogies Psychologists Definition Code Structures Fundamental Metric Using the Cognitive Model
11
Overview Cognitive Psychology (Chunking and Memory) Analogies Psychologists Definition Code Structures Fundamental Metric Using the Cognitive Model
12
Analogies
13
Meeting Room Analogy
14
Gentner Classification
15
Overview Cognitive Psychology (Chunking and Memory) Analogies Psychologists Definition Code Structures Fundamental Metric Using the Cognitive Model
16
Analogy Template
17
Analogy Patterns in Software
18
Analogy Patterns in Software Attribute Only [Map] Map exchangeCountry = new HashMap(); exchangeCountry.put("CBOT","US"); exchangeCountry.put("LIFFE","England"); Na Aa Nv Av
19
Analogy Patterns in Software Statement Shape p rivate boolean isValid() { if (expirationDate == null || !( expirationDate.getTime() > 0 ) ) return false; if (contractNumber == null || !(contractNumber.longValue() > 0) ) return false;
20
Analogical Translations
21
Analogy Patterns in Software Method Name (Prefix) public void visitExpression(Node a){}; public void visitBlock(Node a){}; public void visitFile(Node a){};
22
Analogy Patterns in Software Application Level Running Instances are Literal Similarities of one another. Configuration details the attributes IOC mechanisms allow operations
23
Overview Cognitive Psychology (Chunking and Memory) Analogies Psychologists Definition Code Structures Fundamental Metric Using the Cognitive Model
24
Parlay? In Pirates of the Caribbean what was Captain Barbossa's response to Elizabeth Swan's demand that the Pirate Code required him to put her ashore safely?
26
4 minus Analogies Rule The core fundamental metric of software de-sign is that software should be chunked in elements of four (or fewer) after allowing for any number of varieties of analogies.
27
The Pirate Code “… more what you’d call ‘guidelines’ than actual rules” – Capt. Barbossa, Pirates of the Caribbean: The Curse of the Black Pearl
28
Overview Cognitive Psychology (Chunking and Memory) Analogies Psychologists Definition Code Structures Fundamental Metric Using the Cognitive Model
29
Can be taught using life experiences Is the foundation of software design principles Design principles still need to be learned! Use to discover new principles?
30
Conclusion Cognitive Psychology: Detailed the strong mapping between the cognitive model and design principles. Chunking Analogies: The two primary disciplines in good software design are: recognising & coding analogies chunking. Used these results to discover the “4 minus analogies” rule. tom@tom-mullen.com tom@tom-mullen.com Questions? http://www.chunkinganalogies.com http://www.chunkinganalogies.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.