13.07.2015 Views

Patterns of Tracing Software Structures and Dependencies

Patterns of Tracing Software Structures and Dependencies

Patterns of Tracing Software Structures and Dependencies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

eturn infoVars();...Sub-classes (e.g. in the application logic) can overload this operation <strong>and</strong> provide new INTRO-SPECTION OPTIONS. If the sub-class operation is not able to resolve an INTROSPECTION OPTION, itinvokes the info operation <strong>of</strong> its superclass.DiscussionINTROSPECTION OPTIONS are conceptually coupled with the structures they represent. For instance,one can ask the system which classes it consists <strong>of</strong>, a class which methods it contains,<strong>and</strong> a method which parameters it has. Therefore, INTROSPECTION OPTIONS should be added asoperations to the classes <strong>of</strong> the INDIRECTION LAYER representing a particular structure.If it is not possible to change a structure that should <strong>of</strong>fer INTROSPECTION OPTIONS, a MESSAGEINTERCEPTOR (together with MESSAGE REDIRECTOR or HOOK INJECTOR) can be used to intercept invocationsto INTROSPECTION OPTIONS <strong>and</strong> h<strong>and</strong>le them on its own. The MESSAGE INTERCEPTOR isthen used to simulate the introspective behavior.INTROSPECTION OPTIONS are always <strong>of</strong>fering introspective information at runtime. Still they canbe given for static structures <strong>and</strong> dynamic structures. In case <strong>of</strong> dynamic structures, it has to beensured that the INTROSPECTION OPTION reflects the current state <strong>of</strong> the architecture. This can bedone by calculating the INTROSPECTION OPTION on-the-fly. Or the INTROSPECTION OPTION is cachedin the INDIRECTION LAYER. Then we have to invalidate the respective INTROSPECTION OPTION in thecache when the dynamic architecture element changes.INTROSPECTION OPTIONS are bound to structures <strong>and</strong> thus should not be used for per-invocationinformation. These can be extracted with an INVOCATION CONTEXTS which are created per methodinvocation.The reflection pattern [Bus96] implements a variant <strong>of</strong> INTROSPECTION OPTIONS that uses a specialmeta-object type for the introspective information.INTROSPECTION OPTIONS provide one unified API for querying structural information. This informationis extracted from the INDIRECTION LAYER, <strong>and</strong> thus, it has to be maintained only once.However, providing such information statically (e.g. as metadata), instead <strong>of</strong> dynamic lookup,is usually faster. This problem can be avoided by caching INTROSPECTION OPTIONS after the firstlookup.Invocation ContextContextProblemYou want to extract invocation information, such as which method has called which othermethod, as trace information from a s<strong>of</strong>tware system.Invocation information are useful for building call graphs <strong>and</strong> evaluating metrics automaticallyat runtime. They are also important for object-oriented adaptations that relyon message exchanges: the invoked method requires the information which entity hasinvoked it. The invoking method should not have to provide the invocation informationas a parameter, because this solution is cumbersome <strong>and</strong> may result in interface incompatibilities.How to obtain the invocation information from inside <strong>of</strong> an invoked methodor a wrapper method without changing its interface?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!