Plasticity of Programming Language

Can Mingir
Jul 27 · 4 min read
Image for post
Image for post

In imperative (procedural) programming, it is common to have code files to compile and restart the programming runtime to get affected. So, in other words, adding new rules or learning new behaviors requires rewiring hard coded binaries. In addition, if it requires program to take different steps, it also has to go through the similar process with some configurations.

In declarative programming, the runtime works with declarative statements, which means statements don’t explain explicit steps, instead, it tells abstract logical intention. This important difference enables the declarative runtime to accept statements anytime without compiling or restarting, so that, it can build the context along with. However, imperative programming is not building blocks, means missing this crucial feature prevents from having Plasticity attribute.

Let’s start with a simple example,

It is very common that if a program has to behave differently for customer to customer, it needs external configuration, and as configuration changed, the flow of control changed accordingly.

var length = 10;
var area;
if(config.type == "SQUARE") {
area = length x length;
} else (config.type = "CIRCLE") {
area = length x length x 3.14

So, in this case formula of area is dependent on external configuration, which changes the flow, and adding new type like "TRIANGLE" requires compile and restart of application. In addition, once configuration is set for customer, rest of the if statement (in this case) will be a dead code as well as the if statement will rerun over and over again.

If you apply the same example in declarative runtime, it won’t require any external configuration, instead only requires formula entered without need of recompile or restart, and the runtime adjusts its control flow accordingly.

> var length = 10;
> var area = length x length;

or for "CIRCLE":

> var length = 10;
> var area = length x length x 3.14;

This approach tremendously lowers number of code lines as well as elements in architecture, and as complexity of application increases, the gap gets bigger.

For basic usage:

In order to achieve plasticity in software, declarative programming is critical because nature of this programming style works with abstract statement of building blocks rather than explicit steps, so that, statements can be added anytime into the system. However, this puts burden on the runtime to create own control flow according to statements received.

A control flow is drawn based on relationship between statements in the graph, which follows formal logic. For example:

> a = 1
> b = a + 2
Image for post
Image for post

Once it receives b = a + 2 , the runtime automatically adjust the graph and makes connections. In fact, the runtime accepts all ES6 (JavaScript) statements and considers every statement as data.

In this paradigm, there is no segregation regarding what data is or not, instead approaches how data is related with others so that any type of data including business rules can be added without requiring any additional actions such as compiling, configuring, restarting as a result of plasticity.

> a = 1
> b = a + 2
> if( b > 5) {
c = true
} else {
c = false
Image for post
Image for post

In this example, the if statement is added into graph, and the runtime creates the flow based on information is given.

> c
> a = 4
> c

Changing a to 4, triggers chain event of updating b to 6 and setting c to true since c is part of the if statement.

More on Nucleoid’s graph process:

Image for post
Image for post

Nucleoid is an open source (Apache 2.0), a runtime environment that allows declarative programming written in ES6 (JavaScript) syntax. Since statements are declarative, the runtime provides logical integrity and persistency as hiding technical details.

Learn more at


Declarative Runtime System

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store