Re: Help on choosing a valid pattern: composite or not?



Carmine Moleti wrote:
> Hi to everyone,
>
> I'm just writing a toy application using C# to make some
> practice with Patterns and layers.
>
> Now I'm faced with the "huge" dilemma of which pattern best
> suits the object oriented world I'm building.
>
> I have one object which represents a net, whose node
> can either be:
> 1. A net
> 2. A proper node (of various kinds; Factories?!)

Can it be both?

tell me when I go wrong.

A network consists of a set nodes and connections.

OK a node could itself contain a network of other nodes, but they would
not exist in the same network....that would seem a little odd.

>
> Both the "node" and the "net" have similarities in their
> interfaces.

OK

>
> For example:
> Net:
> - Add a node
> - Delete a node
> - Execute a node
>
>
> Node:
> - Link to node (Could be translated as: Add a link to a node)
> - Unlink to node (Could be translated as: Delete a link to a node)
> - Execute
>
> Node have some properties that Net doesn't have, and the
> clients are expected to deal with them.
>
> If it's possible, I would like to implement clients so that
> they shouldn't have to care about the difference between "nodes" and "nets".
>
> Without taking into account the "properties" aforementioned, from the
> GoF book I understand that the "Composite" pattern would be the
> route to take.
>
> The question is, is still "Composite" a good pattern to use
> if those "properties" are to be considered from a client
> stand point?
>
> Thanks in advance for your help.
> Regards,
> Carmine


I'm not convinced I completely understand how a node can be a node or a
net.

I would prefer to say all nodes are nodes, and some nodes contain a set
of nodes that form another 'net'.

thus you sort of have a tree of networks.

.



Relevant Pages

  • Re: intelligence
    ... Morse code program gave me any insight I didn't already ... pattern problems better than the way it is already done. ... network correctly solves, and which it is yet to solve, you don't seem to ... The pulse sorting network you know about creates a hierarchy of pulse ...
    (comp.ai.philosophy)
  • Re: Can operant conditioning account for all learning?
    ... How the brain deals with asynchronous data is a question ... You liked to talk about pulses of infinite small widths ... network that are too close together they blend into one ... pattern and s,t and u are examples of the cat pattern. ...
    (comp.ai.philosophy)
  • Re: Can operant conditioning account for all learning?
    ... pattern and s,t and u are examples of the cat pattern. ... "temporal" gates wired up in what topology. ... The pulse routing network should scale correctly as long as it doesn't have ...
    (comp.ai.philosophy)
  • Re: Does Searles "Chinese Room" argument imply that consciousness is non-scientific?
    ... only when nodes in this network detect a pattern, ... "the PART of the brain which produces conscious ... that's consistent with the network of detectors model. ...
    (comp.ai.philosophy)
  • Re: How many differences, categories?
    ... >> relocate the pattern by a process similar to the one we used to ... Network logic is counterintuitive. ... In theory the limit to the number of connections per node ... As Kauffman varied this connectivity parameter in his generic networks, ...
    (sci.cognitive)