The docs for the new importer 
<https://github.com/leo-editor/leo-editor/blob/master/leo/doc/importers.md> 
are a personal Aha. Imo, they are some of best docs ever because they 
consciously avoid *all* detail. The Notes section is an exception: it 
discusses things that appear nowhere in the source code! The docs don't 
explain the code, they invite the reader to explore the code.

Two principles emerge:

1. The less said, the better.
2. Invite people to learn for themselves.

Let's put these principles into practice. Let's think of the Code Academy 
not as explanations, but as puzzles to be solved by the student. The 
puzzles themselves need no lengthy explanations.  They can even be cryptic.

*Puzzles for the Code Academy*

1. Pick a real, worthy, programming task that you (the student) personally 
want/need to do in Leo.

*This step is essential!* It's useless to try to learn in a vacuum.

EKR's first python program was C2Py 
<https://github.com/leo-editor/leo-editor/blob/master/leo/scripts/c2py.md>. 
Note: @c confuses markdown.  I'll revise the script soon.

2. Overcome fear of crashes and mistakes.

- Run Leo from a console.
- Single-step through your code with g.pdb()
- Deliberately put a crasher in your code and see what happens.

The only way to hard crash Leo is to pass bad pointers to PyQt.  Python 
should catch all other problems.  If it doesn't, report a bug to the python 
people ;-)

3. Discover how Leo's code works:

- Where is Leo's source code? Hint: look for leoPy.leo in LeoDocs.leo.
- Look at Leo's demote command.
  - What are three ways of finding the demote command?
  - How does demote change the outline?
  - How does demote handle undo?
- Study any other Leo command that relates to your project.
- Use the cff command to find all definitions of x.
- Use the cff command to find all uses of x.

4. Start using Leo for real:

- Add a new command using @button.
- Create an external file containing your real-world project. Execute it 
outside of Leo.
- Write a Leo plugin.
- Advanced: fix one of Leo's bugs.

Edward

P.S. This post is a direct result of our recent discussions here 
<https://groups.google.com/forum/#!topic/leo-editor/mfJeFJpl0jM>.

P.P.S The importer docs mostly just explain the *shape* of the code. But in 
Leo, such overviews are typically not needed!  Provided the author of code 
takes a bit of care, the outline *already* shows the shape of the code. 
That's why we love Leo. Furthermore, he shape of the code persists, not 
just in our memory, but in the outline.

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to