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

Computer System Software Component Details.pptx
Computer System Software Component Details.pptxComputer System Software Component Details.pptx
Computer System Software Component Details.pptxRoshni814224
 
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
 

Ähnlich wie Literate Programming (20)

Computer System Software Component Details.pptx
Computer System Software Component Details.pptxComputer System Software Component Details.pptx
Computer System Software Component Details.pptx
 
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
 

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

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 

Kürzlich hochgeladen (20)

Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 

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/