FlowStorm: A Powerful Tool for Debugging and Understanding Clojure Code
0:00:08 Initial Plan and Change of Agenda: The speaker initially planned to talk about FlowStorm's internals and new features in FlowStorm 4. However, they realized that much of this content would overlap with a previous talk.
0:00:58 New Title and Agenda: The talk's title was changed to "The Power of the Storm," and the agenda shifted to focus on practical usage and demos, including:
FlowStorm refresher
Instrumentation and recording
Workflow tips and tricks
New features like the outputs panel and data windows
0:02:07 FlowStorm Overview: FlowStorm is a development tool for Clojure that records program execution and visualizes data.
0:02:22 Key Difference: Unlike other tools, FlowStorm records program execution as a "flow," which is a timeline of all thread activities.
0:02:54 Local vs. Remote Mode: FlowStorm can operate in local mode (everything on the same JVM) or remote mode (instrumented code and recordings on a separate process).
0:05:34 Instrumentation with ClojureStorm: ClojureStorm, a fork of the official Clojure compiler, adds instrumentation to emit extra bytecode for tracing, enabling detailed analysis without modifying the original code.
0:08:43 Recording in FlowStorm: The tool hooks into ClojureStorm and stores all events, function calls, and intermediate object references with pointers to source code coordinates.
0:10:07 Thread Timelines: FlowStorm organizes recordings into thread timelines, which are arrays of events, providing a detailed view of each thread's execution.
0:10:59 Demo: Web Applications: The speaker demonstrates how to use FlowStorm to analyze a web application, showing features like:
Recording requests and responses
Naming and recalling specific requests
Searching for values within recordings
Defining and running print statements on recordings
0:21:20 Demo: Data Windows for HTML Visualization: The speaker introduces data windows, a new feature for visualizing data, and demonstrates how to view HTML output directly within FlowStorm.
0:22:17 Demo: Editor Integration: The speaker shows how to jump from the editor to recordings and back, using features like:
Quick jump to function
"debugger;" statement for fast positioning
Defining all frame variables in the REPL
Opening source code from recordings
0:27:45 Demo: Codebase Exploration: The speaker demonstrates how to use FlowStorm to explore a new codebase (Clojure's core.async flow library), showing how to:
Record and analyze the creation of flows
Identify and analyze threads spawned by the library
Use bookmarks to mark interesting points in the recordings
0:43:21 Accessing Recordings from the REPL: FlowStorm allows programmatic access to recordings via the REPL using the get-timeline function.
0:44:13 Demo: Outputs Panel: The speaker introduces the outputs panel, a replacement for the REPL console that provides enhanced visualization and navigation of evaluation results.
0:46:24 Demo: Data Windows: Data windows are a system for data inspection and visualization, supporting:
Lazy navigation of nested data structures
Infinite sequences
Multiple visualizations
Custom visualizations
Clojure datafy and navigation
Real-time data visualization
0:50:34 Custom Visualizations: The speaker demonstrates how to create custom visualizations for specific data types, using a chessboard example.
0:52:25 Datafy and Navigation Integration: FlowStorm integrates with Clojure's datafy and navigation protocols, allowing seamless exploration of data structures that support these protocols.
0:56:20 Built-in Visualizations: FlowStorm provides built-in visualizations for numbers, byte arrays, and other common data types.
0:56:27 EQL Queries: Data windows support EQL (Extensible Query Language) queries for filtering and analyzing data.
0:59:14 Real-time Visualization: The speaker demonstrates how to create data windows that update in real time, using a sine wave example.
1:01:04 Ants Demo: The speaker revisits the classic "ants" demo to showcase how data windows can be used to visualize and debug agent-based simulations.
1:03:05 Conclusion: The speaker concludes by encouraging the audience to explore FlowStorm and its features.