SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
<<LITERATE

PROGRAMMING>>
Charles Anderson
October 2016
MOTIVATION
Barney Stinson Motivational Quotes
MOTIVATION
• What does it mean to write a computer program?
• To produce a set of instructions for a computer
• Right?
MOTIVATION
• Who “reads” the program?
• The computer - duh
• Who really reads the program?
MOTIVATION
• Although we write programs to instruct
computers, people are the ones who spend the
most time reading programs.
• WORM - Write Once - Read Many
LITERATE PROGRAMMING
• “Instead of imagining that our main task is to
instruct a computer what to do, let us concentrate
rather on explaining to human beings what we
want the computer to do.” - Donald Knuth
LITERATE PROGRAMMING
• An approach to programming that enables the
programmer to develop and present programs
based on the logic on flow of his/her thoughts
• Rather than what the computer demands
• Writing an essay not a program
KEY FEATURE
• Re-ordering the code
• Write in the order of human logic, not the computer
• Top-down, bottom-up, whatever
• Work at the right level of abstraction at the right time - for the
human
• Focus on what’s important and defer other things (e.g., error
handling)
ANTI-EXAMPLE
Signal-to-noise ratio problem?
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("hello world");
}
}
JUST NOISE
$_="krJhruaesrltre c a cnP,ohet";$_.=$1,print$2while s/(..)(.)//;
• Being clever is rarely a good thing, especially for
the next Schmoe that comes along next - e.g,
FutureYou
LITERATE PROGRAMMING
• One source file with two languages:
• Programming language - e.g., Pascal
• Documentation language - e.g.,TeX
• The order is based on documentation - author’s
idea of how best to present the program
LITERATE PROGRAMMING
• Two tools to process the input
file(s):
• tangle - extract and reorder
program
• weave - extract
documentation - see example
LITERATE PROGRAMS
• Basic format is:
• document a bit -
• code a bit -
We must include the standard I/O
definitions, since we want to send
formatted output
to stdout and stderr.
<<Header files to include>>=
#include <stdio.h>
@
LITERATE PROGRAMS
• You can refer to a <<chunk of code>> any
time you like.
• No need to declare it
• Add to it
• Refer to its value even before defined
LITERATE PROGRAMS
Here, then, is an overview of the file wc.c
that is defined by the noweb program wc.nw:
<<*>>=
<<Header files to include>>
<<Definitions>>
<<Global variables>>
<<Functions>>
<<The main program>>
@
ONE WORD
mindovermunch.com
DISCUSSION
• Isn’t this just lots of comments? No
• Designed to be read and understood
• Not an afterthought - think before code
• We tried this with JavaDoc, and it failed. No
• “Comments lie” - Bob Martin. LP is still different
DISCUSSION
• Some of LP was driven by short-comings of Pascal
• OO improves things, but LP can still help
• AWS CloudFormation JSON
• LP is great for something you come back to
• If you inherit a legacy ball of mud
CONCLUSION
• Literate Programming is an interesting, powerful
idea that never quite caught on
• LPers not as bad as Forth programmers
• You might still want to check it out - e.g.,

http://www.literateprogramming.com/

Weitere ähnliche Inhalte

Andere mochten auch

某集团公司绩效考核制度
某集团公司绩效考核制度某集团公司绩效考核制度
某集团公司绩效考核制度20004
 
读懂人生的激励格言
读懂人生的激励格言读懂人生的激励格言
读懂人生的激励格言20004
 
《跟你的产品谈恋爱》
《跟你的产品谈恋爱》《跟你的产品谈恋爱》
《跟你的产品谈恋爱》20004
 
扮演称职的听讲人
扮演称职的听讲人扮演称职的听讲人
扮演称职的听讲人20004
 
积极的心态6
积极的心态6积极的心态6
积极的心态620004
 
从头开始
从头开始从头开始
从头开始20004
 
公司介绍
公司介绍公司介绍
公司介绍20004
 
8020法则.
8020法则.8020法则.
8020法则.20004
 
心态建设
心态建设心态建设
心态建设20004
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMCharles Anderson
 
光大银行西安分行培训计划
光大银行西安分行培训计划光大银行西安分行培训计划
光大银行西安分行培训计划20004
 
心态修炼
心态修炼心态修炼
心态修炼20004
 
研发中心08年度计划书打印版
研发中心08年度计划书打印版研发中心08年度计划书打印版
研发中心08年度计划书打印版20004
 
October 7 General Meeting
October 7 General MeetingOctober 7 General Meeting
October 7 General MeetingMSU PRSSA
 
积极的心态
积极的心态积极的心态
积极的心态20004
 
