<?xml version="1.0" encoding="ISO-8859-1"?>
<screenbook>
<title realName="B6 What is Leo - Continued">What is Leo - Continued</title>
<category realName="Leo">Leo</category>
<subcategory realName="Basics">Basics</subcategory>
<format realName="Tutorial">Tutorial</format>
<description>This tutorial continues the introduction to Leo - the unique Literate Programming Tool.</description>
<keywords>Leo introduction programmer's outlining editor</keywords><ldate>8/12/2002</ldate><version>draft</version>
<locations>
<location>
C:\testtt\Leo\Basics\Tutorials\B6 What is Leo - Continued\</location>

</locations>

<pages>
<page>
<text>

<span id="pagetext"><![CDATA[<p> In the first tutorial in this series, we saw the basic outlining and file derivation features of Leo. Let's take a further look at how Leo's&#160;derived file functions&#160;can be put to use.&#160;We will use the creation of a computer program as an example, however, the operations are useful in other situations involving&#160; complex text documents.</p>]]></span>

</text>
<picture>[Empty]</picture>
<title>Continuing...</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p><strong>A note for programmers:</strong> this&#160;tutorial, in addition to being an illustration of more file derivation operations, is an introduction to how Leo can facilitate a new kind of <a href="http://www.literateprogramming.com">Literate Programming</a> .&#160;Rather than&#160;further clarify what this means now, we'll just show an example.&#160;More information about Literate Programming is available in the documentation that comes with Leo.&#160;But keep in mind that the problem to be solved by literate programming is to provide an easy-to-understand road map to a complex programming project. Using Leo, you plan your code, explain it, and write it all in the same document. You use English, not a new language like UML, and you can explain and describe all levels of structure in as many ways as you want - not just classes and methods.</p>]]></span>

</text>
<picture>[Empty]</picture>
<title>Literate Programming</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Here we've just opened Leo.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic03.png</picture>
<title>Open Leo</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>&#160;<a href="http://newinstance.com/writing/javaxml2/javaxml2_examples.html">This website</a>&#160;has examples from the highly recommended&#160;<a href="http://www.amazon.com/exec/obidos/asin/0596001975/qid=1028202229/sr=2-1/ref=sr_2_1/103-6904210-2103851/jsl">Java and XML</a>&#160;book by Brett McLaughlin. We're going to download the&#160;Chapter 6 examples.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic04.png</picture>
<title>Java and XML examples</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Here we've unzipped the examples, and have selected the folder containing the java files.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic05.png</picture>
<title>The examples are unzipped</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Now back to Leo. We are going to import the java files.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic06.png</picture>
<title>Back to Leo.</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Here we have navigated to the folder containing the java files, and will select the first Java file.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic07.png</picture>
<title>Select the first Java file</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Leo has imported the file.</p><p>The <strong>@file</strong> directive shown in the highlighted headline is similar to the <strong>@root</strong> directive shown in the first tutorial.&#160;The <strong>@file</strong> directive is explained in greater detail later in this tutorial.&#160;</p><p> The <strong>@language</strong> directive indicates that Java syntax highlighting will be used. The <strong>@others</strong> directive indicates that all <strong>unnamed&#160;</strong> sections will be derived. An unnamed section is a node defined without angle brackets.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic08.png</picture>
<title>Leo has imported the file</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>By expanding the nodes, you can see that Leo has automatically put each class and method in a separate node when importing the Java file.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic09.png</picture>
<title>Leo has automatically created an outline</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Here we have imported the other two Java files.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic10.png</picture>
<title>Two more Java files imported</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p> Let's suppose we're interested in working on the <strong>UpdateItemServlet.java</strong> class.</p><ol> <li/>Select the <strong>doPost</strong> method. <li/>The body of the method appears in the text pane. </ol><p>Leo has automatically broken down the program by method. But there are still 200 lines of code in the <strong>doPost</strong> &#160;node.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic11.png</picture>
<title>The doPost node</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p> Let's break the <strong>doPost</strong> method down further. First we type in a new section / node name.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic12.png</picture>
<title>Breaking down the node further</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Now we select all of the code (text - light grey) we want to go into our new section.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic13.png</picture>
<title>Select code for the section</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>We then choose&#160;<strong>Edit - Edit Body - Extract Section</strong>.&#160;</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic14.png</picture>
<title>Extract Section.</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>You can see that</p><ol> <li/><strong>The new node has been added. </strong> <li/><strong>The selected code has been extracted</strong> from the current section, leaving only the section indicator. </ol>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic15.png</picture>
<title>The new node has been added.</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>And when we select the new node in the outline window, we can see that the code has been pasted into our new section as expected.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic16.png</picture>
<title>The code has been pasted into the new section</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>In this way, you can continue to break down the program, making it much easier to focus on areas that you want to work on or study. You can add more files - in addition to adding the java files, you can add all of the xml, htm, wsd, and other files that come with this particular project. Of course, you can also add new nodes and text, as shown in the first tutorial.</p><p>But not only can you&#160;break the program down into smaller parts, you can also regroup parts of the program into different views. You can make a new branch in the outline that rearranges existing parts of the outline in a different way. To see this feature in action, read the <strong>Outlines</strong>&#160;tutorial of this tutorial series, or view some of the tutorials in the <strong>Examples</strong> section of this tutorial series.</p>]]></span>

</text>
<picture>[Empty]</picture>
<title>You can continue to break down the program</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>A couple more notes about the <strong>@file</strong> directive: in contrast to the <strong>@root</strong> directive we saw in the first tutorial, there is no need to untangle or tangle if you use this directive. This is because in this case Leo embeds all of the outline information in the derived file,&#160;and then&#160;in effect<strong>tangles</strong> or <strong>untangles</strong> from the derived file whenever the&#160;.leo file is opened or saved.&#160;</p><p>Let's examine this more closely. First, save the file.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic18.png</picture>
<title>About the @file directive.</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>We've saved the file as "sample.leo" in the same folder as the java files.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic19.png</picture>
<title>We've saved the file</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>We've</p><ol> <li/>selected our new node again, and <li/>added a line of code. </ol>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic20.png</picture>
<title>Add a line of code.</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>We hit <strong>[CTRL-S]</strong> to save, and the changes are written to <strong>UpdateServlet.java</strong> .</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic21.png</picture>
<title>Save, and the changes are written to UpdateServlet.java.</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Now we close Leo, and look at the folder with our java files in Windows Explorer. We'll open the <strong>UpdateItemServlet.java</strong> file with a text editor.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic22.png</picture>
<title>Windows Explorer.</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Looking at&#160;&#160;<strong>UpdateItemServlet.java</strong> in a text editor, we can see that Leo has updated the file to contain</p><ol> <li/>Outline information embedded as a java comment. <li/>Our code change. </ol>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic23.png</picture>
<title>Leo has updated the file</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>Now let's add some code using the text editor.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic24.png</picture>
<title>Add some code with text editor</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>We save the text file, then open the our Leo outline again.</p><p> Leo opens&#160;right back to where we were, and we can see that the code we added has been read into our outline.</p><p>This means that you can transparently switch back and forth between Leo and the editor or programming tool of your choice, and each time Leo will remember your outline.</p>]]></span>

</text>
<picture width="640" height="480" ldate="" id="pagepic">pic25.png</picture>
<title>Save the text and open in Leo</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
<page>
<text>

<span id="pagetext"><![CDATA[<p>This concludes the basic introduction to Leo, but to actually use it you'll need to know a little more. You'll need to learn how to make an outline, and perhaps a little more about derived files.&#160;It should take about fifteen minutes to learn most of the operations you need to be proficient. But first, read on to the next tutorial, where you can learn how to install Leo.</p>]]></span>

</text>
<picture>[Empty]</picture>
<title>Summary</title>
<author>Joe Orr</author>
<sauthor>[Empty]</sauthor>
<cp>Copyright 2002 All Rights Reserved</cp>
<authoremail>orrj@jserv.com</authoremail>

</page>
</pages>
</screenbook>


