This post briefly explains how to use cff (clone-find-flattened) while 
refactoring code. For sure I could not have completed the refactoring of 
Leo's atFile write code without using continuous, extensive use of cff.

First, two key ideas:

1. The clones produced by cff are short-term or medium-term data, easily 
created and easily dispensed with.

Such clones are *valuable*, but not *precious*. They will eventually be 
discarded.

2. Unlike tags (or any other kind of non-Leonine data), *the clones 
produced by cff can be reorganized*.

This is the priceless, unique advantage of clones.  You don't understand 
clones if you don't get this.

*Example*

1. While refactoring, it is essential to see all *actual* uses of a symbol 
(method, or ivar, whatever).

The starting point is to use cff to find all *potential* uses of the 
symbol.  If multiple files or classes use the symbol, you can use the 
suboutline-only option to limit the matches created by cff.

2. After finding all *potential *uses of the symbol, you can reorganize the 
resulting clones as follows:

- Delete nodes that are completely irrelevant.
- Squirrel away likely-irrelevant nodes in a new organizer node.
- Highlight the defining node, say by making it the preceding sibling of 
the cff node.
- Leave all *actual* uses of the symbol where they are.

3. You have now focused your attention on the nodes that will likely change.

You can now rerun the search *only on those cloned nodes* to see all 
*instances* of the symbol that might be changed.  This is a crucial double 
check on proposed changes.

*Summary*

I highly recommend that all Leonine programmers use the approach just 
described when refactoring code.

Neither tags, nor filters, nor refactoring packages can emulate the Leonine 
way of refactoring.

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