A single bean has a number of different properties - some of which needs to be gettable and settable. I store such information in a structure within the (private) variables scope of the CFC. But with an IBO, there are two types of data that need to be stored. For the lack of a better term I call them class data and instance data.
Let's say we have an object that we are passing to a generic admin list screen. We might want to write: "#Object.get("Title")# Admin" to display "User Admin" or "Product Admin" or whatever else the name of the object is.
However, we also want to be able to get instance data for the collection of objects within the IBO, which might also have a Title property. So, how do we distinguish between accessing class data (of which there is only one value per property within a given IBO) and instance data (of which there is one value per object contained within the IBO)?
Clearly we need to either have different methods or to complicate the methods by adding an additional class/instance property. Personally I don't relish writing get("FirstName", "instance") all the time, so it seems to be more appropriate to have two different getters and setters.
The vast majority of the time, when getting and setting data from an IBO I'm interested in the object/instance data, so I'd like to leave get("FirstName") (or for the oMM() afficianados getFirstName()) as it is. The question then is what do I change my get("Title") code to to return the title of the class?
At first I tried calling it metaGet() because you could think of it as metadata, but I think on balance the least bad name I have come up with to date is classGet() and classSet() on the basis that we're dealing with class data rather than object/instance data. What do you think? Any better ideas for the naming of this?
Then the question is how/where to store the metadata behind the scenes. For now I'm leaning towards two structs within the variables scope. classData would contain the class data for the IBO and instanceData would be an array of structs containing the instance data for all of the records.
Historically, to allow me to use the same getters and setters between IBOs and regular business objects, I've stored instance data in variables.instanceData for single instance beans - treating the single instance as a special case of an IBO but where the iterator record is always 1. That was efficient from a code perspective, but I don't love the approach conceptually, because thinking of all beans as being special cases of IBOs where number of instances = 1 isn't very accurate.
Instead, I think I'm going to go to just storing instance data for regular beans directly in a variables.instanceData struct. It'll mean I have to overload the getters are setters for my IBO, but I think it's worth the extra little bit of code for the cleaner approach conceptually to the regular beans. (Any input appreciated though!)