Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Metaobject
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Metaobject protocol<!--'Metaobject protocol' redirects here--> == A '''metaobject protocol'''<!--boldface per WP:R#PLA--> ('''MOP''') provides the vocabulary ([[Protocol (object-oriented programming)|protocol]]) to access and manipulate the structure and behaviour of systems of objects. Typical functions of a metaobject protocol include:<ref>{{cite book|last=Foote|first=Brian|author2=Ralph Johnson |title=Conference proceedings on Object-oriented programming systems, languages and applications |chapter=Reflective facilities in Smalltalk-80 |pages=327β335|date=1β6 October 1989|chapter-url=http://www.laputan.org/ref89/ref89.html|access-date=16 December 2013|doi=10.1145/74877.74911|isbn=0897913337|doi-access=free}}</ref> *Create or delete a new class *Create a new property or method *Cause a class to inherit from a different class ("change the class structure") *Generate or change the code defining the methods of a class Metaobject protocol is contrary to [[Bertrand Meyer]]'s [[open/closed principle]], which holds that software object systems should be ''open for extension'' but ''closed for modification''. This principle effectively draws a distinction between ''extending'' an object by adding to it, and ''modifying'' an object by redefining it, proposing that the former is a desirable quality ("''objects should be extensible to meet the requirements of future use cases''"), while the latter is undesirable ("''objects should provide a stable interface not subject to summary revision''"). Metaobject protocol, by contrast, transparently exposes the internal composition of objects and the entire object system in terms of the system itself. In practice, this means that programmers may use objects to redefine themselves, possibly in quite complex ways. Furthermore, metaobject protocol is not merely an [[Application Programming Interface|interface]] to an "underlying" implementation; rather, through metaobject protocol the object system is [[Recursive definition|recursively implemented]] in terms of a ''meta''-object system, which itself is theoretically implemented in terms of a ''meta''-metaobject system, and so on until an arbitrary [[Base case (recursion)|base case]] (a consistent [[State (computing)|state]] of the object system) is determined, with the protocol as such being the recursive functional relationship between these implementation levels. Implementing object systems in such a way opens the possibility for radical discretionary redesign, providing deep flexibility but introducing possibly complex or difficult-to-understand metastability issues (for instance, the object system must not [[Persistent data structure|destructively update]] its own metaobject protocol - its internal self-representation - but the potential destructiveness of some updates is non-trivial to predict and may be hard to reason about), depending on the recursive depth to which the desired modifications are propagated.<ref name="AMOP text">''The Art of the Metaobject Protocol'', Appendix C β Living with Circularity</ref> For this reason, metaobject protocol, when present in a language, is usually used sparingly and for specialised purposes such as software that transforms other software or itself in sophisticated ways, for example in reverse engineering.<ref>{{cite book|last=Favre|first=Lilliana|year=2009|publisher=Springer|isbn=978-3-642-01861-9|author2=Liliana Martinez |author3=Claudia Pereira |title=Enterprise, Business-Process and Information Systems Modeling |chapter=MDA-Based Reverse Engineering of Object Oriented Code |series=Lecture Notes in Business Information Processing |volume=29 |pages=251β263 |doi=10.1007/978-3-642-01862-6_21}}</ref> === Runtime and compile time === When compilation is not available at run-time there are additional complications for the implementation of metaobject protocol. For example, it is possible to change the type hierarchy with such a protocol but doing so may cause problems for code compiled with an alternative class model definition. Some environments have found innovative solutions for this, e.g., by handling metaobject issues at compile time. A good example of this is [[OpenC++ (software tool)|OpenC++]].<ref>{{cite book|last=Chiba|first=Shigeru |title=Proceedings of the tenth annual conference on Object-oriented programming systems, languages, and applications |chapter=A metaobject protocol for C++ |pages=285β299|year=1995|chapter-url=http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.7049|access-date=27 December 2013|doi=10.1145/217838.217868|isbn=978-0897917032|s2cid=3090058 }}</ref> The [[Semantic Web]] object-oriented model is more dynamic than most standard object systems, and is consistent with runtime metaobject protocols. For example, in the Semantic Web model classes are expected to change their relations to each other and there is a special [[inference engine]] known as a classifier that can validate and analyze evolving class models.<ref>{{cite web|url=http://www.w3.org/2001/sw/BestPractices/SE/ODSD/|title=A Semantic Web Primer for Object-Oriented Software Developers|last1=Knublauch|first1=Holger|last2=Oberle|first2=Daniel|last3=Tetlow|first3=Phil|last4=Wallace|first4=Evan|publisher=[[W3C]]|date=2006-03-09|access-date=2008-07-30}}</ref> === Usage === The first metaobject protocol was in the [[Smalltalk]] object-oriented programming language developed at [[Xerox PARC]]. The [[Common Lisp Object System]] (CLOS) came later and was influenced by the Smalltalk protocol as well as by [[Brian Cantwell Smith|Brian C. Smith]]'s original studies on 3-Lisp as an infinite tower of evaluators.<ref>{{cite book |pages=298β307 |author1=Daniel P. Friedman |author2=Mitchell Wand |title=Proceedings of the 1986 ACM conference on LISP and functional programming - LFP '86 |chapter=The mystery of the tower revealed: A non-reflective description of the reflective tower |date=1988 |doi=10.1145/319838.319871 |isbn=978-0897912006 |s2cid=7974739 }}</ref> The CLOS model, unlike the Smalltalk model, allows a class to have [[Multiple inheritance|more than one superclass]]; this raises additional complexity in issues such as resolving the lineage of the class hierarchy on some object instance. CLOS also allows for [[multiple dispatch|dynamic multimethod dispatch]], which is handled via [[generic functions]] rather than [[message passing]] like in Smalltalk's [[single dispatch]].<ref>{{cite web|title=Integrating Object-Oriented and Functional Programming|url=https://www.cip.ifi.lmu.de/~langeh/test/2004%20-%20Gabriel%20-%20CLOS%20-%20Integrating%20Object-Oriented%20and%20Functional%20Programming.pdf|access-date=7 July 2016}}</ref> The most influential book describing the semantics and implementation of the metaobject protocol in Common Lisp is ''[[The Art of the Metaobject Protocol]]'' by [[Gregor Kiczales]] et al.<ref>{{cite book|last=Kiczales|first=Gregor|title=The Art of the Metaobject Protocol|publisher=The MIT Press|isbn=978-0262610742|author2=Jim des Rivieres |author3=Daniel G. Bobrow |date=July 30, 1991}}</ref> Metaobject protocols are also extensively used in software engineering applications. In virtually all commercial CASE, re-engineering, and Integrated Development Environments there is some form of metaobject protocol to represent and manipulate the design artifacts.<ref>{{cite journal|last=Johnson|first=Lewis|author2=David R. Harris |author3=Kevin M. Benner |author4=Martin S. Feather |title=Aries: The Requirements/Specification Facet for KBSA|journal=Rome Laboratory Final Technical Report|date=October 1992|volume=RL-TR-92-248}}</ref><ref>{{cite web|title=The Origin of Refine|url=http://www.metaware.fr/images/pdf/1_Metaware_The_Origin%20of_Refine_Whitepaper.pdf|work=www.metaware.fr|publisher=Metaware White Paper|access-date=6 January 2014|url-status=dead|archive-url=https://web.archive.org/web/20140107000613/http://www.metaware.fr/images/pdf/1_Metaware_The_Origin%20of_Refine_Whitepaper.pdf|archive-date=7 January 2014}}</ref><ref>{{cite web|title=OMG's MetaObject Facility|url=http://www.omg.org/mof/|work=omg.org|publisher=Object Management Group|access-date=7 January 2014}}</ref> A metaobject protocol is one way to implement [[aspect-oriented programming]]. Many of the early founders of MOPs, including [[Gregor Kiczales]], have since moved on to be the primary advocates for aspect-oriented programming. Kiczales et al. of [[Palo Alto Research Center|PARC]] were hired to design [[AspectJ]] for [[Java (programming language)|Java]], a language which does not possess a native metaobject protocol.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)