Re: Separation of concerns



Responding to Kowalski...

That is a matter of generalization rather than separation of concerns.


Then what would be a good example for the usage of separation of
concerns?

The General Ledger subsystem and the Accounts Payable subsystem represent encapsulation of quite different concerns within an Accounting System.

At a lower level of abstraction, the concerns of drawing an entity are different than the concerns of what it is and its role within the overall solution.

Also, we use "factory" objects to instantiate objects and relationships because the business rules and policies that govern instantiation (who and what) are often quite different than the business rules and policies that govern collaboration (when and how). Thus the "factory" object encapsulates the concerns of instantiation while the objects being instantiated encapsulate the concerns of the problem solution.

However, the notion of -able (drawable, persistable, etc.) is often
symptomatic of an abuse of OO generalization that is related to
separation of concerns. This is a variation on the sort of composition
one finds in functional programming. One composes objects by providing
disparate responsibilities through inheritance (often multiple
inheritance). The resulting object is a hybrid of logically unrelated
groups of properties.


Agreed. I would rather put the draw method inside of the class A or B,
but I want to create this software to be a piece that shows good use
of the OO Priciples (for me that includes seperation of cencers).

Often a better approach is to put the draw() method in some other object that understands the concerns of display rendering (e.g., an Artiste object). Then the object being drawn can focus on its own semantics (e.g., a Babbling Brook object can focus on what it means to be a babbling brook).


*************
There is nothing wrong with me that could
not be cured by a capful of Drano.

H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
info@xxxxxxxxxxxxxxxxx for your copy.
Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH



.