1 / 18

Modeling Aspects by Category Theory

Modeling Aspects by Category Theory. Serge P. Kovalyov Novosibirsk, Russia. FOAL 2010. Aspect-oriented software development. Mission: explicit separation and composition of concerns Motivation Concerns are tangled Concerns crosscut modular architecture bounds

keene
Download Presentation

Modeling Aspects by Category Theory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Modeling Aspects by Category Theory Serge P. Kovalyov Novosibirsk, Russia FOAL 2010

  2. Aspect-oriented software development • Mission: explicit separation and composition of concerns • Motivation • Concerns are tangled • Concerns crosscut modular architecture bounds • Traceability is compromised (ability to determine what each fragment of the system is included into it for) • Proposed solution • Equip program models with traces of refinements that produce them from concerns (i.e. “label” programs by concerns) • Explicitly identify, compose (weave), and separate concerns • Application: enhance modular design technologies with aspect handling capabilities • FOAL 2010

  3. Category-theoretic formalization • Explicit definition of intuitive notions • Objects (things) • Morphisms (connections) • Functors (translations) • Describing objects via relations with similar objects • Avoiding appeal to “interiors” of objects • Constructing object by systemic criteria • Universality (existence and uniqueness of connection with similar objects) • Naturality (independence of the result on the way it is reached) • Formal specification and verification of systemic properties • Complexity • Modularity • Traceability • FOAL 2010

  4. Category of descriptions • Category c-DESC • Objects are formal models of programs (descriptions) • Morphisms are actions of integrating components into systems • Composition is multistep integration • Identity morphisms are “doing nothing” • Example: category of UML classes and inheritance relations • Scenario modeling • Category Pos • Objects are partially ordered sets (posets) of events ordered by causal dependence • Morphisms are poset homomorpisms (preserving events and ordering) • FOAL 2010

  5. Diagrams • c-DESC-diagram • Functor  : Xc‑DESC • Graph of X labeled by c‑DESC-objects and c‑DESC-morphisms • Cocone • Natural transformation of a diagram (base) to a singleton (vertex) • Colimit of a diagram  • Universal cocone with base  • Minimal “container” that encapsulates objects of  respecting their interconnections • FOAL 2010

  6. Configurations • Well-formed configuration • Is a c-DESC-diagram (of components and their interconnections) • Has a colimit (system built from interconnected components) • Satisfies structural constraints • Configurations of scenarios • Well-formed configurations are disjoint unions of cocones • Examples well-formed: parallelism ill-formed: concurrency • FOAL 2010

  7. Interfaces • Category SIG of interfaces and their integration actions • Functor sig : c-DESCSIG • Default realization of any interface • Functor sig* : SIGc-DESC • sig ◦ sig* = 1SIG • Bijective map Mor(sig*(I), A) to Mor(I, sig(A)) by functor sig (i.e. sig* is left adjoint to sig with identity as the unit) • Example: signature of a program module • Scenario interface • Set of events • Forgetful functor |–| : PosSet |–| • FOAL 2010

  8. Refinements • Categoryr-DESC • Objects are models • Morphisms are refinements (individual component development steps) • Examples • Elaborating requirements • Implementing specification by means of a programming language • Scenario refinement • Replacing atomic events with subscenarios fully inheriting the order • Dual to a surjective homomorphism • FOAL 2010

  9. Traceable refinements r s : sig(t) ◦ s = 1 XS sig(X) sig(S) t = rop sig(t) sig • Every refinement of scenarios is traceable • Tracing a refinement r : XS • Labeling S by concerns that constitute X • Trace is a c-DESC-morphism t : SX dual to a refinement • sig(t) has right inverse (to preserve traceability at subsequent integrating S into a larger system) • FOAL 2010

  10. Enhancing descriptions with aspects • Aspect-oriented description is a pair A, l : sig(A) L • AOb c‑DESC is a “modular” part • LOb SIG is an aspect structure • llabelssig(A) by aspects (sig(l)is a trace) • Morphism of AO-description A, l to A', l' is a pairp, q A,l:sig(A)  L  psig(p)q A', l':sig(B)  L' • Aspect-oriented scenarios • Object are pomsets (labeled posets) • Morphisms are homomorphisms that preserve labeling • FOAL 2010

  11. Aspect-oriented design • AO-configurations are modular configurations that admit any labeling of components by aspects (i.e. have suitable colimit) • Interfaces of AO-descriptions • mod : A, l |A(modular design interfaces) • asp : A, l |l(aspect design interfaces) • int : A, l |sig(A) (original interfaces) • AO-refinements are duals to such AO-morphisms that are produced from traces • Aspect-oriented scenario modeling • Configurations are disjoint unions of AO-cocones • Functor mod forgets labeling • Functor mod* labels each event by a unique label (event itself) • Refinement replaces events with subscenarios fully inheriting the order and detailing the labeling • FOAL 2010

  12. Aspects • Aspects are “elementary” building blocks of AO-descriptions • An integration of an aspect into a system is an invertible embedding at the level of aspect structures • A is an aspect iff for every object A' and morphism p, q : AA' q has left inverse (often a trace) • Aspects in scenario modeling • Aspect is a scenario with all events labeled by the same label • Aspect is precisely a pair A, ! : |A|1 • FOAL 2010

  13. Weaving • Specifying how to weavean adviceWwith a base programB • Connector: C • Pointcut descriptor: j : CB • Entry points descriptor:e : CW • Performing weaving • Pushout (colimit): 1C, e :C  CW j BX • Weaving labeled scenarios • Weaving exists if a connector “tolerates” concurrency (i.e. it doesn’t impose specific order of executing different aspects of the advice bound to the same join point) • Weaving with an aspect preserves labeling of a base • FOAL 2010

  14. Explication of aspect structure • Explication of aspect structure of an AO-description A, l • Obtaining “actual” refinement from concerns • r‑DESC-morphism s : XA where sop is a trace and sig(sop) = l • An explication of A, l is universal if every AO-morphism p, q : A, lA', l' has an explication (provided that A', l' has) p :A  A' sop rop p' :XX' • Explicating labeled scenarios • Every explication is universal • Every aspect is explicable • “Many” scenarios are inexplicable e.g. interleaving • FOAL 2010

  15. Separation of concerns • Subaspect of an AO-description S • AO-morphismm : AS where A is an explicable aspect • Explication m' of m is right inverse to a trace • Explication diagram of m is a pullback (i.e. mod(m) is a “preimage” of m' along an explication trace of S) • An aspect has no proper subaspects • If S is an aspect, then m is an isomorphism • Each explicable labeled scenario can be partitioned to subaspects • Each scenario can be labeled by linearly ordered subaspects • Maximal partition: assign a unique label to each event (i.e. apply mod*) • Minimal partition: factorize by linear equicomparability relation • FOAL 2010

  16. Industrial application • Distributed measurement system (DMS) development • Main measurement cycle is linear order of separable aspects • Measurement automation infrastructure aspects are woven to it undermining separation of concerns • DMS scenario weaving schema measure  store  validate  compute  display     • FOAL 2010

  17. Summary • Understanding systemic nature of AOSD concepts • Providing formal paradigm-neutral description of • Aspects • Weaving • Explication of aspect structure • Separation of concerns • Verifying structural properties of aspect-oriented operations • Applying in concurrency theory: labels are aspects • Applying in industry: large-scale DMS development • FOAL 2010

  18. Thank you for your attention • FOAL 2010

More Related