I am trying to figure out the design of the classes in
Pier Blog. I am
wondering why PBBlog is a subclass of PRCase, and not a direct
subclass of PRStructure:
I wanted to be able to put a longer description of the Blog.
PRStructure and all other subclasses except PRCase don't have an
attached document.
I guess my question is: for an application that is
similar to a blog
(managing a list of homogeneous entries, maybe nested), is it a good
idea to make it a direct subclass of PRStructure?
The decision if a PRStructure can be nested or not is orthogonal to
the functionality the class provides. The nesting is solely with the
PRChildren decoration that can be added and removed on demand, in
fact this happens behind the curtain. In SmallWiki this was different
and caused a lot of problems. By overriding #canBeChildOf: and
#canBeParentOf: you can control what can be nested into what else.
So the question to subclass PRStructure or PRCase is solely a
question if you need the parser, formatter and editor for the wiki
syntax.
aBoolean
ifTrue: [ PRCase ]
ifFalse: [ PRStructure ]
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch