Researching making programs and systems that are introspectable. That is, programs that know what they are and how they work, and provide facilities for viewing, extracting and querying this information.
And with these capabilities in place, how can we represent problems & solutions in a better way. Can we make programs more understandable, faster to get to a useful level, and more robust? Can we use these properties to make programming more widely applicable and accessible, also as a tool outside software development?
Note that this is a broader use of the word 'introspection' compared to typically in programming, which usually is limited to very primitive information, like types.
There are 3 primary motivations for this work. From most concrete to most speculative:
- Increasing the ability of experienced programmers to reason about non-trivial systems, and write more advanced and robust software.
- Helping blur the lines between 'programmers' and 'non-programmers' (domain experts, interested users), by making the system more inviting and self-describing.
- Open up the possibility for self-governing systems and intelligent agents. Where the entity using the introspection information is another program, instead of a human.
Some of the areas I have done work in, or think could be fruitful to research. Most are prototyped in JavaScript/CoffeeScript and can be run in webbrowser + Node.js, but often having a component of C/C++ and low-level/hardware/electronics component too it.
In rough order of time spent / maturity.
- Dataflow/flow-based-programming Flowhub + MicroFlo
- Design by Contract / Contracts Programming: Agree.js
- Finite State Automata/Machines: Finito
- Equations & "spreadsheets": Formulate
- Constraint Satisfaction: 1
- Promises incl chains/composition
- Functional programming/composition
- Behavioral trees
- Decision trees
Combinations would make sense.
- dhang. MIDI controller / input device. Using recorded sensor data and simulation to determine triggering logic, make software and hardware improvements.
- rebirth. Visual interactive sculpture. Using simulation of time-series to see animations of LED color.
- syncrony. How simulation and visual programming can help experiment in order to create interesting interactive art quicker.
- microfridge. Home electronics, control systems. Multi-level access, ending with full reprogrammability.
- guv Automatic scaling of servers in cloud-environment. Focus on tools for understanding config of a dynamic system reflecting changing world conditions.
Opinions that I bring to the table in relation to this work.
- Live programming
- Polyglot programming
- Static or quasi-static verification
- Model-based programming
- Self-documenting
- Behavior testing over unit-testing
- Data-driven and generative tests
- Integrated testing
Logic programming
- miniKamren is a embedded logic programming DSL, that for instance powers Clojure
core.logic
. veneer looks to be the only maintained JavaScript/browser version, but microScopeKamren has the explicit focus "inspecting logic programs as they run".
Pattern-matching programming
- Senenca.js, async-first pattern-matching library for Node.js microservices
- Eve, pattern-matching on records as a general purpose computational model.
Research
- metamodels for structured interaction with machine intelligence. Many good references to work on interactive machine learning, and end-user programming/debugging. No sure I buy premise of 'goal being ill-defined'.
Presentations
... The reason programming is so hard is because it is unobservable In Search of Tomorrow, by creator of LightTable.
Books
Established ideas
- Python docstrings,
doc()
andhelp()
functions
Interactive-notebook programming
- Mathematica and Wolfram Alpha very established in this area.
- Jupyter. For Python primarily, but supports wide-range of alternate 'kernels' in different languages.
Kernel communicates with frontend over a ZeroMQ+JSON based message protocol.
Can visualize the outputs of code blocks, using a
display
protocol.interact
decorator allows to get interactive widgets for a function.nbviewer
tool can render to static HTML, and a service on-demand render a notebook from URL. Output is included.Bokeh
visualization embeds JavaScript, so plots can be interactive in a rendered notebook. Lots of uptake in data science, data journalism - focusing on reproducability and 'interactive', 'data-driven' stories. The interactive visualization widgets are accessible as an NPM module, jupyter-js-widgets
Ideas applicable to standard programming
- Use a collection to define related functions, for instance implementation for each message type in a protocol. Can then introspect the collection to check completeness and common properties/invariants, or generate documentation.
Recent development
- Node machines, spec for declaring meta info about JavaScript functions, and Treeline, a visual IDE built on top of it.
Model-based development
- ImProve, Haskell based DSL for high-assurance embedded applications, verified using SMT model checking. Compiles to C/Ada/Modelica (and Simulink).
AST-based tools
- OilShell: From AST to Lossless Syntax Tree. Offering two-way translation between source code, and parsed syntax tree. HN discussion