SlideShare une entreprise Scribd logo
1  sur  40
Télécharger pour lire hors ligne
Andreas Zeller • 36th IEEE/ACM International Conference on Automated Software Engineering (ASE 2021) • November 17, 2021
Illustrated Code
Building Software in a Literate Way
Jupyter Notebooks
Diagrams
Text
Code
Authoring with Notebooks
Literate Programming
Outputs and Examples Quizzes
Markdown, LaTeX, HTML, JS
Rich Outputs
Demo
Academic Prototyping
By Max-Planck-Institut für Plasmaphysik, Tino Schulz - Public Relations Department, Max-Planck-Institut, CC BY-SA 3.0
Is this a general model for coding?
Code Knowledge
Implementation
Code
fi
le
Rationales
Comments
History
Architecture
Documentation
Tests
Test code
Test document Interface
Reference document
Code
Tutorials
Tutorials
Textbook
Specification
Documentation
How do I keep these consistent?
How do I obtain these in the
fi
rst place?
Q&A
Stack Over
fl
ow
FAQ
One

Document
Illustrated Code
Rationales
Comments
History
Architecture
Documentation
Tests
Test code
Test document Interface
Reference document
Code
Q&A
Stack Over
fl
ow
FAQ
Tutorials
Tutorials
Textbook
Specification
Documentation
Implementation
Code
fi
le
One

Document
Illustrated Code
Architecture
Documentation
Interface
Reference document
Code
Tutorials
Tutorials
Textbook
Specification
Documentation
Rationales
Comments
History
Q&A
Stack Over
fl
ow
FAQ
Implementation
Code
fi
le
Tests
Test code
Test document
Illustrated Code
Everything in One Place
in documents that are executable •

self-updating • self-checking
One

Document
Rationales
Architecture
Tests
Interface
Q&A
Tutorials
Specification
Implementation
A Case Study
De
fi
ne a function
middle(x, y, z) that
returns the "middle" of
three integers x, y, and z – 

i.e. the one that is neither
the maximum nor the
minimum of the three.
One

Document
Architecture
Tests
Interface
Tutorials
Specification
Rationales Q&A
Implementation
Interface
How do I use the code?
• Standard way of documenting things

• No formal spec (what is "the middle" here?); no context; no rationale

• No usage example

• No implementation (yet)
Let us de
fi
ne an interface for middle():
Specification
What should the code do?
Let us formally specify what middle() should do:
This speci
fi
cation is executable, so we can easily include examples:
Or just write the examples as assertions, so we can use them as tests later:
Specification
What should the code do?
Our speci
fi
cation document can contain all sorts of diagrams and more
```mermaid


sequenceDiagram


Client->>+Server: middle(5, 4, 7)


Server-->>-Client: 5


```
(I get this through three Markdown lines)
Implementation
How does it work?
Let us now provide an e
ffi
cient implementation for middle():
Once written, this is executable:
Tests and results become part of the doc!
Rationales
Why is the code as it is?
Why do we implement middle() again, rather than using middle_spec()?

Because middle() is twice as fast.
The document can also discuss and evaluate more alternatives,

reproducing the thoughts and experiments of the original programmer
Rationales
Why is the code as it is?
The document can include all these experiments and their results as a rationale:
(experiment details go here)
We can have the document check automatically whether the rationale holds:
This ensures consistency between text and code.
Tests
What does the code guarantee?
Tests can be written as additional examples on how the code should work:
If a test fails, that's the same as an example failing. (And examples act as tests.)
Tests
What does the code guarantee?
One can analyze (and report) test performance, again in the document:
Assumptions about coverage can be made in
the document, too
Tests
What does the code guarantee?
One can check against the spec, again in the document:
All these tests can be run (and debugged) right from the document.
Tests
What does the code guarantee?
One can also include static checks or symbolic veri
fi
cation:
← and actually prove correctness
Architecture
How is the code organized?
We can extract architecture diagrams from code, keeping it up to date
Architecture
How is the code organized?
We can extract dynamic
diagrams from executions:
We can even compare these
diagrams against the spec
and
fi
nd mismatches!
Tutorials
How can I use or extend this?
The document can contain instructions on how to run things:
(Of course, these would be executable too, testing the tutorial)
Q&A
Where can I ask a question?
The document can contain sections with questions and answers:
These would be managed by the public, and continuously ensure consistency
(Thanks to Greg Wilson for this idea!)
Illustrated Code
• Have all in one document

