ViewVC logotype

Contents of /trunk/docs/faq.html

Parent Directory Parent Directory | Revision Log Revision Log

Revision 19 - (show annotations)
Thu Nov 19 23:05:35 2009 UTC (4 years, 5 months ago) by astalla
File MIME type: text/html
File size: 11013 byte(s)
Minor updates in the docs.
1 <html>
2 <head>
3 <title>Snow FAQ - Fictionally Asked Questions</title>
4 <link rel="stylesheet" type="text/css" href="style.css">
5 </head>
6 <body>
7 <h1>Snow FAQ - Fictionally Asked Questions</h1>
8 <h3>That is, questions I'd like to be asked. Snow has too few users for &quot;Frequently&quot; to mean something relevant ;-)</h3>
9 <ol>
10 <li><a href="#general">General questions about Snow</a>
11 <ol>
12 <li><a href="#ch001">So, what is Snow?</a></li>
13 <li><a href="#ch002">Which technologies is Snow built upon?</a></li>
14 <li><a href="#ch007">Who is Snow targeted at?</a></li>
15 <li><a href="#ch008">Am I really forced to use Swing if I use Snow? What about SWT or other GUI libraries?</a></li>
16 <li><a href="#status">What is the current status of Snow? How much of Swing is covered?</a></li>
17 <li><a href="#license">Which license is Snow distributed under?</a></li>
18 </ol>
19 </li>
20 <li><a href="#java">Questions for Java programmers</a>
21 <ol>
22 <li><a href="#ch003">Common Lisp? What the heck is that?</a></li>
23 <li><a href="#ch004">Uhm, and what does Snow code look like?</a></li>
24 <li><a href="#ch005">Whoa! Why all those ugly parentheses?</a></li>
25 <li><a href="#ch006">Then why not use XML like everyone else?</a></li>
26 </ol>
27 </li>
28 <li><a href="#lisp">Questions for Lisp programmers</a>
29 <ol>
30 <li><a href="#otherlispguis">How does Snow compare to other mature Common Lisp GUI toolkits, like LTK or Cells-GTK?</a></li>
31 </ol>
32 </li>
33 <li><a href="#use">Installing and using Snow</a>
34 <ol>
35 <li><a href="#ch009">Ok, Snow is great! Now, how do I use it in my application?</a></li>
36 </ol>
37 </li>
38 </ol>
39 <a name="general" /><h2>General questions about Snow</h2>
40 <a name="ch001" /><h3>So, what is Snow?</h3>
41 Snow is a declarative language (DSL) targeted at building graphical user interfaces based on the Java Swing GUI library.
42 It is somewhat similar in spirit to <a href="http://www.mozilla.org/projects/xul/">XUL</a> or <a href="http://www.swixml.org/">SwiX<sup>ml</sup></a>, while adopting a unique approach which has many advantages over XML + scripting languages. Snow is a fully interactive language - you can prototype your GUI at the read-eval-print loop and see the results immediately, without a lengthy batch compilation phase.
43 <a name="ch002" /><h3>Which technologies is Snow built upon?</h3>
44 Snow is written in a combination of <a href="http://java.sun.com/">Java</a> and Common Lisp (particularly its implementation
45 <a href="http://common-lisp.net/project/armedbear/">ABCL</a>, which runs on the JVM). It uses <a href="http://www.miglayout.com/">MiG Layout</a>
46 for declarative, CSS-like component layout, <a href="https://binding.dev.java.net/">JGoodies Binding</a> for data binding (communication between the GUI and the application code) to Java objects, and a slightly modified version of Ken Tilton's Cells library to do the same thing (and more) with Lisp.<br />
47 Snow can be thought of as a GUI extension for ABCL, and indeed it provides the GUI counterparts of some of ABCL's facilities - the REPL, a minimal debugger, and the inspector - although the main objective of Snow is to be a GUI library, and these add-ons exist more as examples of what Snow can do.
48 <a name="ch007" /><h3>Who is Snow targeted at?</h3>
49 Snow is meant to be useful both to Lisp developers looking for an easy, cross-platform GUI solution, and Java developers in search of an easier way to write Swing code without sacrificing too much flexibility, as it is often the case with GUI editors. It can be used in a Lisp application without writing
50 any Java, and it can be used in a Java application writing only a minimal amount of Lisp code (that is, the GUI code itself and little
51 or no else). Of course, writing in a mix of the two languages might be necessary if you want to do something advanced, like writing
52 your custom components in Java and integrating them with Snow. This practice is likely to be less frequent than when you write Swing code in Java, because Snow makes it easier to use aggregation rather than inheritance for component creation. Still, you may need to, e.g., use third-party components, or override some method in your custom component - in this case you need to write a little Lisp glue code to make Snow aware of your components.
53 <a name="ch008" /><h3>Am I really forced to use Swing if I use Snow? What about SWT or other Java GUI libraries?</h3>
54 While Snow's API follow quite closely those of Swing (in terms of names of components, properties, layouts, ...), some care has been taken to make it possible to plug in other GUI backends. No other backend besides the Swing one currently exists, and the author has not enough time and expertise in SWT to create an SWT one, but it should be quite possible in principle, with the necessary adaptations.
55 <a name="status" /><h3>What is the current status of Snow? How much of Swing is covered?</h3>
56 I consider Snow's core to be quite stable, although young. Coverage of Swing is poor, only a bunch of components are supported, and even those only have few properties mapped. This means Snow at this stage is too incomplete to be used in production; it can only showcase the basic ideas behind it. However, I'm slowly working on adding more components: if you're interested in one in particular, drop me a line, I'll be happy to prioritize work on it.
57 <a name="license" /><h3>Which license is Snow distributed under?</h3>
58 The same license as ABCL and GNU Classpath, that is, GNU GPL + the classpath exception. Basically this means you can link your code to Snow without having to release it under the GPL. The GPL still applies to modifications to Snow itself.
59 <a name="java" /><h2>Questions for Java programmers</h2>
60 The following questions are more likely to interest Java programmers. You may skip them if you aren't interested in Java, and/or you already know Lisp.
61 <a name="ch003" /><h3>Common Lisp? What the heck is that?</h3>
62 The ANSI standard Common Lisp is a language in the Lisp family, one of the oldest families of programming languages still in use.
63 It is a multi-paradigm, dynamic language with very regular syntax and advanced features that make it great for prototyping and exploration of new ideas, yet solid and fast enough to build big systems. Common Lisp
64 can be both interpreted and compiled. Thanks to the work of Peter Graves and the people who took care of developing ABCL after Peter stopped working on it, Common Lisp is today one of the languages that can run on the Java Virtual Machine.
65 <a name="ch004" /><h3>Uhm, and what does Snow code look like?</h3>
66 Here is an example:<br />
67 <pre class="paste-area">
68 (frame (<span class="lisp-keyword">:title</span> <span class="lisp-string">"Snow Example"</span> <span class="lisp-keyword">:visible-p</span> t)
69 (panel (<span class="lisp-keyword">:layout</span> <span class="lisp-string">"wrap"</span>)
70 (button <span class="lisp-keyword">:text</span> <span class="lisp-string">"Hello, world!"</span>
71 <span class="lisp-keyword">:on-action</span> (<span class="lisp-special-op">lambda</span> (event)
72 (<span class="lisp-cl-function">print</span> <span class="lisp-string">"Hello, world!"</span>)))))
73 </pre>
74 <a name="ch005"/><h3>Whoa! Why all those ugly parentheses?</h3>
75 That's Lisp, baby! If it looks alien, you can just pretend it's XML in disguise: imagine the example above like
76 <pre class="paste-area">
77 &lt;frame <span class="lisp-keyword">title</span>=<span class="lisp-string">"Snow Example"</span> <span class="lisp-keyword">visible</span>=<span class="lisp-string">"true"</span>&gt;
78 &lt;panel <span class="lisp-keyword">layout</span>=<span class="lisp-string">"wrap"</span>&gt;
79 &lt;button <span class="lisp-keyword">text</span>=<span class="lisp-string">"Hello, world!"</span>
80 <span class="lisp-keyword">on-action</span>=<span class="lisp-string">"function(event) { print('Hello, world!'); }"</span> /&gt;
81 &lt;/panel&gt;
82 &lt;/frame&gt;
83 </pre>
84 <a name="ch006" /><h3>Then why not use XML like everyone else?</h3>
85 While Snow (and to some extent Lisp) is structurally similar to XML due to its tree-based form,
86 the similarity ends here.<br />
87 XML is a markup language meant to describe documents or structured data. It *can* be perverted enough to use it as the syntax of
88 a programming language (see <a href="http://www.xsharp.org/">X#</a>), but the results are not exactly pretty (in this FAQ author's
89 humble opinion).<br />
90 Lisp, on the other hand, has been a full programming language from day one. See how in the fictional XML translation of Snow above a pseudo-JavaScript in an XML attribute was used to define an action, while in the original example an anonymous Lisp function was used - which is not a string to be fed to some external interpreter, but real Lisp code, which can e.g. be factored out in a function, compiled, easily tested in isolation and so on.<br />
91 Consider also that you can mix &quot;regular&quot; Lisp code with Snow with no problems, thus getting much more dynamicity in building your GUI:
92 <pre class="paste-area">
93 (label <span class="lisp-keyword">:text</span> (if (some-condition-holds) <span class="lisp-string">"Yes!"</span> <span class="lisp-string">"No!"</span>))
95 (list-widget <span class="lisp-keyword">:model</span> (make-list-model (generate-my-list-model-at-runtime)))
97 (<span class="lisp-cl-macro">dotimes</span> (i 42) <span class="lisp-comment">;creates 42 labels with the text "Label No. n".</span>
98 (label <span class="lisp-keyword">:text</span> (str <span class="lisp-string">"Label No. "</span> i)))
99 </pre>
100 and so on. You can't do that with XML unless you have a mechanism like e.g. JSP taglibs, and even that is not as easy and powerful.
101 Furthermore, Lisp supports and encourages interactive programming: you can try and test your code while you write it, without
102 recompiling, restarting, or redeploying anything.
103 <a name="lisp" /><h2>Questions for Lisp programmers</h2>
104 The following questions are more likely to interest Lisp programmers. You may skip them if you're only interested in Java.
105 <a name="otherlispguis" /><h3>How does Snow compare to other mature Common Lisp GUI toolkits, like LTK or Cells-GTK?</h3>
106 Snow is much younger, and much more incomplete, than most other GUI toolkits available in Common Lisp. At this stage, I'd suggest that you use Snow only if you need a CL GUI app that closely interoperates with Java, or if you need your GUI to run on all the platforms the JVM runs on and you can't use a CL implementation (besides ABCL) that runs on all those platforms. That said, Snow already supports Cells (although it needs a modified version - distributed together with it - that can run on ABCL).
107 <a name="use" /><h2>Installing and using Snow</h2>
108 <a name="ch009" /><h3>Ok, Snow is great! Now, how do I use it in my application?</h3>
109 Refer to the <a href="tutorial.html">tutorial</a> for installation instructions and a brief explanation of Snow.
110 </body>
111 </html>


Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5