design pattern advice: graph -> computation
Posted
by
csetzkorn
on Programmers
See other posts from Programmers
or by csetzkorn
Published on 2012-09-18T13:38:24Z
Indexed on
2012/09/18
15:53 UTC
Read the original article
Hit count: 525
I have a domain model, persisted in a database, which represents a graph. A graph consists of nodes (e.g. NodeTypeA, NodeTypeB) which are connected via branches. The two generic elements (nodes and branches will have properties). A graph will be sent to a computation engine. To perform computations the engine has to be initialised like so (simplified pseudo code):
Engine Engine = new Engine() ;
Object ID1 = Engine.AddNodeTypeA(TypeA.Property1, TypeA.Property2, …, TypeA.Propertyn);
Object ID2 = Engine.AddNodeTypeB(TypeB.Property1, TypeB.Property2, …, TypeB.Propertyn);
Engine.AddBranch(ID1,ID2);
Finally the computation is performed like this:
Engine.DoSomeComputation();
I am just wondering, if there are any relevant design patterns out there, which help to achieve the above using good design principles. I hope this makes sense. Any feedback would be very much appreciated.
© Programmers or respective owner