Marker interface pattern: Difference between revisions

Content deleted Content added
fixing link
No edit summary
Line 11:
== Critique ==
The implementation of this pattern presented above is rather specific to Java. Other object models support rich ways of quickly querying static data. For example, [[.NET Framework|.NET]] supports attributes that can be used to associate any type of data with a class or with its members. As of [[J2SE]] 5.0, Java supports [[reflection (computer science)|reflective]] [[annotation]]s that can be used to associate attributes with classes, interfaces, methods, [[Constructor (computer science)|constructors]], [[Field (computer science)|fields]] and [[Java package]]s. Annotation allow a rich and fine-grained association of [[metadata]] to program elements.
 
== Marker interface patterns in PHP 5 ==
Although often shoved to the back of the pile in terms of [[OOP]] capabilities, [[PHP]] 5 provides an excellent level of Object functionality for a [[dynamically typed language]]. Although in most cases not neccesarry, you could recreate the Java example above like so:
 
<code>
<?php
interface Cloneable {}
class MyClass implements Cloneable {}
?>
</code>
 
== See also ==