• Use rich documentation

• Make things computable
• Make things checkable
‣ Fun to read; fun to write
‣ Always up to date
‣ Exploit synergies
Everything in One Place
One

Document
Rationales
Comments
History
Architecture
Documentation
Tests
Test code
Test document Interface
Reference document
Code
Q&A
Stack Over
fl
ow
FAQ
Tutorials
Tutorials
Textbook
Specification
Documentation
Implementation
Code
fi
le
Demo
Alternatives
Literate Programming
Donald J. Knuth, 1984
+ Rich documentation (TEX)

+ Web structure
- No examples

- No output

- No tests

- Not interactive
Rich Comments
Python Source Code, ~2010
+ Rich documentation

(Markdown)

+ Edit as code
+ Tests
- All text

- Examples written from hand

- Output written from hand

- Not interactive

- No tutorial
Nbdev
Library for Python Projects using Jupyter Notebooks, 2020
+ Rich documentation

(Markdown + HTML)

+ Edit as notebook

+ Edit as code

+ Integrated tests
- No writing philosophy

- Python-speci
fi
c
Agenda
Notebooks
• As of now, Notebooks (Jupyter) are still inadequate as an IDE

• Want refactorings, search + replace, code completion, links

• Want the document organized as a tree rather than linearly

• Want local executions that do not a
ff
ect global state

• Need modularity and reuse across notebooks

• Python is not perfect for programming in the very large
are not the Answer
Integrated Development Environments
• Today's development environments are all typewriter-centric

• Want rich documentation, interactivity, examples, tutorials…

• Want documents that capture all code aspects consistently,
rather than a dozen fragments
are not the Answer
Illustrated Code
An Agenda
➡ Give IDEs the power of rich documentation

➡ Give Notebooks the powers of IDEs – refactoring, search, etc.

➡ Have Notebook support C, C++, Java, Rust, Go, Scala…

➡ Make Notebooks first-class citizens (e.g., import/include them)

➡ Make Notebooks collaborative with Q&As (a la StackOverflow)

➡ Make tutorials, illustrations, examples a part of standard coding

➡ Do more research on what makes notebooks special/successful
Illustrated Code
An Agenda
➡ Give IDEs the power of rich documentation

➡ Give Notebooks the powers of IDEs – refactoring, search, etc.

➡ Have Notebook support C, C++, Java, Rust, Go, Scala…

➡ Make Notebooks first-class citizens (e.g., import/include them)

➡ Make Notebooks collaborative with Q&As (a la StackOverflow)

➡ Make tutorials, illustrations, examples a part of standard coding

➡ Do more research on what makes notebooks special/successful
Andreas Zeller
Illustrated Code
Building Software that Lasts
Rich Documents
Code Knowledge
Implementation
Code file
Rationales
Comments
History
Architecture
Documentation
Tests
Test code
Test document Interface
Reference document
Code
Tutorials
Tutorials
Textbook
Specification
Documentation
How do I keep these consistent?
How do I obtain these in the first place?
Q&A
Stack Overflow
FAQ
Illustrated Code
Everything in One Place
in documents that are executable •

self-updating • self-checking
One

Document
Rationales
Architecture
Tests
Interface
Q&A
Tutorials
Specification
Implementation
@AndreasZeller

Contenu connexe

Tendances

Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
Jeremy Kendall
 

Tendances (20)

Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy Code
 
C++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of ClassC++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of Class
 
Are Agile Projects Doomed to Half-Baked Design?
Are Agile Projects Doomed to Half-Baked Design?Are Agile Projects Doomed to Half-Baked Design?
Are Agile Projects Doomed to Half-Baked Design?
 
DevOps - Boldly Go for Distro
DevOps - Boldly Go for DistroDevOps - Boldly Go for Distro
DevOps - Boldly Go for Distro
 
Common Technical Writing Issues
Common Technical Writing IssuesCommon Technical Writing Issues
Common Technical Writing Issues
 
