This is a Design Question. I will be as concise and to the point as possible, avoiding non relevant details.
I am retriving data from Back End in one of my WD Component. The data is stored in the Component Context.
Now each view actually comes from subsequent Embedded Components.
<b>But</b> I have to massage the raw data considerably each time the subsequent Views are called (each time a embedded component is called).
Component A -> Get Back end Data
Component B -> Massage Data and present a View
Component C-> Massage Data (further from B) and present a View
Component D-> Massage Data (further from C) and present a View
Since the massaging is kind of Business Logic, I have created a External Class and put all logic in it and am instantiating the class inside the Component that retrives the back end data. I pass the Node Reference of the Context to this Class and massage the data there.
Now since each Subsequent View needs further massaging, where should I store this data after first massaging...
1) Should I create a separate node in external Compoenent, and store the data as it is getting Massaged bu each Component, in the context, and thus pass this node reference by context mapping to each subsequent Embedded Component(and hence Views) for further massaging.
2) Should I pass the instance of the external class thru context mapping to the embedded components, thus making the context cleaner. In this case all the subsequent massaged data remains in the class and all you do is just pass on the instance of the class thru context mapping...
Which is a better design..?
.I like 2) since it makes the context cleaner with just one attribute to hold the class reference, while in 1) I need number of attributes in the new node.
Message was edited by: