Book a Demo

Author Topic: Composite vs Component  (Read 20591 times)

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Composite vs Component
« Reply #15 on: September 19, 2005, 06:28:41 am »
Paolo;
Quote
Each item can be on only one container at a time. (The item can only be inside the innermost container)


Should this read:
Quote
The item can only be inside its innermost container
?

Surely an item can be a sibling of another item which happens to be a logically nested container...
Verbal Use Cases aren't worth the paper they are written upon.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Composite vs Component
« Reply #16 on: September 19, 2005, 06:32:17 am »
Quote
Paolo;

Should this read...

Surely an item can be a sibling of another item which happens to be a logically nested container...
Yes, it should read

The item can only be inside its innermost container

A slip of the mind ;)

Paolo
« Last Edit: September 19, 2005, 06:32:59 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Composite vs Component
« Reply #17 on: September 19, 2005, 06:57:01 am »
Good!

If we are in agreement on your use of the term 'Policy' Ref: reply 14 above:
Quote
Does your use of the term "policy" imply that there may be Container specific behavior specifications that must also be realized in the Java code?
then your comments combined with the UML Superstructure sections referenced by Thomas have been most helpful.

I note that in EA, the Component element is only available in the Component and Deployment tool boxes.  This reenforces my assertion that, for the time being, Components are primarily relevent in the context of packaging and deployment.  The concept of Components has more to do with packaging architecture than with pure object design

I'm a happy camper now.
Verbal Use Cases aren't worth the paper they are written upon.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Composite vs Component
« Reply #18 on: September 19, 2005, 07:13:56 am »
[
Quote
Quote
Also, the Interface type is only for containment purposes.  That is, they exhibit the Item Interface with the required policy implementations to implement the policies attached to this particular Container...  (Hopefully that makes sense?)

I think I understand. But surely, you don't mean that the item interface is exclusive to a particular Container?
Yes and No..  I'm saying that the Container will accept as items only those Objects that provide the item Interface it requires.
Quote
Besides, I specified very carefully, the ONLY interface they need to be consistent on is the Item (in container) Interface...

Quote
But then again, perhaps you do mean that...
See above...
Quote
This interests me...it gets at a thought-seed I've been nurturing in my head.  At the Java level, implementation of an Interface only requires a class to provide methods (and perhaps attributes) that have names identical to those in the interface declaration.  There are no restrictions on the behavior exhibited by those methods.
This is where Design by Contract comes in...  If your implementation of the Interface violates one of the conditions of the contract - then it's not much good and the requrier of the interface has every right to Exception at that point.  This is the essence of Eiffel's power.  Both sides specify their expectations of the contract and the Interface will Exception when the contract is violated!
Quote
Does your use of the term "policy" imply that there may be Container specific behavior specifications that must also be realized in the Java code?
Effectively yes..
Quote
My thought-seed is that a model in UML goes beyond what is to be coded in a language to how it is to be coded to achieve a complete realization.  Many students don't understand this! And that lack of understanding leads to their confusion on drawing and reading UML diagrams.  For example;  At the Java level, navigable associations are implemented in code with an attribute containing a reference to the associated class.  However, the nature of the UML association (aggregate, composition, dependency, etc.) places restrictions on how the programmer may use that reference.  Those restrictions (policies?) are not enforced by the Java translator, but by the  quality control team reviewing the code for compliance with the specifications expressed in the UML model.  My postulate is that I may extend this concept to a more general abstraction that covers a global relationship between UML models and their realization in code.  Since this is obvious to experienced UML modellers, this concept is rarely expressed to students; and they just don't get it for a long time.
I believe my use of Policies and the use of Design By Contract conditions makes these things explicit.  In my experience there's no such thing as the "bleeding obvious".  Everything should be explicit!
For example, You can only apply Collection specific policies to a Collection.  A Collection requires a shared aggregation and so on... You can define these kinds of rules and validate the model against them.
Quote
My observation is that UML diagrams prepared by programmers are more code centric and those prepared by Architects are more business centric.  This is the fundamental problem of "round-trip" code generation that will take better minds than I to resolve.
As an Architect who actually codes I can attest to the dichotomy - but I resolve it by saying that, in principle, one can get from a CIM (Computationally Independent Model - that should be business (and environment - world) focused) to a PSM (Platform Specific Model - that is focused on a particular deployment model) ONLY by a defined series of transformations.

HTH,
Paolo
« Last Edit: September 19, 2005, 08:01:41 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Composite vs Component
« Reply #19 on: September 19, 2005, 07:42:16 am »
Well said!

Bravo!  ;D
Verbal Use Cases aren't worth the paper they are written upon.