300 likes | 559 Views
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.
E N D
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... Writing Code for Other PeopleTom Mullen
Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model
Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model
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”
Chunking and Memory • STM Capacity Limit • CRC Model • Refactoring • STM Time Limit • Indirection cost
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).
Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model
Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model
Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model
Analogy Patterns in SoftwareAttribute Only [Map] • Map exchangeCountry = new HashMap(); • exchangeCountry.put("CBOT","US"); • exchangeCountry.put("LIFFE","England"); • Na Aa Nv Av
Analogy Patterns in SoftwareStatement Shape • private boolean isValid() • { • if (expirationDate== null || • !( expirationDate.getTime() > 0 ) ) • return false; • if (contractNumber == null || • !(contractNumber.longValue() > 0) ) • return false;
Analogy Patterns in SoftwareMethod Name (Prefix) • public void visitExpression(Node a){}; • public void visitBlock(Node a){}; • public void visitFile(Node a){};
Analogy Patterns in SoftwareApplication Level • Running Instances are Literal Similarities of one another. • Configuration details the attributes • IOC mechanisms allow operations
Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model
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?
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.
The Pirate Code • “… more what you’d call ‘guidelines’ than actual rules” • – Capt. Barbossa, Pirates of the Caribbean: The Curse of the Black Pearl
Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model
Using the Cognitive Model • 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?
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 Questions? http://www.chunkinganalogies.com