How would you sort these classes by dependency?
Here are the last 168 classes remaining in Spoon. I’m sorting them into a graph of dependent modules for the next release. How would you do it? Suggestions welcome.
ArrayedCollection Collection SequenceableCollection Array ByteArray Interval LinkedList OrderedCollection SharedQueue SortedCollection Association Link LookupKey ReadOnlyVariableBinding WeakKeyAssociation Character String Symbol Dictionary IdentityDictionary IdentitySet Set WeakArray WeakIdentityKeyDictionary WeakKeyDictionary WeakRegistry WeakSet Behavior Class ClassBuilder ClassDescription Metaclass Magnitude Time BlockContext CompiledMethod ContextPart InstructionStream Message MethodContext MethodDictionary Float Integer LargeNegativeInteger LargePositiveInteger Number Random SmallInteger Boolean False Object True UndefinedObject Delay Process ProcessorScheduler Semaphore HTTPServer HTTPAction ExceptionMarker OtherMarker RemoteMethod ClassID MethodID Module ModuleDescription Version AuthorEdition BehavioralEdition Checkpoint ClassEdition CommentEdition CommentedEdition Edit EditHistory Edition MetaclassEdition MethodEdition ProtoclassEdition TaggedEdition TagsEdition Apache GPL GPL3 License MIT Squeak BehavioralLiteralMarker ClassLiteralMarker ClassVariableLiteralMarker GlobalLiteralMarker IdentityLiteralMarker MetaSuperSendLiteralMarker MethodLiteralTransmissionMarker PublishedVariableLiteralMarker SharedVariableLiteralMarker UndeclaredLiteralMarker Manifest NegativeManifest PositiveManifest DescribeModule BrowseAvailableModules EmitFavoritesIcon InstallRemoteModule ListInstalledModules ModuleAction Quit RemoteModuleAction RemoveModule RunRemoteModule Snapshot Welcome UUID UUIDGenerator CounterpartRequest IncomingMessageExchange MessageExchange MessagingServer MessagingSession Other OutgoingMessageExchange RemoteMessageAnswer Wormhole WormholeServer Scanner Halt BlockCannotReturn Error Exception ExceptionAboutToReturn Notification ZeroDivide ConnectionRefused EncodingMismatch ExternalResourceError FailedReadingAttempt InvalidPositioningAttempt StreamingError Timeout MethodReference Interpreter ObjectMemory PositionableStream Stream WritableStream Correspondent Server SocketAddress SocketAddressResolver ExternalSemaphoreTable Client IncomingClient IncomingHTTPClient OutgoingClient SocketTransport Transport ExternalStream NetStream SocketStream TCPStream ExternalResource Peer ClientTCPSocket IncomingClientTCPSocket OutgoingClientTCPSocket ServerTCPSocket Socket TCPSocket
20 June 2011 at 5:33 pm
This discussion seems apropos to what you want:
http://forum.world.st/Topological-sort-of-classes-td3361182.html
LikeLike
20 June 2011 at 6:00 pm
I would try the obvious first – create a set of associations X->Y by looking at each class X’s methods and checking all Ys present as a literal or as part of an association which is a literal. Then I would look at all instances of X and for each instance variable add X->Y where Y is the class of the value of that instance variable.
Any circular references in the result, such as A->B and B->A or else A->B, B->C, C->D and D->A, indicate groups of classes that can’t really be ordered. Other than that, sort the list such that if A->B is present in the set then class A comes after class B in the list.
LikeLike
21 June 2011 at 3:13 pm
How do you define the dependency for each class?
LikeLike
21 June 2011 at 3:20 pm
I was interested in conceptual dependency, the order in which you would explain these classes to someone who knew nothing about Smalltalk. I think I’ve come up with a good one; see https://thiscontext.wordpress.com/2011/06/20/initial-spoon-modularization/.
LikeLike