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



Hi to everyone,

First off, thanks for your efforts in helping me, and sorry
for my poor explanation of the ideas.

*** The (short) story ***

A while ago, I wrote a sort of toolkit to play with neural
networks (back prop.).
As of today I've realized that I wrote it using objects but
not quite in an object oriented way, so after reading
some documentations, I thought it could be an interesting
exercise writing it from scratch, this time with
a different point of view.

*** The (rough) idea ***

Implement a toolkit that allows to:
- Build "Nodes" with run-time pluggable behaviours that,
  given some numerical inputs, will produce one numerical output.

- Build "Nets" of such nodes that, given some numerical
  inputs, will produce one or more numerical outpus.
  "Nets" are partitioned in "Layers".

- Allow a "Net" to be a "Node" of another "Net" in such a way
  that the "Parent-Net" doesn't have to be aware of its subnets.
  It should treat them just as "Nodes".

- Extend the "Net" so that it could be persisted to some sort
  of storage (just to make things a little more funny, let's
  say that the storage medium can be chosen via a plugin interface).
  (O/R Mapping tools to use and/or implement?!?)

- Extend the "Net" and the "Node" so that it could be graphically
  represented and manipulated.


Why I think it "could be interesting" to write from scratch?

- Practice with MVC (or its variation) to decouple the
  model (Net, Nodes, Subnets...) from its graphical representation.

- Practice with what I've read in the GoF's Pattern book
  (Composites, Factories, Iterators, Strategies...)

- Practice with Application layering (UI, Business, Storage...)

- Try to find a spot where to insert some Dependency Injection ( a
  network needs a Log service and a Persistence service...)

- Use it to learn C# (and .NET framework) and Ruby

- Future plans: Nets (and subnets) can be remotable on LAN/WAN,
  can be wrapped in Web Services...

*** And now back to what I started writing in the original post ***

I came to the point of designing what the "Node" and the "Net" are (
yes, I've just stared bothering... :) ),
and thought "Composite Pattern" could be of some help in unifying
the interface from a client's point of view.

At its minimum the interface shared by "Node" and "Net" is:

- Execute
	. A "Net" can be told to execute itself, and that would
	mean to call each "Node"'s Execute
	. A "Node" can be told to execute itself, and that would
	mean to fetch its input and apply some calculation in order
	to produce its output.
- Add
	. A "Node" can be added to a "Net", and that would mean to
	become the destination of some other "Node"'s output, and/or
	the input of another one (or one of the "Net"'s outputs...)
	
	. A "Net" can be added to another "Net", and that would
	mean to become one or more inputs of a "Node" and/or one
	of the parent "Net" outputs.

- Remove
	. A "Node" can be removed from a "Net", breaking all it's
	forward and backward links to other "Net"'s elements.

This means that "Node" and "Net" will contain other things aside of
this shared interface.

E.g.: "Node" have some parameters that can be adjusted so that the
computing strategy can produce "better" outputs (whatever better means...)


That's what made me concerned about the "Composite Pattern".
Would the differences between "Node" and "Net" suggest there is
a suitable pattern than Composite to apply? (I thought of
Flyweight because sharing "Node" could be an interesting
variation point...)

I do really hope having been able to express myself clearly this time.

Thanks for your help!

Best regards,
Carmine
.



Relevant Pages

  • Re: How to develop UVC webcam driver on win2k
    ... and you stream from it using standard isochronous requests. ... think it's probably easier to write an AVStream driver. ... for example, only the video interface, then the composite driver will ... match the PnP ID for the composite device. ...
    (microsoft.public.development.device.drivers)
  • Re: AW: [Full-Disclosure] 9/11 virus
    ... >Tom Vogt: ... > It ain't a user-dependent vulnerability. ... > ...so, let's execute it. ... A better interface would ...
    (Full-Disclosure)
  • Re: Composite to RGB?
    ... > allow me to display the C64 output to a PC ... interface, the other part of the interface is a device that inputs ... a composite video / audio signal into either a USB ... An EBAY store had a better price. ...
    (comp.sys.cbm)
  • Re: Updating device manager
    ... I have a composite USB device and I have written the driver for modem ... interface only .So only one PDO and one FDO for the USB compodite Device. ... When the framework throws the device into suspend mode (As it calls ...
    (microsoft.public.development.device.drivers)
  • AW: [Full-Disclosure] 9/11 virus
    ... "I want to see this picture." ... The user never wanted to execute a file, he wanted to see a picture. ... miscommunication issue, not stupidity of users. ... A better interface would ...
    (Full-Disclosure)