ruby - Wrapping instance variables in accessor methods -
sandy metz says (poodr book, page 26):
because possible wrap every instance variable in method , therefore treat variable if it's object, distinction between data , regular object begins disappear.
i not sure if understand explaining. when define accessors, wrapping instance variables (data) on method methods not objects. mean when says can treat variables if they're object?
the primary difference between data , objects behaviour. objects can modify internal state without changing interfaces, while data static structures.
when wrap data access within method, same benefits of object - interface remains static consumers if underlying data structure needs change.
Comments
Post a Comment