Composing Code for Other People Tom Mullen - PowerPoint PPT Presentation

writing code for other people tom mullen l.
Skip this Video
Loading SlideShow in 5 Seconds..
Composing Code for Other People Tom Mullen PowerPoint Presentation
Composing Code for Other People Tom Mullen

play fullscreen
1 / 30
Download Presentation
lydia-olsen
Views
Download Presentation

Composing Code for Other People Tom Mullen

Presentation Transcript

  1. 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

  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 StructureDiscrimination 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 SoftwareAttribute Only [Map] • Map exchangeCountry = new HashMap(); • exchangeCountry.put("CBOT","US"); • exchangeCountry.put("LIFFE","England"); • Na Aa Nv Av

  19. Analogy Patterns in SoftwareStatement Shape • private 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 SoftwareMethod Name (Prefix) • public void visitExpression(Node a){}; • public void visitBlock(Node a){}; • public void visitFile(Node a){};

  22. Analogy Patterns in SoftwareApplication 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?

  25. 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.

  26. The Pirate Code • “… more what you’d call ‘guidelines’ than actual rules” • – Capt. Barbossa, Pirates of the Caribbean: The Curse of the Black Pearl

  27. Overview • Cognitive Psychology (Chunking and Memory) • Analogies • Psychologists Definition • Code Structures • Fundamental Metric • Using the Cognitive Model

  28. 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?

  29. 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