🔵 Circular Language 🔶

Visualizing computer code


JJ van Zon 2023

Introduction

back

This articles introduces the basics of the Circular language. Circular is an idea for a computer programming language, mostly about a diagram notation for visualizing computer code.

Contents

Splitting up Ideas

One thing that can play a role in software development, is splitting up a larger idea into smaller ideas:

This picture shows the idea of a computer, split up into four sub ideas: a monitor, keyboard, mouse and printer.

In Circular the main symbol for an idea is a circle:

Each sub idea works more or less independently of the others. Monitor does its bit, Keyboard does its bit. It’s the super idea that ties all the sub ideas together. That means that the Computer makes the link between monitor, keyboard, mouse and printer. The super idea combines the sub ideas and manages communication between them.

In computer programming, ideas are sometimes called objects. Each object is responsible for its own part of the system. Here is another example:

A sub idea can be split up into sub ideas itself. This way we can go on and on, splitting up into smaller and smaller ideas:

But to see the general point of a system, only the top layers are relevant:

This makes object oriented programming a great way to keep overview of a system as it grows. A better split up into ideas makes a design easier to understand, especially the general outlines. A subdivision in objects can be quite a prominent thing in software. So splitting up an idea into sub ideas, something that most people are probably able to do, would be quite useful when programming software.

Reusing Ideas

A division into ideas can lead to the reusability of ideas. For instance: the idea of a button might be reusable. If a good button were programmed, other people may not need to program another button again. The same idea can be reused everywhere a button is needed.

Any place where there’s a button in a system, there is a separate object:

A button object in general is called a type of object.

There are quite a few object types available out of the box, that can be used in your program. Button objects for instance are quite common and can be used to build a user interface. Another type, Integer, represents an integer number. You’re going to use those all the time.

Commands

Objects not only have sub objects. They can also contain commands:

Commands are denoted here by squares.

Sub objects can again contain commands:

Software cannot execute without commands. Upon running a command, an object does something.

A button can have a Set Text command for instance, which sets the text to display:

Other types of object might also have a Set Text command. Those might be distinguished with the following text notation:

Button . Set Text
Text Box . Set Text

A command can again consist of sub commands: the separate steps of the command, denoted here by diamonds:

Sub commands are not necessarily embedded inside other commands. They can exist separately:

And these sub commands are then called from the super command:

Calling a command has a similar effect as inserting the called command there where it was called.

The Redraw Button command is rather complex. In this command, lines of a button are drawn, a text is drawn and other things that make up the button. It is built up of steps. Redraw Button could call a Draw Line command a number of times. So sub commands of this Set Text command can themselves be composed of sub commands.

Here it becomes apparent, that separately defining a command can lead to reuse of a command. The Draw Line command is reused three times in the example above. There are quite a few commands already available. Reusable commands like that can also reside inside separate objects. A File object for instance can contain commands that make it possible to deal with a computer file.

So where does this all end? If commands just continue to delegate to each other, when do things actually start happening? Well, it seems to end at a special group of commands, that do not call other commands anymore. A command like that executes a machine instruction: a basic instruction that make a computer do something. A computer’s central processing unit performs a hardware defined machine command.

That way it is possible to develop big command call tree-outs, which makes a single command consist of multiple machine instructions, ranging from tens to ten-thousands of them.

But it is not necessary to see all that detail, to understand what the purpose of Button . Set Text is. A simpler overview should be good enough for that:

Command Parameters

Commands can also have parameters. These are instructions passed along with a command, that slightly modify its behavior. The Button . Set Text command for instance, has a Text parameter, which indicates what the text of a button would become.

Text is an idea. It is an object. It is usually objects that serve as parameters:

A command can do things with the parameters passed to it:

Here is an example of passing a Text parameter on to the next command, in this case to Format Text:

Here is an example calling a command of the Text parameter:

Interfaces

Another capability of objects is that they can have different interfaces.

Consider how an employee looks to a customer and how to a coworker. The employee will do certain things for a coworker and other things for a customer. The employee has two interfaces. It depends on the party referring to the employee, which interface they get to see. Even though both parties are referring to the same person, this person will do different things for them.

Objects have a similar cabability: they can also have separate interfaces.

Interfaces are distinguished here by triangles.

The employee here is an advisor to a customer and to another employee a coworker. Sometimes only one specific interface is available within a certain context. In other cases you can choose. An object can also just have one interface, the same one for everybody.

Triangles can be seen as sub objects just like circles. The difference with circles is that triangles sort of melt together with their container. Interfaces are a way to give different types shared characteristics. Interfaces can also group object members together.

Reading a Diagram

Where to start, when reading a diagram like this?

One option is to first read its containment structure, by starting at the largest container, and then looking at the smaller ones. After that, relationships made by the connecting lines is something to look at.

Starting with the largest container may not always be preferred. One symbol might be highlighted. Then this symbol is what the diagram is about. The focus would then be on aspects of the highlighted symbol. Then start looking around from there.

There is really no one way of doing it.

Conclusion

Hopefully this adequately introduced some of the basics of the Circular language.

back