New era of stakeholder engagement
New era of stakeholder engagementNew era of stakeholder engagement
New era of stakeholder engagementBen Lowndes
 
海纳百川
海纳百川海纳百川
海纳百川20004
 

Andere mochten auch (20)

某集团公司绩效考核制度
某集团公司绩效考核制度某集团公司绩效考核制度
某集团公司绩效考核制度
 
读懂人生的激励格言
读懂人生的激励格言读懂人生的激励格言
读懂人生的激励格言
 
《跟你的产品谈恋爱》
《跟你的产品谈恋爱》《跟你的产品谈恋爱》
《跟你的产品谈恋爱》
 
扮演称职的听讲人
扮演称职的听讲人扮演称职的听讲人
扮演称职的听讲人
 
Psychotactics Uniqueness
Psychotactics UniquenessPsychotactics Uniqueness
Psychotactics Uniqueness
 
积极的心态6
积极的心态6积极的心态6
积极的心态6
 
从头开始
从头开始从头开始
从头开始
 
公司介绍
公司介绍公司介绍
公司介绍
 
8020法则.
8020法则.8020法则.
8020法则.
 
心态建设
心态建设心态建设
心态建设
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVM
 
3
33
3
 
光大银行西安分行培训计划
光大银行西安分行培训计划光大银行西安分行培训计划
光大银行西安分行培训计划
 
心态修炼
心态修炼心态修炼
心态修炼
 
2
22
2
 
研发中心08年度计划书打印版
研发中心08年度计划书打印版研发中心08年度计划书打印版
研发中心08年度计划书打印版
 
October 7 General Meeting
October 7 General MeetingOctober 7 General Meeting
October 7 General Meeting
 
积极的心态
积极的心态积极的心态
积极的心态
 
New era of stakeholder engagement
New era of stakeholder engagementNew era of stakeholder engagement
New era of stakeholder engagement
 
海纳百川
海纳百川海纳百川
海纳百川
 

Ähnlich wie Literate Programming

Unit 2 computer software
Unit 2 computer softwareUnit 2 computer software
Unit 2 computer softwareHardik Patel
 
If you want to automate, you learn to code
If you want to automate, you learn to codeIf you want to automate, you learn to code
If you want to automate, you learn to codeAlan Richardson
 
The Software Engineering Discipline and Evolution of S/W Engineering Methodol...
The Software Engineering Discipline and Evolution of S/W Engineering Methodol...The Software Engineering Discipline and Evolution of S/W Engineering Methodol...
The Software Engineering Discipline and Evolution of S/W Engineering Methodol...Santhia RK
 
Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...
Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...
Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...Lauri Eloranta
 
ProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdfProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdflailoesakhan
 
Software engineering 5 document outputs at various levels of waterfall model
Software engineering 5 document outputs at various levels of waterfall modelSoftware engineering 5 document outputs at various levels of waterfall model
Software engineering 5 document outputs at various levels of waterfall modelVaibhav Khanna
 
Bca i-fundamental of computer-u-2- application and system software
Bca  i-fundamental of  computer-u-2- application and system softwareBca  i-fundamental of  computer-u-2- application and system software
Bca i-fundamental of computer-u-2- application and system softwareRai University
 
Quiz managment system
Quiz managment systemQuiz managment system
Quiz managment systemtamourk2
 
Tech Stack Ideas
Tech Stack IdeasTech Stack Ideas
Tech Stack Ideasnsclark
 
Bba i-introduction to computer-u-2- application and system software
Bba  i-introduction to computer-u-2- application and system softwareBba  i-introduction to computer-u-2- application and system software
Bba i-introduction to computer-u-2- application and system softwareRai University
 
Mca i-fundamental of computer-u-2- application and system software
Mca  i-fundamental of  computer-u-2- application and system softwareMca  i-fundamental of  computer-u-2- application and system software
Mca i-fundamental of computer-u-2- application and system softwareRai University
 
Introduction to computers and programming languages
Introduction to computers and programming languages Introduction to computers and programming languages
Introduction to computers and programming languages binoysatheesh
 
Bsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system softwareBsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system softwareRai University
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programmingSangheethaa Sukumaran
 
Overview of Software Engineering Principles - SCPS311.pptx
Overview of Software Engineering Principles - SCPS311.pptxOverview of Software Engineering Principles - SCPS311.pptx
Overview of Software Engineering Principles - SCPS311.pptxBypassFrp
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 

Ähnlich wie Literate Programming (20)

lec 1.pptx
lec 1.pptxlec 1.pptx
lec 1.pptx
 
Unit 2 computer software
Unit 2 computer softwareUnit 2 computer software
Unit 2 computer software
 
If you want to automate, you learn to code
If you want to automate, you learn to codeIf you want to automate, you learn to code
If you want to automate, you learn to code
 
