Application Logic Example - Rationale

Why?
While application logic is initially conceived by business people, once software is developed, developers take over. Business people and others priorly involved can no longer easily alter it, evolve it, nor for their own benefit nor for reselling it.

Prior to development, application logic is conceived and analyzed resulting in requirements specifications. Although not perfect, requirement specifications are easy to understand and interpreted without technical skills. Through several iterations, the application logic described in it can be altered, extended and improved.

Upon developing software, application logic will be translated by developers into code. In traditional programming, individual requirements are hard to identify in the actual running code. Moreover the code is cluttered with other requirements and technicalities making it difficult to interpret the code in terms of requirements. Changing the application logic therefore requires a magnitude more in-depth application logic and even programming knowledge.

It is clear that once the software has been developed, iterating evolving and maintaining the application logic now solely lies in the hands of the developers. The people priorly involved can no longer tap into the product to alter it, to evolve it, to resell it, and are thus shut out.

Examples
Online forms with computations, applications with rich user interactions, etc.

Consider for example an application for processing registrations for a conference. The registration fee and the rules to compute it is carefully decided by a financial department (to cover the costs of organizing the conference), by marketing (to compare with the usual fees, fees that seem fair, services required) e.g. students get a discount but cannot attend the banquet. During the coarse of setting up the conference these rules can change (because less attendees are to be expected, ratio students/non-students is different, etc).

When implemented the online form computes the fee but the logic computing the fee gets cluttered with concerns like using a technical patterns (such as MVC) to accessing the information, triggering re-computations, refreshing the form data, etc. Changing the rules becomes difficult. The initial investment into the product cannot be sufficiently leveraged to create for example a similar registration form for next year's conference.

What?
Instead of manually tracking changes or using complex libraries, new language constructs are implemented such that computations constantly re-evalute.

Webequations is an embedded language in javascript to configure the behavior of programs by establishing permanent relations between various data and how it is shown in the UI. For example, in this expression total.equals(sum(subtotal,discount)) the total always equals the sum of variable subtotal or discount during the lifetime of a program. The total is recomputed whenever the variable subtotal or discount changes. There is thus no need to use technical complex programming patterns or manually keep track and trigger what has to be recomputed, the program automatically responds to user input and process it.

The language has a user friendly notation that hides the technicalities to use the above mentioned libraries. By embedding the language, it can easily be complemented, extended and altered with normal javascript code. For example, the above sum function of our example is defined using plain javascript.

How?
Layer hiding the complexities of constraint libraries.

The language is implemented on top of a constraint library. Unlike conventional languages, computations are automatically recomputed each time something changes. So instead of having use the library and clutter the application logic, the language applies the library behind your back for you to your problem.

On top of the constraint library a small layer is implemented that offers new programming constructs e.g. equals(). The library contains about 50 lines of code and at its core configures the automatic tracking of variable changes and triggers recomputation.

Benefit
Application logic no longer requires in-depth programming expertise about complex libraries and programing techniques.

The code now only contains the business logic of an application.Such programs can be more easily changed and extended. It suffices to add an additional relationship. No need to touch or change other code, as changes to data will automatically be handled by other relationships.


Homepage // Motivation // Our Services // Examples // Design Tools // Contact
© Copyright 2011, Sebastian Günther & Thomas Cleenewerck, Software Languages Lab, All rights reserved