One of the Best Bits of Programming Advice I Ever Got

Discussions

News: One of the Best Bits of Programming Advice I Ever Got

  1. Travis Griggs posted "One of the Best Bits of Programming Advice I Ever Got" a few days ago, saying the advice was "don't make objects that end in -er."

    The idea behind the advice is that in OOP, programmers should focus on nouns, not verbs. Nouns are people, places, and things; verbs are actions. By using "-er," you're focusing on the action or behavior, and not what's got the action or behavior.

    He says this isn't a hard and fast rule, but there are a lot of cases where it can improve things.

    And there's where it falls apart apart. Right after he says "here's some advice" he goes down a giant list of exceptions.

    For one thing, nouns can end in "-er." Manager, Register, Border from his post. Filter would be one from the servlet api.

    For another, we're used to a lot of "-er" object names. Parser, Browser, Compiler.

    For yet another, some domain objects end in "-er."

    I'd say that some of his examples of objects that end in "-er" that shouldn't, like "Controller," "Renderer," and "Reader" are commonplace enough that you'd look funny trying to avoid them. "Control" is what a controller would yield. A Render would be what a renderer created. "-er" doesn't always mean focus on the verb and not the noun, it can just be a legit object design.

    I'm glad he said it was advice and not a rule. If it was a rule, then his list of exceptions and poorly constructed examples would have made the rule worthless before it even had a chance.

    Threaded Messages (3)

  2. Programming ??[ Go to top ]

    Good old Rumbaugh's excellent book on OOA stated that one of the most time consuming task was

    finding (good) names for classes, attributes, associations etc.

    It was about two decades ago.......

  3. FUD[ Go to top ]

    No builders? No listeners? He must be an assembly programmer.

  4. Really?[ Go to top ]

    Ok, it seems like some of these topics are used as bait for discsussions, so I'll take it.

    As you stated, it's not even a solid rule, and further that, it really has nothing to do with programming, right? The device doesn't care what you name it. So long as you and your team know what the object is and does, the rest is gravy.

    Here's some better advice that is sound on any platform: know how to use the output log and integrated debugger. Doing those well will cover 99.9% of everything :)