Object-oriented reengineering patterns :)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Object-oriented reengineering patterns :)

Stéphane Ducasse
In changeList

browseCurrentVersionsOfSelections
        "Opens a message-list browser on the current in-memory versions of all methods that are currently seleted"
        | aList |

        aList := OrderedCollection new.
        Cursor read showWhile: [
                1 to: changeList size do: [:i |
                        (listSelections at: i) ifTrue: [
                                | aClass aChange |
                                aChange := changeList at: i.
                                (aChange type = #method
                                        and: [(aClass := aChange methodClass) notNil
                                        and: [aClass includesSelector: aChange methodSelector]])


contentsDiffedFromCurrent
        "Answer the contents diffed forward from current (in-memory) method version"

        | aChange aClass |
        listIndex = 0
                ifTrue: [^ ''].
        aChange := changeList at: listIndex.
         (aChange type == #method
          and: [(aClass := aChange methodClass) notNil
                 and: [aClass includesSelector: aChange methodSelector]]) ifTrue:

destroyCurrentCodeOfSelections
        "Actually remove from the system any in-memory methods with class and selector identical to items current selected.  This may seem rather arcane but believe me it has its great uses, when trying to split out code.  To use effectively, first file out a change set that you wish to split off.  Then open a ChangeList browser on that fileout.  Now look through the methods, and select any of them which you want to remove completely from the system, then issue this command.  For those methods where you have made changes to pre-existing versions, of course, you won't want to remove them from the system, so use this mechanism with care!"

        |  aClass aChange aList |
        aList := OrderedCollection new.
        1 to: changeList size do:
                [:index |
                        (listSelections at: index) ifTrue:
                                [aChange := changeList at: index.
                                (aChange type = #method
                                        and: [(aClass := aChange methodClass) notNil
                                        and: [aClass includesSelector: aChange methodSelector]])
                                                ifTrue:

and a couple more....
I like old design. It is sweet and you feel cool when you fix it.

Stef


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project