I was going over some old code and found the following peculiar naming convention at a template method implementation.

// Checks condition and fail fast if condition is met.
// Otherwise call the hook method (to be implemented by subclasses).
public boolean accept(String text) {
    if (condition) {
        return false;

    // call to the hook method. Each subclass implements its own logic
    return acceptImpl(text);

protected abstract boolean acceptImpl(String text);

I would expect the hook method to be named doAccept() or acceptHook() instead of acceptImpl().

Is the "-Impl" suffix used in practice for hook methods?


Is it indeed a confusing naming practice?


doAccept() would be definitely the more familiar convention, I think that mostly stems from the Servlet API.

I wouldn't call it confusing though, it's still easy enough to understand, and the convention it breaks is not nearly as universally expected as e.g. having uppercase class names and lowercase method and variable names.

  • Yes, agreed, it's not a universal convention, I guess that's why it was hard for me to find proper documentation. Have you ever seen it in practice though? I'm not trying to condemn my colleagues' work, just trying to get a feeling how off we're are from good naming practices.. – kouretinho Oct 27 '16 at 12:01
  • No, I haven't seen "Impl" for this before, I just wouldn't really call it a bad practice to make up your own convention for a pattern that doesn't have a universally accepted existing convention. – Michael Borgwardt Oct 27 '16 at 13:08
  • thx again for the clarification Michael – kouretinho Oct 27 '16 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.