hello
iām just having a think about the method iāve used for handling data in my program and think that itās a bit sloppy, and would just like to check for opinions.
my main component (sitting in a dialog window) holds an array of objects. this array is stored there as it is used thruout the program, but there are two āpageā components which operate on the data in different ways.
at the moment, each of these subcomponents are created with a pointer to the array, which they use to access the data. however, iām sure that this is a stupid and naive way of doing things and iād like to get into the habit of doing things sensibly.
what is recommended? do i put all the code that manipulates the data within the main component, and have some kind of callback system? iām not entirely sure how iād implement that kind of thing.
if, for example, a page component wishes to set a value of an object in the array, what would be the best way? at the moment, it simply calls a class member function to perform some operation on the array from the pointer. this just feels like bad practise. should the function that manipulates the data exist within the main component?
actually, obviously itās best that the data live in its own class to handle all manipulation. (thatās very stupid of me to not do that here)⦠but how does the page component best tell the data to operate?
iād greatly appreciate any help on this topic. cheers