Reputation: 2039
In my application, I want to wrap the response I get from a third-party API into an object, so that I can easily retrieve the different properties through getters, instead of doing something like this every time.
if (isset($response->text) === true) {
// some code here
}
In other words, this object will have no behavior of its own. It merely accepts the json data in its constructor, and returns the key from the json data in the relevant getter function if it exists. If the key doesn't exist, it simply returns null.
What are objects like this (which are meant for transferring packaged data from one object to the other) called? Are these domain transfer objects
?
Upvotes: 0
Views: 85
Reputation: 45806
I've always heard them referred to as a "bag of data" class. They don't do anything magical on their own, they just provide a way of organizing data to be processed elsewhere.
I think their more correct name is either a "Record", or "Plain-Old-Data" class. http://en.wikipedia.org/wiki/Passive_data_structure
Upvotes: 1