Snapper Introduction
What is Snapper?
Snapper allows an entire working application to be contained
in a single XML file. The XML file can be served from
a www server, file system or RDBMS and activated via the
Snapper thin-client. The compiler can
also produce an executable file with embedded XML.
Why Snapper?
As a consultant for a major CRM company, that has now been
bought and buried (cough...Scopus), I watched companies spend
tens of millions of dollars trying to achieve this very
concept, i.e. fast, re-usable development. My most
successful implementation was at an ELFI (Extremely Large
Financial Institution) where the VP of Engineering was a tech
head and we used the most over priced software on the planet
as a pure development tool. In this spirit lives
Snapper.
How does it work?
Applications, in Snapper, are contained in a project
directory hierarchy. The files contained in the project
directory include application driver scripts, GUI XML
components and object interaction XML. The component
snapmake is
used to combine the various files found in the project
directory into a single XML file or executable Perl script
with embedded XML. Another option is to create an
HTML version of the Snapper application by using
snap2html. Once running, Snapper applications use
the Snapper API module for low-level object access, and the
SharkAPI module for high-level data and ui interface layers.
The following diagram provides a high level logical view.
Project Structure
A Snapper Project or application is contained on a file system
with a specific directory hierarchy. A project can be
created using the snaputil
utility. This allows for easy development, and for the
application to be stored under version control, i.e. cvs.
Snapper is only interested in directories and files that
it knows about. Any unknown directories or files that it
encounters will be ignored. This is convenient for
adding support files and directories such as database scripts
or makefiles, etc. Here is the pizza application from
the sample directory of the snapper-perl distribution, note
that every application should have a top-level directory.
[bill@shark sample]$ ls -lF
README
perlmake/
pizza
pizza_pg
robo
|
The directory "pizza" contains the sample Snapper
application pizza. Here is the application structure.
[bill@shark contrib]$ ls -lR pizza
pizza:
MAIN.module/
pizza/MAIN.module:
scripts/
widget/
pizza/MAIN.module/scripts:
001_main_window.pl
001_table_window.pl
999_startup.pl
pizza/MAIN.module/widget:
MAIN.glade
|
The directories that end in ".module" contain
two directories, i.e. scripts, and widget.
The name of this directory is the module
name and is used in function calls. Files that end
in ".pl" in the scripts directory will be
read and incorporated into the application XML file.
The widget directory contains the glade XML file and
the oix data XML file. This data will also be combined
into the application XML file.
A more compilcated example can be found on the
GtkPizza contrib page.
The sample application can be compiled via the command-line
program snapmake or via the build button on the Snapper
IDE interface.
[bill@shark contrib]$ snapmake -d pizza -c -f pizza.pl
pixmap directory default: /home/IBM_USER/wks/snapper-perl/samples/pixmaps/
starting...
building xml...
checking pizza/.
checking pizza/MAIN.module
checking pizza/MAIN.module/widget
found ... MAIN.glade
writing widget: pizza/MAIN.module/widget/MAIN.glade
checking pizza/MAIN.module/scripts
found ... 001_main_window.pl
writing script: pizza/MAIN.module/scripts/001_main_window.pl
found ... 001_table_window.pl
writing script: pizza/MAIN.module/scripts/001_table_window.pl
found ... 999_startup.pl
writing script: pizza/MAIN.module/scripts/999_startup.pl
|
The compile command and the output are shown above, this
example uses the "-c" option that will produce an
executable perl script. If the "-c" option is
not specifed than an application XML file will produced.
This file can be activated via the snaprun graphical
launcher. The file is now ready to be executed.
Below is an example of starting the script and the main
window that will be displayed.
[bill@shark sample]$ ls -lF
README
perlmake/
pizza
pizza.pl
pizza_pg
robo
[bill@shark sample]$ perl pizza.pl
|
 |
Programs
Snapper consists of the following programs:
snapide |
Snapper Visual IDE Application |
snaprun |
Snapper graphical launch pad. This program is the
Snapper thin client and can activate a Snapper XML file.
It can be embedded in a Gnome menu for example.
|
snapmake |
Snapper make utility. This is the command line
program used to compile Snapper project files into a
single XML file or perl executable with embedded XML.
The Snapper IDE is the visual version.
|
snaputil |
The Snapper utility program generates new project
structures or explodes application XML files.
|
|