Traits vs. Aspects in Scala (1)
share
digg
by
Dean Wampler (6)
on
Object Mentor Blog (31)
6 days, 14 hours
ago
permalink
Scala traits provide a mixin composition mechanism that has been missing in Java. Roughly speaking, you can think of traits as analogous to Java interfaces, but with implementations. Aspects, e.g., those written in AspectJ, are another mechanism for mixin composition in Java. How do aspects and traits compare? Let’s look at an example trait first, then re-implement the same behavior using an AspectJ aspect, and finally compare the two approaches. Observing with Traits In a ...
The Open-Closed Principle for Languages with Open Classes (3)
share
digg
by
Dean Wampler (6)
on
Object Mentor Blog (31)
2 months, 2 weeks
ago
permalink
We’ve been having a discussion inside Object Mentor World Design Headquarters about the meaning of the OCP for dynamic languages, like Ruby, with open classes. For example, in Ruby it’s normal to define a class or module, e.g., # foo.rb class Foo def method1 *args ... end end and later re-open the class and add (or redefine) methods, # foo2.rb class Foo def method2 *args ... end end Users of Foo see all the methods, ...