Transferring Software Testing Tools to Practice
Transferring Software Testing Tools to PracticeTransferring Software Testing Tools to Practice
Transferring Software Testing Tools to Practice
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
From monitoring to automated testing, Jesse Reynolds, Puppet
From monitoring to automated testing, Jesse Reynolds, PuppetFrom monitoring to automated testing, Jesse Reynolds, Puppet
From monitoring to automated testing, Jesse Reynolds, Puppet
 
Dependency Injection in iOS
Dependency Injection in iOSDependency Injection in iOS
Dependency Injection in iOS
 
Agile Programming Systems # TDD intro
Agile Programming Systems # TDD introAgile Programming Systems # TDD intro
Agile Programming Systems # TDD intro
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010Test Driven Development (TDD) Preso 360|Flex 2010
Test Driven Development (TDD) Preso 360|Flex 2010
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
Tdd in php a brief example
Tdd in php   a brief exampleTdd in php   a brief example
Tdd in php a brief example
 
Loopt unit test experiences
Loopt unit test experiencesLoopt unit test experiences
Loopt unit test experiences
 
2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier2016 10-04: tdd++: tdd made easier
2016 10-04: tdd++: tdd made easier
 
Common Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOSCommon Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOS
 
Getting started with Test Driven Development
Getting started with Test Driven DevelopmentGetting started with Test Driven Development
Getting started with Test Driven Development
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
 

Similaire à Illustrated Code (ASE 2021)

Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12
Enkitec
 
OSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine LearningOSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine Learning
Paco Nathan
 

Similaire à Illustrated Code (ASE 2021) (20)

01.intro
01.intro01.intro
01.intro
 
Documenting Code - Patterns and Anti-patterns - NLPW 2016
Documenting Code - Patterns and Anti-patterns - NLPW 2016Documenting Code - Patterns and Anti-patterns - NLPW 2016
Documenting Code - Patterns and Anti-patterns - NLPW 2016
 
Test-Driven Development in the Corporate Workplace
Test-Driven Development in the Corporate WorkplaceTest-Driven Development in the Corporate Workplace
Test-Driven Development in the Corporate Workplace
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your Code
 
Documenting code yapceu2016
Documenting code yapceu2016Documenting code yapceu2016
Documenting code yapceu2016
 
Test team dynamics, Антон Мужайло
Test team dynamics, Антон МужайлоTest team dynamics, Антон Мужайло
Test team dynamics, Антон Мужайло
 
Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...
Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...
Do Your Homework! Writing tests for Data Science and Stochastic Code - David ...
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
Rsqrd AI: ML Tooling at an AI-first Startup
Rsqrd AI: ML Tooling at an AI-first StartupRsqrd AI: ML Tooling at an AI-first Startup
Rsqrd AI: ML Tooling at an AI-first Startup
 
T4 presentation
T4 presentationT4 presentation
T4 presentation
 
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
APIs And SDKs  Breaking Into And Succeeding In A Specialty MarketAPIs And SDKs  Breaking Into And Succeeding In A Specialty Market
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
 
Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12Kelly potvin nosurprises_odtug_oow12
Kelly potvin nosurprises_odtug_oow12
 
The Nuxeo Way: leveraging open source to build a world-class ECM platform
The Nuxeo Way: leveraging open source to build a world-class ECM platformThe Nuxeo Way: leveraging open source to build a world-class ECM platform
The Nuxeo Way: leveraging open source to build a world-class ECM platform
 
OSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine LearningOSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine Learning
 
Docs as-code-missing.-manual
Docs as-code-missing.-manualDocs as-code-missing.-manual
Docs as-code-missing.-manual
 
Azure DevOps for Developers
Azure DevOps for DevelopersAzure DevOps for Developers
Azure DevOps for Developers
 
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
Simon Brown: Software Architecture as Code at I T.A.K.E. Unconference 2015
 
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual StudioSPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
SPCA2013 - Test-driven Development with SharePoint 2013 and Visual Studio
 
Reproducible research concepts and tools
Reproducible research concepts and toolsReproducible research concepts and tools
Reproducible research concepts and tools
 

Plus de CISPA Helmholtz Center for Information Security

Language-Based Testing and Debugging.pdf
Language-Based Testing and Debugging.pdfLanguage-Based Testing and Debugging.pdf
Language-Based Testing and Debugging.pdf
CISPA Helmholtz Center for Information Security
 
Fuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two CulturesFuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two Cultures
CISPA Helmholtz Center for Information Security
 
Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...
Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...
Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...
CISPA Helmholtz Center for Information Security
 
Seeding Bugs To Find Bugs
Seeding Bugs To Find BugsSeeding Bugs To Find Bugs

Plus de CISPA Helmholtz Center for Information Security (18)

Language-Based Testing and Debugging.pdf
Language-Based Testing and Debugging.pdfLanguage-Based Testing and Debugging.pdf
Language-Based Testing and Debugging.pdf
 
Digital Networking and Community
Digital Networking and CommunityDigital Networking and Community
Digital Networking and Community
 
Fuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two CulturesFuzzing - A Tale of Two Cultures
Fuzzing - A Tale of Two Cultures
 
On Impact in Software Engineering Research (HU Berlin 2021)
On Impact in Software Engineering Research (HU Berlin 2021)On Impact in Software Engineering Research (HU Berlin 2021)
On Impact in Software Engineering Research (HU Berlin 2021)
 
On Impact in Software Engineering Research (Dagstuhl 2020)
On Impact in Software Engineering Research (Dagstuhl 2020)On Impact in Software Engineering Research (Dagstuhl 2020)
On Impact in Software Engineering Research (Dagstuhl 2020)
 
Fast and Effective Fuzz Testing (Facebook TAV 2019)
Fast and Effective Fuzz Testing (Facebook TAV 2019)Fast and Effective Fuzz Testing (Facebook TAV 2019)
Fast and Effective Fuzz Testing (Facebook TAV 2019)
 
Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...
Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...
Software-Tests automatisch erzeugen: Frische Ansätze für Forschung, Praxis un...
 
On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)
On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)
On impact in Software Engineering Research (ICSE 2018 New Faculty Symposium)
 
On Impact in Software Engineering Research
On Impact in Software Engineering ResearchOn Impact in Software Engineering Research
On Impact in Software Engineering Research
 
Twelve tips on how to prepare an ERC grant proposal
Twelve tips on how to prepare an ERC grant proposalTwelve tips on how to prepare an ERC grant proposal
Twelve tips on how to prepare an ERC grant proposal
 
Getting your work funded
Getting your work fundedGetting your work funded
Getting your work funded
 
Learning from 6,000 projects mining specifications in the large
Learning from 6,000 projects   mining specifications in the largeLearning from 6,000 projects   mining specifications in the large
Learning from 6,000 projects mining specifications in the large
 
Debugging Debugging
Debugging DebuggingDebugging Debugging
Debugging Debugging
 
Seeding Bugs To Find Bugs
Seeding Bugs To Find BugsSeeding Bugs To Find Bugs
Seeding Bugs To Find Bugs
 
Mining Processes
Mining ProcessesMining Processes
Mining Processes
 
Mining Programs
Mining ProgramsMining Programs
Mining Programs
 
Getting your paper accepted (at ISSTA 2008)
Getting your paper accepted (at ISSTA 2008)Getting your paper accepted (at ISSTA 2008)
Getting your paper accepted (at ISSTA 2008)
 
Woher kommen Software-Fehler?
Woher kommen Software-Fehler?Woher kommen Software-Fehler?
Woher kommen Software-Fehler?
 

Dernier

LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.
Silpa
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
Silpa
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
levieagacer
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
seri bangash
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virus
NazaninKarimi6
 
Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.
Silpa
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
Silpa
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Sérgio Sacani
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
ANSARKHAN96
 

Dernier (20)

LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.LUNULARIA -features, morphology, anatomy ,reproduction etc.
LUNULARIA -features, morphology, anatomy ,reproduction etc.
 
Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.Porella : features, morphology, anatomy, reproduction etc.
Porella : features, morphology, anatomy, reproduction etc.
 
FAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical ScienceFAIRSpectra - Enabling the FAIRification of Analytical Science
FAIRSpectra - Enabling the FAIRification of Analytical Science
 
Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.Atp synthase , Atp synthase complex 1 to 4.
Atp synthase , Atp synthase complex 1 to 4.
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
module for grade 9 for distance learning
module for grade 9 for distance learningmodule for grade 9 for distance learning
module for grade 9 for distance learning
 
Factory Acceptance Test( FAT).pptx .
Factory Acceptance Test( FAT).pptx       .Factory Acceptance Test( FAT).pptx       .
Factory Acceptance Test( FAT).pptx .
 
The Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptxThe Mariana Trench remarkable geological features on Earth.pptx
The Mariana Trench remarkable geological features on Earth.pptx
 
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body GBSN - Microbiology (Unit 3)Defense Mechanism of the body
GBSN - Microbiology (Unit 3)Defense Mechanism of the body
 
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
GBSN - Biochemistry (Unit 2) Basic concept of organic chemistry
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virus
 
Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.Phenolics: types, biosynthesis and functions.
Phenolics: types, biosynthesis and functions.
 
POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.POGONATUM : morphology, anatomy, reproduction etc.
POGONATUM : morphology, anatomy, reproduction etc.
 
Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.Selaginella: features, morphology ,anatomy and reproduction.
Selaginella: features, morphology ,anatomy and reproduction.
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Grade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its FunctionsGrade 7 - Lesson 1 - Microscope and Its Functions
Grade 7 - Lesson 1 - Microscope and Its Functions
 
Genetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditionsGenetics and epigenetics of ADHD and comorbid conditions
Genetics and epigenetics of ADHD and comorbid conditions
 
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 bAsymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
Asymmetry in the atmosphere of the ultra-hot Jupiter WASP-76 b
 
PATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICE
PATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICEPATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICE
PATNA CALL GIRLS 8617370543 LOW PRICE ESCORT SERVICE
 
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptxTHE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
THE ROLE OF BIOTECHNOLOGY IN THE ECONOMIC UPLIFT.pptx
 

