Table of Contents
Table of Contents
Clickframes is a framework for creating web applications. It supports quick iteration of design, development and testing through a simple, unified requirements model tailored to the needs of a web application. Using Clickframes, project teams can automate the generation of design artifacts, prototypes, software requirements, production-ready code, and Selenium test scripts.
The heart of the Clickframes framework is appspec.xml, the
application specification (or "appspec"). The
appspec.xml file is written in Clickframes XML. It is
the single source of truth. Other code and artifacts are generated
directly from this file by using a variety of provided plug-ins, then
further customized by developers and testers to produce the final
application.
Clickframes is not dependent on any particular implementation technology. The initial open source release included two different Java code generators and a PHP code generator, and we're encouraging the community to write new plug-ins to generate applications in still other languages. Clickframes is ultimately about turning design into high quality, well-tested applications.
Clickframes was originally developed in 2008 by the Informatics Solutions Group at Children's Hospital Boston. The original Clickframes came about when we decided to automate generation of HTML wireframes, and to reduce our time and effort managing requirements for a particularly demanding client. At a certain point, we realized that we didn't have wireframes anymore—we had a computable requirements model. Some refactoring and ongoing development later, the result was Clickframes—a suite focused on the complete lifecycle of a web application, from modeling and design to code generation and development to testing and release.
Table of Contents
Clickframes is incredibly easy to try out, especially if you have Java and Maven already installed. (If not, those are incredibly easy to install.)
Java 1.6 is required for using Clickframes. Check the version of Java installed on your computer:
java -version
If you don't have Java installed, you can get Java 1.6 from http://www.java.com/en/download
Maven is a make-like tool for Java. Clickframes
uses Maven to build projects. Maven must be installed on your machine in
order to use Clickframes. If you don't have Maven installed, you can
download it from http://maven.apache.org/download.html
After installing Maven (which is usually as simple as unzipping
your download into a directory and adding Maven's bin
directory to your path), you should be able to run the following
command:
$ mvn -version Maven version: 2.0.9 Java version: 1.6.0_10 OS name: "linux" version: "2.6.23.15-137.fc8" arch: "i386" Family: "unix"
Create a new empty directory for your project:
mkdir demo cd demo
Start a new clickframes project by typing the following command:
mvn org.clickframes:clickframes-maven-plugin:gen -DarchetypeRepository=http://nexus.clickframes.org/nexus/content/repositories/releases
Your appspec is generated in
src/main/clickframes/appspec.xml. You (or your
designer, business analyst, or manager) will customize the appspec
to describe your desired web app's functionality. (See Chapter 2)
Your techspec is generated in
src/main/clickframes/techspec.xml. You (or your
developer) will customize the techspec to describe the technical
requirements of your web app.
After customizing the above, regenerate your artifacts by running Clickframes again:
mvn clickframes:gen
Table of Contents
Clickframes XML is an XML-based format for describing the core
functional requirements of a web application. This file is an application
specification – or appspec – and is named
appspec.xml. It's a very important file: Clickframes
uses the appspec to generate Clickframes Interactive Previews (CLIPs), to
build executable code via Clickframes Plugins, and to generate automated
test scripts.
The appspec will evolve over the course of the application development process. At the start of a project, the appspec may be very simple—a few pages, a few relationships and a few miscellaneous requirements. As you proceed through the Clickframes Project Lifecycle the appspec will be fleshed out and used to generate new artifacts and regenerate old ones.
When designing the Clickframes XML format, we've been very careful to avoid modeling in a technology- or implementation-specific way. For instance, we don't allow you to specify things like Java package names in an appspec, because the application may not be generated in Java. The simple rule of thumb is that the only things that go into the appspec are the ones that users can see, and that users care about. In many software development processes, these are referred to as "testable requirements"—you should be able to confirm every requirement in the appspec by loading the final application in a web server and running through the pages.
Technical requirements, like a Java package name, instead go into a technical specification, or "techspec." More on that later.
An application to be specified by Clickframes XML is contained by
the appspec element.
At the very least, an appspec must have a
title.
Your title will most likely be the name of your application.
<appspec> <title>Crazy Al's Online Photo Organizer</title> ... </appspec>
A description is also a good idea, to provide
some narrative on your application's goals and features.
<appspec>
<title>Crazy Al's Online Photo Organizer</title>
<description>
CAOPO helps people manage photo albums over the web.
</description>
</appspec>Appspec Attributes
Unique identifier for this application, used primarily for artifact generation.
The unique ID of the page to display by default, i.e. the index page.
The unique ID of the page which will be displayed if the user is required to log in.
The basic Clickframes XML building block is the
page. Very simply, a page describes its purpose
within the application, i.e. possible user actions and content, and
indicates where else the user may go from there.
Each page is labeled with a unique string identifier. This should be something brief but legible, similar to what you might name the page's HTML file.
<page id="passwordReset"> ... </page>
A page must have a title and a
description. The description should provide a
casual narrative of what the user can do on the page.
<page id="passwordReset">
<title>Password Reset Request Form</title>
<description>
On this page, the user may enter a username
to initiate the password reset process. If
the username does not exist, an error message
will be displayed asking for a second try.
</description>
</page>Remember, the description is casual, not canonical. Anything truly important in your description should ultimately be codified in actions, outcomes, and facts.
The most basic means for connecting one page to
another is by using the link element.
A link must have a title and
a reference to another page, either internal to application or external.
The title should reflect how the link would be
displayed to the user.
Optionally, a link may contain a
description, which could explain what will happen
within the application when the link is clicked.
A page reference can take one of two forms. Internal page
references require a pageRef tag, containing a valid
page identifier (the id attribute of a
page element). External page references require an
href tag, containing a valid URL.
<link>
<title>Open Inbox</title>
<pageRef>messagingInbox</pageRef>
</link>
<link>
<title>Terminate Account</title>
<description>
Sends the user to parent company's website where
account termination information is displayed.
</description>
<href>http://www.megalomart.net/terminate.php</href>
</link>When a page will gather data from the user,
create a form containing fields defined by the
input tag followed by actions
which define how the system processes the data.
An input must have a type attribute, indicating
what kind of form input is expected, and a title
element, indicating the field label which will be displayed to the user.
Optionally, you may use the description element to
provide more information about the field.
Valid input types, which map to HTML form controls, are:
text: single-line input
textarea: multiple-line input
password: sensitive single-line
input
checkbox: on/off switches toggled by the
user
radio: mutually exclusive switches
dropdown: single-selection menu of
options
multiple: multiple-selection menu of
options
upload: file selector
<form id="editWikiForm">
<inputs>
<input type="textarea">
<title>Page Content</title>
<description>User enters page content with wiki-text syntax.</description>
</input>
</inputs>
...
<actions>
<action>
...
</action>
</actions>
</form>Inputs of type checkbox,
radio, dropdown, or
multiple should contain one or more
option elements, specifying the options available
for the user to select.
<input type="radio"> <title>Your Favorite Ice Cream Flavor</title> <option value="chocolate">Double Chocolate Chunk</option> <option value="vanilla">French Vanilla Bean</option> <option value="strawberry">Sweet Summer Strawberry</option> <default value="chocolate" /> </input>
Use the default tag to specify an
option to be selected by default. For inputs of
type dropdown and radio,
Clickframes will assume the first option is default if a default is
not explicitly specified.
User-supplied data may be validated against rules you define
within each input element using the
validation tag. Validations must define a
type attribute:
required: input is required
url: input must be in the form of a
URL
email: input must be in the form of an
e-mail address
length: input must fulfill the specified
length requirements
regex: input must satisfy the specified
regular expression
<input type="text">
<title>Your E-mail Address</title>
<validations>
<validation type="required" />
<validation type="email" />
</validations>
</input>Each validation may also include a
description attribute to specify the message to
display when the validation fails.
<input type="password">
<title>New Password</title>
<validations>
<validation type="required" description="Please enter a new password." />
</validations>
</input>Validations of type length and
regex require additional parameters provided within
parentheses as part of the type definition. Length
validations may include the min or
max parameters, or both. Regular expression
validators must include a regular expression within the
parentheses.
<input type="text">
<title>Username</title>
<validations>
<validation type="regex(/^[a-z0-9_\.-]+$/i)"
description="Username must contain only alphanumeric characters, underscores, dots, and dashes" />
</validations>
</input><input type="password">
<title>Password</title>\
<validations>
<validation type="length(min=6,max=12)"
description="Password must be between six and twelve characters." />
</validations>
</input><input type="textarea">
<title>Enter Description of Task</title>
<validations>
<validation type="length(max=255)"
description="Keep your description within 255 characters, please." />
</validations>
</input>An action represents something the user can do
on a page that may have one or more consequences, the most obvious
example of which is form submission.
An action is made up of a
title and at least one
outcome.
<action id="createAccount">
<title>Create Account</title>
<outcomes>
...
</outcomes>
</action>An outcome describes one possible consequence of an action. Outcomes may cause the following to occur:
Send the user to a different page or URL
Display a message
Send an e-mail
Additional tasks to perform within an outcome may be described
as facts.
An outcome must contain an
id, a title and an internal or
external page reference (see previous section on links). The following
outcome would send the user to a page identified as
systemDashboard.
<outcome id="accountCreated"> <title>New account created</title> <pageRef>userProfile</pageRef> </outcome>
Optionally, an outcome may have a
description to provide any additional detail
related to the performance of the action.
To display a message on the destination page, include a
message tag:
<outcome id="accountCreated"> <title>New account created</title> <pageRef>userProfile</pageRef> <message>Welcome, your account has been created.</message> </outcome>
To send an e-mail, include an emailRef tag
with a reference to an email specified elsewhere
within your appspec.
<outcome id="accountCreated"> <title>New account created</title> <pageRef>userProfile</pageRef> <message>Welcome, your account has been created.</message> <emailRef>newAccountMessage</emailRef> </outcome>
An outcome may also be modified by the
negative attribute to indicate that outcome is a
negative case, e.g. form submission failure, as shown in this complete
action/outcome example:
<action id="createAccount">
<title>Create Account</title>
<outcomes>
<outcome id="accountCreated">
<title>New account created</title>
<pageRef>userProfile</pageRef>
<message>Welcome, your account has been created.</message>
<emailRef>newAccountMessage</emailRef>
</outcome>
<outcome id="usernameExists" negative="true">
<title>Desired username already exists</title>
<description>
User is shown an explanatory error message
and asked to try again.
</description>
<pageRef>newAccount</pageRef>
<message>Sorry, that username is already in use. Please choose another.</message>
</outcome>
</outcomes>
</action>Clickframes provides a series of action types to help you define common user activities. In particular, Clickframes code generators can leverage these action types to great effect.
Action initiates the login process
Action terminates the user's authenticated session
Action creates a new data object
Action updates an existing data object
Action updates an existing data object, or creates it if it doesn't exist
Action deletes a data object
Action types are described in greater detail in the sections on User Authentication and CRUD.
A linkSet defines a group of links that can be
displayed together on any number of pages.
<linkSet id="projectNavigation">
<link>
<title>Start new project</title>
<pageRef>newProject</pageRef>
</link>
<link>
<title>See all projects</title>
<pageRef>projects</pageRef>
</link>
<link>
<title>Send feedback</title>
<href>mailto:projectfeedback@clickframes.org</href>
</link>
</linkSet>Once defined, a linkSet may be referenced in
each page on which it will appear.
<page id="newProject"> ... <linkSetRef id="projectNavigation" /> </page> <page id="projects"> ... <linkSetRef id="projectNavigation" /> </page>
Because URL parameters (e.g. foo?id=123) are exposed to the user through his browser, it is important to model them up front. REST-based web services especially have placed additional importance on the structure of an application's URLs.
If a page will accept URL parameters, define them with the param tag.