. .


Upgrading: Find All the Overridden Class Definitions

December 14, 2010 13:15:37.000

I've upgraded BottomFeeder from one rev of VW to another multiple times now, so I have a pretty good feel for looking at overrides - but on this new job, I wanted something bit more formal than "eyeball the bundle and look for red, bolded classes". So, I wrote a small reporter that starts out with this, in the older version of VW:

| overriddenClasses records |
	overriddenClasses := SmalltalkWorkbench sortedClasses select: [:each | Override isOverriddenClassOrNameSpace: each].

That collects all of the classes in the current image where the class definition is an override. Usually, that means that a developer has added one or more instance variables to the class for an application (or tool) specific reason - although in this app, there are two such overrides where the class definition hasn't changed. That likely means someone bailed on a modification at some point, but neglected to remove the override.

Anyway - with that information in hand, I just bossed out some basic data - the full name of the class (i.e., full namespace qualification) and the array of instance variable names. Then I loaded that information into a 7.7.1 image, got the class from the string name, and grabbed the array of instance variables for each of those. With the two sets of data sitting in an object, it's easy to do some basic comparisons. Useful, and not at all difficult.

Technorati Tags: ,

posted by James Robertson

 Share Tweet This