The Software Engineering Discipline and Evolution of S/W Engineering Methodol...
The Software Engineering Discipline and Evolution of S/W Engineering Methodol...The Software Engineering Discipline and Evolution of S/W Engineering Methodol...
The Software Engineering Discipline and Evolution of S/W Engineering Methodol...
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
 
Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...
Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...
Basics of Computation and Modeling - Lecture 2 in Introduction to Computation...
 
ProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdfProgFund_Lecture_1_Introduction_to_Programming.pdf
ProgFund_Lecture_1_Introduction_to_Programming.pdf
 
Software engineering 5 document outputs at various levels of waterfall model
Software engineering 5 document outputs at various levels of waterfall modelSoftware engineering 5 document outputs at various levels of waterfall model
Software engineering 5 document outputs at various levels of waterfall model
 
Chapter 1 - Prog101.ppt
Chapter 1 - Prog101.pptChapter 1 - Prog101.ppt
Chapter 1 - Prog101.ppt
 
Bca i-fundamental of computer-u-2- application and system software
Bca  i-fundamental of  computer-u-2- application and system softwareBca  i-fundamental of  computer-u-2- application and system software
Bca i-fundamental of computer-u-2- application and system software
 
Quiz managment system
Quiz managment systemQuiz managment system
Quiz managment system
 
Tech Stack Ideas
Tech Stack IdeasTech Stack Ideas
Tech Stack Ideas
 
Bba i-introduction to computer-u-2- application and system software
Bba  i-introduction to computer-u-2- application and system softwareBba  i-introduction to computer-u-2- application and system software
Bba i-introduction to computer-u-2- application and system software
 
Mca i-fundamental of computer-u-2- application and system software
Mca  i-fundamental of  computer-u-2- application and system softwareMca  i-fundamental of  computer-u-2- application and system software
Mca i-fundamental of computer-u-2- application and system software
 
Introduction to computers and programming languages
Introduction to computers and programming languages Introduction to computers and programming languages
Introduction to computers and programming languages
 
Bsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system softwareBsc cs 1 fit u-2 application and system software
Bsc cs 1 fit u-2 application and system software
 
From 1 to 100
From 1 to 100From 1 to 100
From 1 to 100
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 
Overview of Software Engineering Principles - SCPS311.pptx
Overview of Software Engineering Principles - SCPS311.pptxOverview of Software Engineering Principles - SCPS311.pptx
Overview of Software Engineering Principles - SCPS311.pptx
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 

Mehr von Charles Anderson

How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceCharles Anderson
 
Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Charles Anderson
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to RedisCharles Anderson
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceCharles Anderson
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineCharles Anderson
 
Jython: Integrating Python and Java
Jython: Integrating Python and JavaJython: Integrating Python and Java
Jython: Integrating Python and JavaCharles Anderson
 

Mehr von Charles Anderson (8)

Modern php
Modern phpModern php
Modern php
 
Inrastructure as Code
Inrastructure as CodeInrastructure as Code
Inrastructure as Code
 
How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o Experience
 
Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to Redis
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o Experience
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer Online
 
Jython: Integrating Python and Java
Jython: Integrating Python and JavaJython: Integrating Python and Java
Jython: Integrating Python and Java
 

Kürzlich hochgeladen

How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?AmeliaSmith90
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageDista
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.Sharon Liu
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native BuildpacksVish Abrams
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilVICTOR MAESTRE RAMIREZ
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024Mind IT Systems
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptkinjal48
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmonyelliciumsolutionspun
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampVICTOR MAESTRE RAMIREZ
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfBrain Inventory
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesShyamsundar Das
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxJoão Esperancinha
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Jaydeep Chhasatia
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIIvo Andreev
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfTobias Schneck
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsJaydeep Chhasatia
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesSoftwareMill
 
ERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptxERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptxAutus Cyber Tech
 

Kürzlich hochgeladen (20)

How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?How Does the Epitome of Spyware Differ from Other Malicious Software?
How Does the Epitome of Spyware Differ from Other Malicious Software?
 
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales CoverageSales Territory Management: A Definitive Guide to Expand Sales Coverage
Sales Territory Management: A Definitive Guide to Expand Sales Coverage
 
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
20240319 Car Simulator Plan.pptx . Plan for a JavaScript Car Driving Simulator.
 
Streamlining Your Application Builds with Cloud Native Buildpacks
Streamlining Your Application Builds  with Cloud Native BuildpacksStreamlining Your Application Builds  with Cloud Native Buildpacks
Streamlining Your Application Builds with Cloud Native Buildpacks
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Generative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-CouncilGenerative AI for Cybersecurity - EC-Council
Generative AI for Cybersecurity - EC-Council
 
Salesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptxSalesforce AI Associate Certification.pptx
Salesforce AI Associate Certification.pptx
 
Top Software Development Trends in 2024
Top Software Development Trends in  2024Top Software Development Trends in  2024
Top Software Development Trends in 2024
 
Webinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.pptWebinar_050417_LeClair12345666777889.ppt
Webinar_050417_LeClair12345666777889.ppt
 
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine HarmonyLeveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
Leveraging DxSherpa's Generative AI Services to Unlock Human-Machine Harmony
 
Deep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - DatacampDeep Learning for Images with PyTorch - Datacamp
Deep Learning for Images with PyTorch - Datacamp
 
Why Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdfWhy Choose Brain Inventory For Ecommerce Development.pdf
Why Choose Brain Inventory For Ecommerce Development.pdf
 
Watermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security ChallengesWatermarking in Source Code: Applications and Security Challenges
Watermarking in Source Code: Applications and Security Challenges
 
Fields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptxFields in Java and Kotlin and what to expect.pptx
Fields in Java and Kotlin and what to expect.pptx
 
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
Optimizing Business Potential: A Guide to Outsourcing Engineering Services in...
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdfARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
ARM Talk @ Rejekts - Will ARM be the new Mainstream in our Data Centers_.pdf
 
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software TeamsYour Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
Your Vision, Our Expertise: TECUNIQUE's Tailored Software Teams
 
Growing Oxen: channel operators and retries
Growing Oxen: channel operators and retriesGrowing Oxen: channel operators and retries
Growing Oxen: channel operators and retries
 
ERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptxERP For Electrical and Electronics manufecturing.pptx
ERP For Electrical and Electronics manufecturing.pptx
 

Literate Programming

  • 3. MOTIVATION • What does it mean to write a computer program? • To produce a set of instructions for a computer • Right?
  • 4. MOTIVATION • Who “reads” the program? • The computer - duh • Who really reads the program?
  • 5. MOTIVATION • Although we write programs to instruct computers, people are the ones who spend the most time reading programs. • WORM - Write Once - Read Many
  • 6. LITERATE PROGRAMMING • “Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want the computer to do.” - Donald Knuth
  • 7. LITERATE PROGRAMMING • An approach to programming that enables the programmer to develop and present programs based on the logic on flow of his/her thoughts • Rather than what the computer demands • Writing an essay not a program
  • 8. KEY FEATURE • Re-ordering the code • Write in the order of human logic, not the computer • Top-down, bottom-up, whatever • Work at the right level of abstraction at the right time - for the human • Focus on what’s important and defer other things (e.g., error handling)
  • 9. ANTI-EXAMPLE Signal-to-noise ratio problem? public class HelloWorld { public static void main(String[] args) { System.out.println("hello world"); } }
  • 10. JUST NOISE $_="krJhruaesrltre c a cnP,ohet";$_.=$1,print$2while s/(..)(.)//; • Being clever is rarely a good thing, especially for the next Schmoe that comes along next - e.g, FutureYou
  • 11. LITERATE PROGRAMMING • One source file with two languages: • Programming language - e.g., Pascal • Documentation language - e.g.,TeX • The order is based on documentation - author’s idea of how best to present the program
  • 12. LITERATE PROGRAMMING • Two tools to process the input file(s): • tangle - extract and reorder program • weave - extract documentation - see example
  • 13. LITERATE PROGRAMS • Basic format is: • document a bit - • code a bit - We must include the standard I/O definitions, since we want to send formatted output to stdout and stderr. <<Header files to include>>= #include <stdio.h> @
  • 14. LITERATE PROGRAMS • You can refer to a <<chunk of code>> any time you like. • No need to declare it • Add to it • Refer to its value even before defined
  • 15. LITERATE PROGRAMS Here, then, is an overview of the file wc.c that is defined by the noweb program wc.nw: <<*>>= <<Header files to include>> <<Definitions>> <<Global variables>> <<Functions>> <<The main program>> @
  • 17. DISCUSSION • Isn’t this just lots of comments? No • Designed to be read and understood • Not an afterthought - think before code • We tried this with JavaDoc, and it failed. No • “Comments lie” - Bob Martin. LP is still different
  • 18. DISCUSSION • Some of LP was driven by short-comings of Pascal • OO improves things, but LP can still help • AWS CloudFormation JSON • LP is great for something you come back to • If you inherit a legacy ball of mud
  • 19. CONCLUSION • Literate Programming is an interesting, powerful idea that never quite caught on • LPers not as bad as Forth programmers • You might still want to check it out - e.g.,
 http://www.literateprogramming.com/