Monday 20 April 2009

Proposal 9: Improving Seaside class trees

There are different types of requests handled in Seaside and at least two types are handled by classes in completely separate class trees. This is true (at least) for WARequest and for HTTPGet, which essentially do the same (respond to user requests) but are completely separate and share no code at all.

Of course, I understand that this has probably historical reasons as one is from Seaside and the other one probably from Swazoo and that these are separate projects.

Nevertheless this is no good design and it should be changed over time.

We had to enhance various classes with the same code (how uly) in order to fulfill some of our needs. No chance to inherit. Several changes were (and probably still will be) related to these two essential classes.

We had to duplicate various code to achieve this. And redundant code is something we seriously hate!

Unfortunately, this is another prove that Seaside has a very low degree of "object-orientability".

Also, it would be most useful if the protocols between these two different but very closely interconnected class trees were aligned (but please use some better semantics than currently in Seaside).

4 comments:

  1. Why do you consider this a bad style? I would define it totally legal not to inherit if there is either nothing or very less in common...

    >had to enhance various classes with the same >code (how uly)

    if you had done so I would conside this a bad style. Ever heard of delegation?

    Cheers,
    Piero

    ReplyDelete
  2. Why didn't you implement the changes you needed separately and use Composition to Decorate the behavior of the said classes? You may have minimized the duplication substantially.

    ReplyDelete
  3. 1) We hat to introduce a couple of new instVars to support our tasks. This was the best way. Not big enough and no sense to make a separate class out of it.

    2) I oppose to your statement that these classes don't share common behaviour. Simply not true.

    3) There are a lot of important features missing in Seaside - and I will come to that soon. This is related to inheritance.

    ReplyDelete
  4. @Jason
    Our additions had nothing to do with the content (rendering etc) but with the services of the Request classes in general.

    The Request classes are by far undervalued in Seaside and the knowledge about their services is spread all over the place. Very bad design and lousy cryptic implementation.

    See my post: Proposal 1: WARequest.

    This here is another slightly separate aspect.

    ReplyDelete