.. @+leo-ver=5-thin
.. @+node:ekr.20100805165051.7156: * @file design.txt
.. @@language rest
.. @@tabwidth -4

.. @+at @rst-options
..  call_docutils=False
..  code_mode=False
..  generate_rst=True
..  http_server_support = False
..  show_organizer_nodes=True
..  show_headlines=True
..  show_leo_directives=True
..  stylesheet_path=..\doc
..  write_intermediate_file = True
..  verbose=True
.. @@c

.. @+all
.. @+node:ekr.20050901101608.3: ** @rst html\design.html
##################
Designing with Leo
##################

This chapter discusses how outlines can improve the design of programs, web
sites and any other complex data. The more complex your program or data, the
more useful Leo becomes.

Furthermore, the same features that help with design also help with
implementation, maintenance and testing. In all cases, being able to organize,
understand and manipulate (script) complex data is what Leo does best.

.. contents::
    :depth: 2

.. @+node:ekr.20100807120250.4399: *3* Outlines embody design
Leo's outlines don't merely represent design. They often *are* the design.
Outlines effortlessly show relationships between class, methods or any other
data.

Outlines express design and structure directly. In most programs, the grouping
of functions into files, or the organization of a single file as a set of
functions, etc. 

Typical design tools are separate from the resulting product. With Leo, your
designs become your programs or web site.

Leo's outline pane always shows you the big picture, and the relationship of the
presently selected outline to that big picture. At all times you are aware of
both the overall design and all the intermediate levels of detail.

Outlines create new design dimensions.

There are many ways to express a program as a Leo outline. Such choices are
important. They add clarity to the entire program. These are different *kind* of
choices. They simply can not be expressed at all in other editors. In other
words, such choices exist in a new design space. 

Outlines add a new dimension to the design and coding process. Choices about
what sections do, what they are named, what order they appear in, are choices in
a design space different from "normal" programming. This an abstract concept, to
be sure. However, the previous paragraphs are really a manifestation of
working in this new design space.
.. @+node:ekr.20100807120250.4398: *3* Nodes hide details
Organizer nodes convey information about the structure and design of a large
system. Decoupling structure from content in this way is precisely what is
needed for flexibility: one can reorganize at will without worrying about
changing the meaning of the code.

Outlines clarify the shape of code

These last several paragraphs have discussed comments in detail because the net
effect of "putting comments where they belong" is that comments don't clutter
the code. Section references hide irrelevant detail, so larger-scale patterns
within functions (or declarations) become more apparent. Often just recasting
code into web format has created Aha's about my own code, with no special
attention to recoding or redesign! Recasting a function as a web raises the real
and apparent level of abstraction.

Organizer nodes eliminate mundane comments
The headline of an organizer node is often all that needs to be said.

Nodes create places for comments

Each of Leo's nodes provide a place for lengthy comments that do not clutter
other code. In practice this encourages comments where they are needed.

Outlines reduce the need for comments

Bridge or transition phrases are almost always unnecessary in a
Leo outline. One never needs to say something like, "having just finished
with topic x, we turn now to topic y."

Comments and formatting no longer have to indicate overall design; node do that.

Nodes reduce the visual "weight" of code

Nodes and their helpers (usually in child nodes) can be as complex as
necessary without affecting the organization of the outline. Moreover,
collapsed nodes are inconspicuous, no matter how many children they contain
and no matter how much code each child contains.
.. @+node:ekr.20100807120250.4400: *3* Clones create views
Typical browsers show you a fixed view of code. In contrast, Leo allows you to
organize your programs as *you* want, and *Leo remembers your organizations*.

Furthermore, Leo does not constrain you to a single "right" view of your data,
programs or designs. By using clones, a single outline may contain dozens or
even thousands of views of the nodes in the outline. You are free to create a
new view for every new task or project.

Finally, you can insert organizer nodes anywhere in an outline, including
anywhere in any view. Organizer nodes do not change the meaning of programs,
html pages or web sites, yet they can clarify and simplify designs, programs,
web sites or data.
.. @+node:ekr.20100807120250.4401: *3* Nodes create context
Nodes naturally provide **useful** context. For example, @button and @test nodes.

Outlines provide a convenient way of expressing the intended scope of commands.
Many of Leo's commands operates on the presently selected tree.
.. @-all
.. @-leo
