🔵 Circular Language 🔶

Visualizing computer code


JJ van Zon 2023

Commands

back

Contents

Introduction

Commands are executable objects: actions, procedures and processes that a computer can perform. In Circular they are displayed as squares and diamond shapes:

The square is the general symbol for a command. The diamond has special meaning with regards to execution.

Relations between commands can be expressed by containment:

And by connecting them with lines:

There can be solid, dashed or dotted lines between command symbols:

Names can be displayed with commands as well.

Diagram Elements

Commands can have certain characteristics symbolized in Circular.

A diamond expresses that a command is executable:

A square symbolizes that the command is not executable:

Relations between commands can be expressed by containment. One symbol can contain another:

A solid line indicates that one command is a reference to another:

Two symbols connected with a solid line, represent the same command.

A dashed line between command symbols makes one command sort of a copy of another:

That way, that one command is used as a definition for another command.

If a command is used as a definition, dashed borders may be used:

(However, using dashed shapes is still a bit of an open discussion.)

A command can have a name:

It can also be nameless:

To summarize, here is a list of traits a command can have:

Squares Do Not Execute

A square does not execute. That is, it only executes when called. A can call B:

But then again: A may be the one that’s executing, not B. So diamonds execute, and squares do not.

Derived Constructs

Constructs known from other programming languages have a reasonably unique expression using combinations of the basic elements from Circular. Here follows an attempt to accompany this claim with examples.

Command Definitions

A command definition describes the structure and behavior of other commands.

It may look as follows in another programming language:

void MyDefinition()
{
}

Command definitions themselves might not necessarily execute. Just copies of it, more likely. Not executing is expressed by a square:

When a command is used as a definition, it might be drawn with a dashed border:

(Though dashed shape notation is still a bit of an open discussion.)

A definition can have a name:

Where a definition used, it is pointed out by a dashed line:

So a command definition is symbolized by a:

because it is:

Command Calls

A command definition can be called multiple times.

In other programming languages a command call may look as follows:

MyCommand();

A call executes, therefore it is symbolized with a diamond shape:

A call points out a definition, giving it a dashed line pointing away from it:

A call is usually placed inside a parent command:

The call itself tends to remain nameless.

So a command call is symbolized by:

because it is:

How Calls Work

To make one command, call another a diamond is put in the calling command connected to the command to call:

Then A calls B.

C now is in a way part of command A. It executes when A executes. It’s like the code of B is inserted right into command A.

When one square is called, its containing diamonds will also be called:

When A is called, B is called. When B is called, C, D and E are called as well.

Command References

A command can be pointed to.

This can look as follows in another programming language:

MyCommand

So without decoration with brackets or what have you, it represents a reference to a command.

A command reference is a square, to indicate that it doesn’t execute:

A solid line is used to point out a different command:

So a command reference is symbolized by a:

because it does:

How Command References Work

A square connected to another command establishes a reference to a command.

Both squares now represent the same command. A call to either square, is a call to the same command.

Therefore, when a command reference is called, the referenced command is called:

When A calls B, it’s actually calling C.

Command references are a clever way of leaving the command open-ended or variable, to be determined at a later time.

Code Blocks

Some programming languages use code blocks to group statements together. This can also scope variables, so variables inside the block may only be used within that block.

In another programming language, this might look as follows:

void MyDefinition()
{
    {
        ...
    }
}

The inner braces and its contents (...) represent the code block.

In Circular, a code block is a command embedded inside another command:

The inner command has a diamond shape, meaning it executes automatically when the parent command executes.

Furthermore, a code block is nameless. It also does not have any lines going towards or away from it.

A code can might also look like this:

Instead of a code block in a definition, this is a code block inside an execution.

Code blocks can be nested even further:

In summary, a code block is symbolized by:

because it is:

Local Functions

Other programming languages may have a thing called local functions. This means: a command is defined within another command.

In a different programming language this can look as follows:

void MyParentCommand()
{
    void MyLocalFunction()
    {
    }
}

In Circular it is a command definition in another command definition:

A local function has a name:

It can be called from within its parent command:

To sum it up, a local function is symbolized by:

because it is:

Clauses

Clauses can be found as part of an if statement or as a where clause.

This can look as follows in a textual language:

if { ... }

And is represented graphically in Circular:

A clause is expressed as:

because it:

Lambda Expressions

A lambda might be found in other programming languages as sort of a short notation for a function, embedded right inside a code line:

Where(x => x.IsChecked)

Minus the details:

Where(...)

So the ... represents the lambda expression here.

In Circular, the notation looks like a nameless local function passed by reference:

So a lambda can be expressed as a:

Because it is:

Open Ended

Honestly, in Circular there may not be much of a distiction between lambdas and clauses. So the notations may as well be switched around:

It’s open to interpretation, but hopefully the meaning of the symbols are getting clearer so you can choose to use them as you see fit.

Nested Commands

Nested commands are commands defined within a command. They were demonstrated earlier, but this concept may deserve a little more attention.

They can look like this:

The nested command can either be a diamond or a square. Its container is also a diamond or square. They often have no lines attachted to it.

The concept of nested commands may coincide with the terms:

Those can all be considered nested commands. Sometimes however, it is easier to use a single umbrella term for these phenomena.

Active Nested Command

A nested command that is a diamond is an active nested command:

It is called active, because it executes.

Active nested commands are code blocks.

Inactive Nested Command

An inactive nested command is one that does not execute. Therefore it is displayed as square:

It can only execute by calling it:

Inactive nested commands can be:

Deeper Nested Command

Commands can be nested even further, creating a deeper nested command structure like this:

Implementation

The implementation of a command is defined as the private contents of a command. Here is an attempt to demonstrate that visually:

The contents drawn with thicker lines, are the larger square’s implementation. They are the private contents. The thinner lines denote the command’s parameters. Those are public.

Conclusion

Using constructs from Circular, it may seem circumstantial whether a command is a code block, clause, definition, call, etc. It seems to result from the way basic language elements from Circular relate to each other. These symbols from Circular can be combined to represent constructs from other languages.

It deserves to be said, that these symbolizations are just ideas. Depending on how notation is used by an application, different choices could be made.

back