13 May '12, 7pm

Beware Synonymatic Complexity:

When you name a class, make sure to choose something that is unlikely to refer to two different things. For example, Visitor is a bad name for a class that represents unregistered users of your web site. This issue is that Visitor is the name of a well-known pattern. Like it or not, the Gang of Four have claimed this one (that’s why they’re called a gang). If you use this class name in a web app, I can make a pretty good guess which concept you’re referring to, but there’s too much ambiguity. The problem with the name is that it has synonymatic complexity: it sounds too much like another thing . UnregisteredUser is a much better name. It’s easy to guess what this refers to. However, notice that the ambiguity is affected by your problem domain: if we were writing an event-registration app, this name would again be ambiguous. In general, choose names that make it easy for a ...

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

Tweets

Beware Synonymatic Complexity

robots.thoughtbot.com 14 May '12, 4am

May 13, 2012 Tagged: naming Comments (View) Beware Homonymatic Complexity When you name a class, choose a name that’s unli...