Illustrated Code (ASE 2021)

  • 1. Andreas Zeller • 36th IEEE/ACM International Conference on Automated Software Engineering (ASE 2021) • November 17, 2021 Illustrated Code Building Software in a Literate Way
  • 2.
  • 3.
  • 4.
  • 6. Authoring with Notebooks Literate Programming Outputs and Examples Quizzes Markdown, LaTeX, HTML, JS
  • 9. Academic Prototyping By Max-Planck-Institut für Plasmaphysik, Tino Schulz - Public Relations Department, Max-Planck-Institut, CC BY-SA 3.0
  • 10. Is this a general model for coding?
  • 11. Code Knowledge Implementation Code fi le Rationales Comments History Architecture Documentation Tests Test code Test document Interface Reference document Code Tutorials Tutorials Textbook Specification Documentation How do I keep these consistent? How do I obtain these in the fi rst place? Q&A Stack Over fl ow FAQ
  • 12. One
 Document Illustrated Code Rationales Comments History Architecture Documentation Tests Test code Test document Interface Reference document Code Q&A Stack Over fl ow FAQ Tutorials Tutorials Textbook Specification Documentation Implementation Code fi le
  • 14. Illustrated Code Everything in One Place in documents that are executable •
 self-updating • self-checking One
 Document Rationales Architecture Tests Interface Q&A Tutorials Specification Implementation
  • 15. A Case Study De fi ne a function middle(x, y, z) that returns the "middle" of three integers x, y, and z – 
 i.e. the one that is neither the maximum nor the minimum of the three. One
 Document Architecture Tests Interface Tutorials Specification Rationales Q&A Implementation
  • 16. Interface How do I use the code? • Standard way of documenting things • No formal spec (what is "the middle" here?); no context; no rationale • No usage example • No implementation (yet) Let us de fi ne an interface for middle():
  • 17. Specification What should the code do? Let us formally specify what middle() should do: This speci fi cation is executable, so we can easily include examples: Or just write the examples as assertions, so we can use them as tests later:
  • 18. Specification What should the code do? Our speci fi cation document can contain all sorts of diagrams and more ```mermaid sequenceDiagram Client->>+Server: middle(5, 4, 7) Server-->>-Client: 5 ``` (I get this through three Markdown lines)
  • 19. Implementation How does it work? Let us now provide an e ffi cient implementation for middle(): Once written, this is executable: Tests and results become part of the doc!
  • 20. Rationales Why is the code as it is? Why do we implement middle() again, rather than using middle_spec()?
 Because middle() is twice as fast. The document can also discuss and evaluate more alternatives,
 reproducing the thoughts and experiments of the original programmer
  • 21. Rationales Why is the code as it is? The document can include all these experiments and their results as a rationale: (experiment details go here) We can have the document check automatically whether the rationale holds: This ensures consistency between text and code.
  • 22. Tests What does the code guarantee? Tests can be written as additional examples on how the code should work: If a test fails, that's the same as an example failing. (And examples act as tests.)
  • 23. Tests What does the code guarantee? One can analyze (and report) test performance, again in the document: Assumptions about coverage can be made in the document, too
  • 24. Tests What does the code guarantee? One can check against the spec, again in the document: All these tests can be run (and debugged) right from the document.
  • 25. Tests What does the code guarantee? One can also include static checks or symbolic veri fi cation: ← and actually prove correctness
  • 26. Architecture How is the code organized? We can extract architecture diagrams from code, keeping it up to date
  • 27. Architecture How is the code organized? We can extract dynamic diagrams from executions: We can even compare these diagrams against the spec and fi nd mismatches!
  • 28. Tutorials How can I use or extend this? The document can contain instructions on how to run things: (Of course, these would be executable too, testing the tutorial)
  • 29. Q&A Where can I ask a question? The document can contain sections with questions and answers: These would be managed by the public, and continuously ensure consistency (Thanks to Greg Wilson for this idea!)
  • 30. Illustrated Code • Have all in one document • Use rich documentation • Make things computable • Make things checkable ‣ Fun to read; fun to write ‣ Always up to date ‣ Exploit synergies Everything in One Place One
 Document Rationales Comments History Architecture Documentation Tests Test code Test document Interface Reference document Code Q&A Stack Over fl ow FAQ Tutorials Tutorials Textbook Specification Documentation Implementation Code fi le
  • 31. Demo
  • 33. Literate Programming Donald J. Knuth, 1984 + Rich documentation (TEX) + Web structure - No examples - No output - No tests - Not interactive
  • 34. Rich Comments Python Source Code, ~2010 + Rich documentation
 (Markdown) + Edit as code + Tests - All text - Examples written from hand - Output written from hand - Not interactive - No tutorial
  • 35. Nbdev Library for Python Projects using Jupyter Notebooks, 2020 + Rich documentation
 (Markdown + HTML) + Edit as notebook + Edit as code + Integrated tests - No writing philosophy - Python-speci fi c
  • 37. Notebooks • As of now, Notebooks (Jupyter) are still inadequate as an IDE • Want refactorings, search + replace, code completion, links • Want the document organized as a tree rather than linearly • Want local executions that do not a ff ect global state • Need modularity and reuse across notebooks • Python is not perfect for programming in the very large are not the Answer
  • 38. Integrated Development Environments • Today's development environments are all typewriter-centric • Want rich documentation, interactivity, examples, tutorials… • Want documents that capture all code aspects consistently, rather than a dozen fragments are not the Answer
  • 39. Illustrated Code An Agenda ➡ Give IDEs the power of rich documentation ➡ Give Notebooks the powers of IDEs – refactoring, search, etc. ➡ Have Notebook support C, C++, Java, Rust, Go, Scala… ➡ Make Notebooks first-class citizens (e.g., import/include them) ➡ Make Notebooks collaborative with Q&As (a la StackOverflow) ➡ Make tutorials, illustrations, examples a part of standard coding ➡ Do more research on what makes notebooks special/successful
  • 40. Illustrated Code An Agenda ➡ Give IDEs the power of rich documentation ➡ Give Notebooks the powers of IDEs – refactoring, search, etc. ➡ Have Notebook support C, C++, Java, Rust, Go, Scala… ➡ Make Notebooks first-class citizens (e.g., import/include them) ➡ Make Notebooks collaborative with Q&As (a la StackOverflow) ➡ Make tutorials, illustrations, examples a part of standard coding ➡ Do more research on what makes notebooks special/successful Andreas Zeller Illustrated Code Building Software that Lasts Rich Documents Code Knowledge Implementation Code file Rationales Comments History Architecture Documentation Tests Test code Test document Interface Reference document Code Tutorials Tutorials Textbook Specification Documentation How do I keep these consistent? How do I obtain these in the first place? Q&A Stack Overflow FAQ Illustrated Code Everything in One Place in documents that are executable •
 self-updating • self-checking One
 Document Rationales Architecture Tests Interface Q&A Tutorials Specification Implementation @AndreasZeller