Traits vs. Grafts in PHP6
would After today's release of PHP 5.3
I do something about two potential implementations that could change the object-oriented paradigm in PHP6 fundamental report. Tuesday, June 30, 2009
Diamond problem
now also include the previous traits:
trait is still the state of the object-oriented programming technology, as it tries to rule out problems at the design.
" &
here
) with the classical multiple inheritance (multiple inheritance) in programming languages like C + + 0r python also keep tighter OOP languages such as Objective-C and Java interfaces
contrary. Based on the principle of the interface there are two proposals to PHP6 will deal with this problem in the future.
contrary. Based on the principle of the interface there are two proposals to PHP6 will deal with this problem in the future.
A trait, corresponds to an abstract, non-instantiable class schema the greatest possible extent the Interface
the Java world. In addition traits allow now also include the previous
trait A {public function print () {echo 'A &';}} trait B {public function print () {echo 'B!';}} trait AandB {use A, B;}
class MyClass {use AandB;}
use MyGraft { public bar () from foo ();}class MyGraft {public function foo () {echo 'foo';}}
A graft is, as far as I know, novel concept that so far has been implemented in any programming language. A graft is a class that the previous within their class definition to at least two defined classes falls back, and defines the scope in the class definition explicitly:
class MyGraftedClass {use MyGraft {public foo ();}
}
A graft extends thus from the existing, independent base classes, the methods to be used again out, and sets in the new class a new, artificial namespace the properties of the source classes copied. By name duplication, the order of hineinge-grafta bad OOP design seduced. It is a compromise that attempts to the problems that can generate multiple inheritance to dampen. A Interface respectively.
-eten classes.
I think that a graft
Spiritual proposals on this exciting topic, it is here . I hope and I would imagine that the concept of graft loss due to conceptual errors and the unfamiliarity of the immense struggle to use the programming concept.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment