For me at least, it's really easy to do more work than necessary during 
development, when just a bit of forethought would have paid off handsomely.

For example, I recently tweaked the clean_headline method for the 
javascript importer.  Here is a list of my mistakes:

*Mistake 1:* Thinking that this project would be quick ;-) Had I known that 
I would spend several hours on it I might have spent more time making each 
iteration easier.

*Mistake 2*: To test this I *reopened* ekr.leo, my personal test outline.  
I then executed a node containing just a call to c.recursiveImport.

I then *manually expanded* the resulting outline with expand-all-subheads 
and looked at the results. 

Doing expand-all-subheads was surprising clumsy.  Only much later did I 
realize (Doh!) that the following would work: 

c.recursiveImport(...)
c.expandAllSubheads()

This works because c.recursiveImport() selects the newly-created top-level 
node and c.expandAllSubheads() works on the presently selected node.

*Mistake 3*: Not using a unit test to drive development.  That is, not 
using the "stupendous Aha".  At last I created the following @test node:

g.cls()
import imp
import leo.plugins.importers.javascript as js
imp.reload(js)
x = js.JS_Importer(c.importCommands)

table = [
    '''window.addEventListener('mouseup', function (e) {''',
    '''window.addEventListener ('message', function (e) {''',
    '.then((response) => {',
]
for s in table:
    print(s)
    h = x.clean_headline(s, trace=True)
    print(h)
    print('')

Not great, but it uses imp.reload so that I didn't have to reload ekr.leo 
to test problematic cases.

*Mistake 4*: Not using imp.reload in the recursive import script.

*Mistake 5*: Not binding a keystroke to the recursive import script.

*Summary*

This has been a catalog of impatience creating more work than necessary in 
the long run.

Edward

-- 
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