Is there a name for a pure data Objective-C class?

This is a less specific code-related question and an Objective-C nomenclature question. In C, you have a struct for pure data. In Enterprise Java, you have "bean" classes that are purely member variables with getters and setters, but not business logic. In Adobe FLEX, you have Values.

In Objective-C, is there a proper name for an object (from NSObject of course) that just has ivars and getters / setters (or @ property / @ synhesize if you want fancy) and no real business logic?

A more specific example would be a simple class with getters and setters for filename, file size, description and other metadata. You can then take a bunch of that data and easily throw it into a container (NSDictionary, NSArray) without having to messily wrap the NSValue of the C structure. It's also a little more structure than putting, say, a bunch of weakly expressed child NSDictionaries in the parent container object.

+2


a source to share


2 answers


No, there is no specific name (at least as far as I know). All Objective-C objects that inherit from NSObject

are first class objects. Of course, you can only implement classes with getters and setters, but even synthesized properties have soft "business logic" for atomicity and memory management. You can use C structs for pure data if you like (example in Cocoa is NSRect

), but then, as you say, it's harder to use other classes like NSDictionary

.



+2


a source


There is no official name for such a class in Objective-C. People tend to refer to things like "value objects" or "pure data objects", but both are overloads since they can also be used to refer to NSValue (or alternatively property list value) and NSData subclasses. The latter is perhaps the most concise way to describe them.



0


a source







All Articles