Schwern
Schwern

Reputation: 165207

What is the term for a class with no functionality, it just stores data?

What is the term/pattern for a class which has no functionality of its own, it just has public data?

I use this pattern all the time as step one of extracting a class. I create a class which only has data attributes. I then refactor the target functions to use an instance of it instead of whatever storage it was using, usually a hash. Then the function can be moved to the new class with much less change.

Here is an example of this in Perl.

Upvotes: 3

Views: 285

Answers (2)

net.uk.sweet
net.uk.sweet

Reputation: 12431

Value Object is another term I've used / seen used.

Upvotes: 1

Andy
Andy

Reputation: 8562

I usually call these data transfer objects, DTOs, as their responsibility is usually carrying data from one tier to another.

Upvotes: 2

Related Questions