SCL: the Structural Constraint Language
Follow the procedure below to get a quick taste of SCL:
(1) download the SCL jar file
and copy it into your Eclipse plugins directory.
(2) download the sclDemo.tar.gz file and
import it into your workspace as an Eclipse Java project. This project
contains a set of SCL rules (in files ended with .scl) for the
(3) Restart Eclipse. You should see a red-bug button appearing on the
tool bar. Click it to invoke SCL checking on the sclDemo project. You
should see an error message on the Point2D class that says it misses
Software developers often fail to respect design intent due to either
ignored documentation of intent. SCL (Structural Constraint
Language) helps capture and confirm aspects of design intent by using
structural constraints on a program model extracted through static
analysis. The original designer expresses design intent in terms of
constraints on the program model using the SCL language, and the SCL
conformance checking tool examines developer code to confirm that the
code honors these constraints.
There are several goals for SCL. We want SCL to be as expressive as
possible so that it can be used to specify a wide range of constraints.
checker must be efficient, but we are willing to trade performance for
stronger analysis. Finally, SCL must have a formal foundation so that
a reliable checker can be built, and more importantly, users can
predict and reason about its
SCL has been used to specify and check constraints for an industrial
project, several open-source projects, and by a dozen of graduate
students on a number of course projects. We are interested in applying
SCL in more real-world projects.
If you want to discuss the SCL for
Java, send Daqing Hou an email (dhou clarkson edu).
 Using SCL to Specify and Check Design Intent
Source Code. Daqing Hou, H. James Hoover. IEEE
Transactions on Software Engineering, June 2006.
 Specifying Framework Constraints with FCL. D. Hou et al. In
proceedings of CASCON
 Specifying the Law of Demeter and C++ Programming Guidelines with
FCL. D. Hou et al. In proceedings of SCAM 2004.
A Demo: Constructors calling overridable methods
In Java, if a constructor invokes a method that is overridden by a
method in a
subclass, and if the override accesses an
instance variable of the subclass without initializing it, then it is
likely that a program failure will occur. In order to avoid this kind
of an error, some textbooks go so far as to advise ``Constructors
not invoke overridable methods, directly or indirectly.'' Such a
formulation of a rule is too coarse-grained as not all invocations of
overridable methods by constructors are illegal. In reality
we have seen developers following this rule religiously, causing them
to produce sub optimal designs that are error prone for
clients to use.
The following are a series of screen shots that
demonstrate how SCL foregoes legitimate invocations of overridable
methods and detects the illegal ones.
SCL specification for the constructor-calls-overridable rule:
In Eclipse, checking SCL rules is as easy as a click of a button:
SCL provides the whole context of an error, not only a single
statement as a compiler does.
In this case, Super(int)
indirectly invokes virtual1
and virtual2. Because virtual2 is overridden in Sub, and the override accesses msg without initializing it,
both Super(int) and virtual2 are marked as part of
Note that virtual2
accesses msg without
initializing it, but virtual1
has no problem as it does not access any instance variable of Sub: