Re: Separation of concerns



"Thomas Kowalski" <th-ko@xxxxxx> wrote:

It means to keep variables, functions, objects, abstractions as
focused as possible.

And how do you trade off with cohesion?

There is no trade off. Separating concerns means that an abstraction
should do no more than one thing, cohesion means that an abstraction
should do no less than one thing.

The best pattern depends on the context. How different are A and
B's draw method? How alike are they? Chances are you should have a
separate class that serves as a drawing helper.

The core drawing methods are extremely different. But I agree there
is an initialization part that is done in another class (View),
that's what I need the interface for. I have one class (View) that
implements a method onDraw() that draws all drawable Elements
passing the "right" parameters.

The question on hand is, shall the drawable interface be implement
in the class containing the business logic (means A and B) or
rather in an composed object (A_drawable and B_drawable) that just
implement the drawable interface and inherit the business logic.

Views should not inherit models. Have A_drawable contain the A that it
draws.
.



Relevant Pages

  • Re: Separation of concerns
    ... And how do you trade off with cohesion? ... There is no trade off. ... Separating concerns means that an abstraction ... necessarily about tasks and task divisions. ...
    (comp.object)
  • Re: Deinition of OOP needed for programming language documentation
    ... often devolves into a heap address without problem space semantics. ... > anyone doing programming irregardless of their knowledge of design. ... that is bleeding cohesion all over the map. ... >> was confused about the level of abstraction of your documentation ...
    (comp.object)
  • Re: Separation of concerns
    ... Separating concerns means that an abstraction ... Cohesion and separation of concerns are also not incompatible, ... to have a clear set of criteria for designing highly cohesive classes. ...
    (comp.object)
  • Re: More static type fun.
    ... abstraction facilities give you a way of drawing a separating ... way of describing interfaces, as well as any means for enforcing such ...
    (comp.lang.lisp)