From: Jeff Schilling Date: 2002-03-29T01:46:51+09:00 Subject: RE: Prototyping in Ruby and UML-ish model extraction. The smalltalk refactoring browser http://st-www.cs.uiuc.edu/users/brant/Refactory/ uses a similar technique called method wrappers to devine type @ runtime for refactored callers. http://emw.inf.tu-dresden.de/de/pdai/Forschung/refactoring/refactoring_html/ node40.html discusses this a little bit. Brant et al discuss the technique of method wrappers here: http://citeseer.nj.nec.com/189005.html the idea sounds feasible. Use reflection to annotate/wrap the methods with a dynamic proxy. Capture the info at runtime. Voila. The devil is as they say in the details. -Jeff -----Original Message----- From: Kent Dahl [mailto:kentda@stud.ntnu.no] Sent: Thursday, March 28, 2002 2:51 AM To: ruby-talk ML Subject: Prototyping in Ruby and UML-ish model extraction. Hi. I'm prototyping something in Ruby, and I was wondering how difficult it would be to extract UML relation information from Ruby code directly. Now, as RDoc and Ruby reflection go, getting classes, parents and methods are no problem. However, since UML has a more statically typed mindset wrt relation between classes and instance variables only spring into existance when actual objects are created, I feel I'm left with a class inheritance graph, but no real relation data. So here is my idea: Hook into _everything_ for the newly created classes, recording what arguments are passed to what objects, what is in the instance variables at the exit of methods, and then run the UnitTests or fire up some dummy data instances. For instance, upon seeing that method "add" is called with both Student objects and Employee objects, one could traverse up the inheritance tree until we find the Person class which they both inherit from. Similarly for instance variables. Keep tab of what kind of objects go into them, and walk up the inheritance tree until the common ancestor is found, effectively deducing the static type info that you'd use to draw up the relation in UML. Does this sound even remotely feasible? Anyone try anything similar? Thoughts on whether this would be worth the effort? -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )__(stud.techn.; ind. econ & management: computer technology)__( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/