Hi Damien,
> reading VisualWorks code, I've seen an interesting pattern for the
> isAbstract method that make subclasses concrete by default:
>
> isAbstract
> "Override to true if a subclass is Abstract"
>
> ^self name = #TestResource
this is SUnit, it is exactly the same in Squeak.
> It can clean a bit things on all the Pier and Magritte hierarchies
> in my opinion. What do you think about this ? (yes, I'm always
> interested in your design opinions)
There are two major problems with this approach:
* It introduces a direct class reference, renaming the class
TestResource breaks the implementation.
* It only works for flat hierarchies where you have an abstract
superclass and all the direct or indirect subclasses are concrete,
unless you re-implement #isAbstract. In Pier and Magritte there are
mostly many abstract classes inheriting from each other.
The advantage of this approach is:
* You only need to implement #isAbstract if you introduce a new
abstract class, otherwise the answer is already correct.
Maybe other people have other advantages/disadvantages? Or other
ideas how to solve this particular problem. Not to mention that
#isAbstract could be also calculated dynamically ...
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch