DependencyBrowser
Description
A tool for interactive edition and visualization of dependencies using a classic system-like browser in Squeak or Pharo Smalltalk.
Audience
This utility could be useful to whom it needs to arm a production release or just perform an early exploration of a package. From the following I will use Package indifferently to Class Category.
Installation
Once inside the image, use Monticello or Installer to install.
Installation in Squeak
" Copy, paste and select the following script in your image and doIt " | mc files fileToLoad version instClass | mc := Smalltalk at: #MCHttpRepository ifPresent: [:repoClass | repoClass location: 'www.squeaksource.com/Installer' user: 'squeak' password: 'squeak']. files := mc readableFileNames asSortedCollection: [:a :b | [ (a findBetweenSubStrs: #($.)) allButLast last asInteger > (b findBetweenSubStrs: #($.)) allButLast last asInteger ] on: Error do: [:ex | false] ]. fileToLoad := files detect: [ :aFile | aFile beginsWith: 'Installer-Core' ] ifNone: [ nil ]. version := mc versionFromFileNamed: fileToLoad. version workingCopy repositoryGroup addRepository: mc. mc creationTemplate: mc asCreationTemplate. version load. instClass := Smalltalk at: #Installer. instClass ss project: 'XMLSupport'; install: 'XML-Parser'; project: 'universes'; install: 'Universes'. instClass ss project: 'DependencyWalker'; install: 'PreDWFixes'. instClass universe update; addPackage: 'OmniBrowser'; addPackage: 'OmniBrowser-Standard'; addPackage: 'OmniBrowser-Morphic'; addPackage: 'OmniBrowser-Refactory'; addPackage: 'OB-Enhancements'; install. instClass ss project: 'DependencyWalker'; install: 'DependencyWalker'; install: 'OBDependencyWalker'; install: 'DWTraitsFix'; install: 'OBDWMethodNodeFix'
Installation in Pharo
" Copy, paste and select the following script in your image and doIt " | instClass | ScriptLoader loadOB. instClass := Smalltalk at: #Installer ifAbsent: [ ScriptLoader new installingInstaller ]. instClass ss project: 'DependencyWalker'. install: 'DependencyWalker'; install: 'OBDependencyWalker'; install: 'DWTraitsFix'
Opening Squeak
From the World Menu click in the "open..." item and choose the "Dependency Browser" option.
Opening Pharo
Open the browser from the World Menu, choose the "Tools" option, the "More" sub-item and then the "Dependency Browser" item.
Purpose of the Dependency Browser
Probably the use case most recurrent will be when you want to distribute a tool and you need to check which packages are needed before correct installation or utilization on target machine. This functionality is already provided in some Smalltalks by true package objects (some people call them "Components"), but one difference with this browser is the chance of interactive edition of dependencies using a classic system-like browser.
Currently the browser can visualize three major types of code dependencies:
- References: A reference dependency means the name of a class X is written inside a method, so if the class referenced belongs to another package and isn't installed in another image, then messages to the class which contain the method with the X reference won't work
- Inheritances: An inheritance dependency means the superclass X (of package A) of class Y (of package B) should be present in another image to be able to install Y without problems.
- Loose Methods: You have a loose method dependency when you add behavior to a class which belongs to another package, in this case you install a dependency because this new behavior needs the foreign class to work.
And finally one filter to show only the dependencies of packages that you've installed, that is, does not belong to the official image distribution.
The (R)eferences
- A dependency from a package A to another B, means there is a class reference in some method of a class belonging to A, within a method (class side or instance side) of some class belonging to package B.
- The first column lists the packages in the system (a.k.the categories of class), when a package A in this column is selected, the second column shows to the packages (or categories of class) of which depends the package selected in the first column.
- When an item B (package) is selected to on the second column, the third column shows the classes of the package (of the second column) involved in the dependency, that is to say, the classes being referenced, therefore, being required by A.
- When an item (class) of the third column is selected, the fourth column shows the classes pertaining to A that are those that realises the reference to the selected class in the third column.
- Finally, when an item in the fourth column is selected, in the fifth column are the methods of the class selected in the package, that they make the actual reference to the class.
The (I)nheritances
The (L)oose (M)ethods
The (N)on-(S)ystem Packages