Tested out Iroh (dynamic analysis tool) #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
For this PR, I installed and ran Iroh, which is a dynamic analysis tool that provides runtime code tracking and visualization.
Since Iroh is installed via
npm install iroh
, I added that line into thetest.yaml
file.The output of this tool are logs visible when
./nodebb log
is ran, so the screenshot below includes an example of me trying out and testing Iroh by creating new messaging rooms (which is where I decided to test out the tool). More specifically, the logs starting from "Program" are the outputs of the tool as it provides runtime code visualization into the structure of the code.Note: Since the TAs said it is okay to not pass
npm run lint
since my tool requires usingeval()
, Github Action workflows fail.Tool Evalution
Overview + Strengths & Weaknesses
This dynamic tool essentially allows visualization of the code structure and step through of the code. It also allows for some manipulation of functions and performance measurement. The main customization required for this tool is to pass in the string version of the code you want to analyze into the stage. Over time, we can add more listeners to detail the structure of the code if we wanted to. This tool could be helpful in cases of really long and complex code with multiple layers of loops as it would output the structure of the loops without the inside, reducing cognitive load on the reader of the code. The (quantitative) strength of this tool is how easy it is to implement - in just a few lines of code, you can visualize the structure of the code. A weakness of this tool is that it is more of a measurement tool rather than a tool actively catching bugs/errors. It is still up to the programmers to spot code logic errors or performance errors, which means there could be less errors caught (quantitative). Another (qualitative) consideration in using this tool is that when added into the main code logic, it could possibly cluster the file, making it unnecessarily long and hard to read (when just looking at the code file).
Main Use
The problem I am hoping this tool will catch is simplifying chunks of code with complex logic to make it easier for readers and programmers to make sense of the logic of the code and thus making it easier to debug. This particular tool allows interactions with the code (visualization, step-through) and measures performance (how long it takes to load up the page).
Customization
The main customization required for this tool is to pass in the string version of the code you want to analyze into the stage. Then, you can choose which type of functionality you want the tool to perform. Some of the examples of the functionalities are listed here, including code visualization, code step-through, function manipulation, and performance measurement.
Integration
Since this tool is particularly helpful for complex and long blocks of code, I think this can be integrated into the development process as the programmers are working on the code. Whenever there is a code block that is hard to understand, using this tool to log the code structure visually could be helpful in instances where people are trying to understand the code. It could also be helpful in the debugging process as complex codes are incredibly difficult to trace.
Reports
There are no false positives or negatives in this tool, at least within the code structure visualization feature. This tool, if used on simple code, could end up clustering the log with unnecessary reports.