News for hackers. Stuff that matters.
Re:Why you should never ever ever have Managers in your clas... by twoodfin on Sunday March 31, 2013 @08:05PM (#5470732)
There are only two hard problems in Computer Science: cache invalidation and naming things.

-- Phil Karlton

There should be a short list of words never to appear in names. "Manager" is certainly one. I nominate "Handler" as another.

Re:Why you should never ever ever have Managers in your clas... by Jare on Sunday March 31, 2013 @08:53PM (#5470863)
Naming things is only hard if you are trying to be consistent across a large systems, or hoping that names will replace documentation and assumptions.

If you are going to ban names, I nominate the entire index of the GoF book: Factory, Singleton, Command, Proxy, etc. all sort of convey an idea of the kind of stuff they probably do, but nothing truly precise about the details.

Or I can just accept a rough meaning of the word, name my classes / modules / variables / etc reasonably and then rely on a coherent approach to design and documentation to provide with the details.

- XXXManager: owns the lifetime of objects of class XXX and the relationships between them.

- XXXHandler: responds to events relating to XXX.

- XXXFactory: creates instances of the polymorphic type XXX

- etc.

Re:Why you should never ever ever have Managers in your clas... by bleair on Sunday March 31, 2013 @08:24PM (#5470791)
There are only 2 hard problems in computer science, caching, and naming things, and off by one errors
Re:Why you should never ever ever have Managers in your clas... by Evbn on Sunday March 31, 2013 @11:00PM (#5471206)
Unambiguous syntax is also a hard problem, it now appears.
Re:Why you should never ever ever have Managers in your clas... by nailer on Sunday March 31, 2013 @08:34PM (#5470815)
More meaningless words:

- system. Everything is a system.

- data. Everything that isn't executable is data.

Re:Why you should never ever ever have Managers in your clas... by cpeterso on Sunday March 31, 2013 @08:44PM (#5470840)
The class name modifier that irks me is "Base", as in BaseWidget or ConnectionBase. Just call them a Widget or Connection! :)
Re:Why you should never ever ever have Managers in your clas... by yen223 on Sunday March 31, 2013 @09:57PM (#5471038)
BaseWidget is useful when it's an abstract class, to differentiate it from the actual implementations WidgetA and WidgetB.
Re:Why you should never ever ever have Managers in your clas... by cpeterso on Sunday March 31, 2013 @10:07PM (#5471068)
Wouldn't a "Widget" abstract class name also be differentiated from "WidgetA" and "WidgetB" implementations? Then APIs could take parameters of type Widget instead of type BaseWidget. "Widget" is a shorter, cleaner name and avoids documenting implementation details like names such as "BaseWidget" or "AbstractWidget".
Re:Why you should never ever ever have Managers in your clas... by dack on Monday April 01, 2013 @09:11AM (#5472778)
Usually, I want to make the name of my interface the cleanest possible name. In that case, my interface would be named "Widget". Then, if it makes sense, I might have a partial implementation that works for many cases - I would probably call that WidgetBase. Actual implementations of the widget would try to have a name related to what makes them different than the others - maybe Button, TextBox, etc. Those implementations might inherit from WidgetBase if it makes sense, or just implement the interface. At any rate, WidgetBase is only ever referenced by subclasses - the users of the widget code would either depend on "Button" or "TextBox" specficially, or the "Widget" interface for more generic handling. WidgetBase is really just there for convenience, and you could remove it if it turns out not to be as useful as you thought.
Re:Why you should never ever ever have Managers in your clas... by cpeterso on Monday April 01, 2013 @04:19PM (#5475622)
Java frameworks use a similar pattern with a "Widget" interface and an "AbstractWidget" partial implementation.
Re:Why you should never ever ever have Managers in your clas... by sha90 on Sunday March 31, 2013 @10:58PM (#5471203)
There are certain ... linguistic... reasons why Base appears in class names. It's important to understand the subtlety. In certain languages, especially those with packages or namespaces, you'll likely have a namespace Foo::Bar::Widgets where you put your WhateverWidgetWhatever classes. The package foo.bar.widgets.widget, or namespace Foo::Bar::Widgets::Widget, can look weird to some; it's also longer / less predictable, so you could potentially see them simply be called Foo::Bar::Widget::Base, which avoids naming duplication, and allows developers to not have to worry about plural/singular names.
Re:Why you should never ever ever have Managers in your clas... by matwood on Sunday March 31, 2013 @08:16PM (#5470775)
Re:Why you should never ever ever have Managers in your clas... by dack on Monday April 01, 2013 @09:12AM (#5472782)
Man, as much as I like the idea of Android, the SDK trips me up so often!
Re:Why you should never ever ever have Managers in your clas... by MartinCron on Sunday March 31, 2013 @08:52PM (#5470856)
I personally don't like "Helper". Shouldn't every class be helpful?