About

cloudalion.org is an open-source project with a mission to provide purely-declarative programming stack of scalable & responsive Web applications.  It is an umbrella project that hosts the entire ecosystem of the Cedalion programming language.

It consists of three sub-projects:

cedalion-circleCedalion:  The implementation of the Cedalion programming language combined with its Eclipse-based workbench.

nodalion-circle

Nodalion: An npm module allowing Cedalion programs to run and interact with Node.JS.  The core project is accompanied by driver projects for connecting to express, mongoDB, Redis, RabbitMQ and pkgcloud (an abstraction layer for connecting to Amazon S3, Google Cloud Storage and other object stores).

cloudalion-circle.png

Cloudlog1 (temporary name): A NoDatalog database, implementing the Cloudlog data language as a Cedalion DSL.  It provides a RESTful API (JSON over HTTP) and supports serving static files.  It is intended to be used as a Web server.

A fourth sub-project not yet extracted into its own repository is ng-cloudalion (temporary name), an angular.js 1.X extension providing directives for binding data in the database to the HTML display.  Upon completion, this extension should allow building full-featured applications without the need for writing Javascript code on the client.

Background

There are a lot of ways to develop Web applications.  Some are purely imperative (e.g., implementing your own server over bare Node.JS or writing a CGI script), and some are moderately declarative (e.g., by using a Web framework providing DSLs for templates, URL mappings, data modeling, etc).

Framework developers seem to constantly try to make more parts of a Web application declarative.  For example, after the Web moved to AJAX, much of the UI development moved from declarative templates to imperative Javascript (with or without the assistance of libraries such as jQuery).  Then, after an adjustment period of a few years, smart people found declarative ways to do AJAX, in the form of client-side template libraries, such as AngularJS and React.

Motivation

Why do they go through all this trouble?  Why not stay with imperative UI generation or imperative data handling?Declarative programming allows us to write less, and focus more on the end result.  On the way, we get less room for error.  It’s much easier to tell a computer what we want (and get it right), than to give a step-by-step recipe and hope the end result matches our desire.If declarative programming is such a great thing, why does it exist today only in limited parts of Web applications?The reason is that it is hard to express the business-logic of an application declaratively.  Why? Because business-logic is mostly about manipulating state, and state is imperative.  Declarative languages (think SQL, HTML, CSS…) have no notion of state, and are therefore not your first choice for state manipulation.What makes things even worse is the industry’s move towards NoSQL databases.  They give us less declarative power (no fancy queries), and instead relies more on the (imperative) business logic to arrange things nicely in the database so that queries will be efficient and correct.So how can we support full-stack declarative Web application programming?The Cloudalion Way

Our approach is to store the business-logic along with the data in the database, and have the database apply it to the data.  For this, we need a special kind of database, one we call NoDatalog.  Such a database allows user data to be stored as facts, and business-logic to be stored as declarative logic rules.

Our NoDatalog database, working-title: Cloudlog1, Implements the Cloudlog data language.  This is a Turing-complete language that allows the entire business-logic of an application to be implemented as a set of rules, stored in the database alongside the facts representing user data.  Cloudlog supports two kinds of rules, dubbed top-down and bottom-up rules, giving developers a choice between working at query time and at update time, respectively.  With this choice developers can make space/time trade-off decisions and have their business-logic scale to any size.  All this, while keeping their code declarative.

The Cedalion Stack

The cloudalion project is also the ecosystem of the Cedalion programming language.  Think of Cedalion as your Ruby and cloudalion as your Rails.  Just like Ruby did not gain much popularity until Rails came along, Cedalion was not very useful before Cloudlog was developed.  The cloudalion project provides two programming models for Cedalion addressing two different types of software:

  • Cloudlog: supports the realization of Web applications by specifying the business logic as a set of declarative rules.
  • Nodalion: Connecting Cedalion with Node.JS.  Uses a monad-like abstraction to allow imperative programming in Cedalion in combination with Javascript “drivers”  that allow connection to peripheral software (e.g., databases).

Nodalion was developed as the platform for implementing Cloudlog.

 

Development Status

Most development on the Cedalion Workbench was done during the 2006-2011 time-frame.  Some development was done recently, but nothing significant.  It works and with some practice a developer can be productive with it, but a lot of bugs still exist.

Nodalion was developed from scratch beginning July 2015 (as part of the cloudlog1 project, initially) and became its own project January 2016.  Its main drawback is performance, with the main bottleneck being Javascript parsing of the output of Cedalion program running on an SWI-Prolog interpreter.

Cloudlog1 is still a proof of concept.  It is a partial implementation of Cloudlog.  This subset is enough to build scalable applications declaratively, but cannot authenticate users or enforce access control.

Coding Standards and Documentation

With the exception of the Cedalion project that was developed years ago, the Cloudalion projects were all developed following BDD principles.  This means:

  • All code developed for Nodalion and Cloudlog1 was developed “test-first”.
    • This results in good test coverage for the entire code-base.
  • Tests and behavior descriptions provide up-to-date documentation.
    • In-code documentation is used sparingly, due to its tendency to become obsolete.

For the Cedalion project some external documentation exist.  I will provide it upon request.

Collaborators, Welcome

The cloudalion project combines code in Java, Javascript, Prolog and Cedalion.  We encourage interested developers to participate in the development of this purely-declarative development stack.

If you are interested in collaborating and do not know where to start, please contact us and we’ll be happy to help.

Leave a comment