Quick Index
Overview


The Algorithm Studio allows you to experiment with and apply some tests on your algorithms.

It utilizes the fact that our pseudocode matches up with a minimal subset of web scripting (aka JavaScript).

The algorithm studio is an optional -- use it if you like.

Studio is Not Coding - Gotcha 🐞


Tips:


Starting Studio


If provided with an assignment, the studio is already setup. No special software tools are required -- the studio uses any web browser (already on your machine).

To start the studio, simply open this file (the "algo-studio" sub-dir is located in your given project's root directory):


Using Studio


To the left text area is the "input" area for testing algorithms.
To the right is the "output" area that shows algorithms results.

In the lower pane, you can see the object universe (classes and methods).

Here is an example algorithm test for the method "reversed"

Input (Test)
Here we test the method "join".

Note that the function "log" can be called to print to output; "println" will also work.
var elements, a
elements = [9, 8, 2021]
a = MyArray.from(elements)
log(a)
log('join("/"): ' + a.join("/"))
Output (Result)
Here is the output.

The algorithm formatted a date via the "join" method.
elements: 9,8,2021
join("/"): 9/8/2021


Debugging


Debugging Overview


As mentioned above, the algorithm studio is intended for just light play of pseudocode.

We do not want to spend too much time debugging, as that defeats the idea of algorithms.
Your algorithm might still be generally good which is the key part of algorithms.

Other Avenues to Check an Algorithm


Because the Studio lives in a web browser you will have a nice debugger at your fingertips.

Algorithm Studio Errors


If we have errors in the pseudocode that is in the studio algorithm input text box, then we should get a helpful error message and the line with the problem should be highlighted.

However, if we have errors in external files we have saved, the studio error might not be as helpful, and we would then need to use the web browser debugger (see next sections).

Opening Browser Dev Tools


We are assuming we have the Algorithm Studio open in a browser.

Hit the function key "F12" or "Ctrl+Shift+I" and about half of the browser should now be filled with "Dev Tools"

Finding Error Message


A first try is the "console" which is often helpful.


Debugging Source


A second try is the debugger.


Diving Deeper


We touched on the most common ways to find bugs in web browser, but, optionally, you might like to dive deeper via web searches for search keys like "Chrome debugger", "Firefox browser debugger", etc.

Special Case: Studio locks up


If the Studio "locks up" there is a good chance that we are in an infinite loop (e.g. have forgotten to increment/decrement a loop variable) -- I've been there.

We simply close the browser tab and reopen the studio.

This means if you have a lot of pseudocode typed into the Studio (you really shouldn't) you should first copy-off that source into a separate file on your machine.

The studio does not use files.

Updates


The studio will be updated periodically -- so refreshing (re-copying into place) occasionally is a good idea. You will receive email(s) or D2L announcements about updates.