Wednesday, April 3, 2019 [Tweets] [Favorites]

Accessors Have Message Obsession

Marcel Weiher (tweet):

Every single attribute of every single class gets its own accessor or accessor pair, again with the action (get/set) mushed together with the name of the attribute to work on. The solution is the same as for the directions in Nat’s example: there are only two actual messages, with reified identifiers.

These, of course, correspond to the GET and PUT HTTP verbs. Properties, now available in a number of mainstream languages, are supposed to address this issue, but they only really address to 2:1 problem (getter and setter for an attribute). The much bigger N:2 problem (method pair for every attribute) remains unaddressed, and particularly you also cannot pass around, store or perform calculations on the identifier.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment