The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Class Heirarchy Depth

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Class Heirarchy Depth Posted: May 12, 2006 1:51 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Class Heirarchy Depth
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

Time for another fun image statistic query. Randy Coulman shared this wonderful quote with me once, paraphrased it goes something like:

"In most languages where inheritance is singular, it's a card you only get to play once, so you'd better play it wisely"

There's this phase many go through in the "Smalltalk Exodus" where you are tempted to go nuts with abstraction. Breaking your problem down to the umpteenth layer of abstraction levels. Classification is something enjoys taking a crack at. In time, you discover the above quote be experience and you don't go quite so nuts anymore. Looking at some code in VisualWorks base image, I was inspired to inspect the following snippet:

(Object withAllSubclasses groupedBy: [:each | each allSuperclasses size) associations asSortedCollection

The deepest award goes to WinXPToolbarButtonView and WinXPSpinButtonView. Both of which have 15 superclasses between them and Object. In fact, there are a lot of look-and-feel related visual objects that have 15, 14, 13, & 12 superclasses between them and Object. In fact, in my image, they're the ONLY ones that occupy this distance from Object. The first object to show up that is of not that ilk is ExternalDictionary which has 11. And a couple of RefactoringBrowser objects occupy this tier. I think the deepest I found of our own code was at the 10 level. What's yours?

It is also kind of fun to histogram all of the classes in the image with this value. A minor twist to the above gives us the data:

((Object withAllSubclasses groupedBy: [:each | each allSuperclasses size) associations collect: [:a | a key -> a value size) asSortedCollection

In my image, I get the following (this has our code as well as a well populated development image):

Superclass Count Number of Classes
0 1
1 760
2 1171
3 792
4 694
5 1189
6 1403
7 883
8 716
9 452
10 253
11 99
12 30
13 28
14 24
15 11
16 2
Looks like 6 is the sweet spot.

Read: Class Heirarchy Depth

Topic: Answering the Enterprise Architect Previous Topic   Next Topic Topic: PS3 Launch Details

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use