14 May '12, 4am

Beware Synonymatic Complexity

May 13, 2012 Tagged: naming Comments (View) Beware Homonymatic Complexity When you name a class, choose a name that’s unlikely to refer more than one thing. For example, Visitor is a bad name for a class that represents unregistered users. The issue is that Visitor is the name of a well-known pattern. Like it or not, the Gang of Four claimed this one (that’s why they’re called a gang). If you use this class name in a web app, I can guess which concept you’re referring to, but the ambiguity is unsettling. I’m not sure. The name has homonymatic complexity : it sounds too much like another thing. UnregisteredUser is a better name. It’s easy to guess what this refers to. However, notice the ambiguity is affected by the problem domain: in a voter registration app, this name would again be ambiguous. In general, choose names so colleagues can easily guess an object’s identity.

Full article: http://robots.thoughtbot.com/post/22987775858/beware-homo...

Tweets

Beware Synonymatic Complexity:

robots.thoughtbot.com 13 May '12, 7pm

When you name a class, make sure to choose something that is unlikely to refer to two different things. For example, Visit...

Object#with_options - Beware nested with_option...

apidock.com 18 May '12, 10pm

An elegant way to factor duplication out of options passed to a series of method calls. Each method called in the block, w...