39

I've seen impl used as namespaces and as a class suffix in a number of different .net and Java libraries. I just want to know what it means and why it is used.

keithwill
  • 1,964
  • 1
  • 17
  • 26

2 Answers2

39

It stands for Implementation.

It's a Java convention.

Often in java (particularly J2EE) you will get an object from some factory, and then use it.

That object's type is often given to you as an interface, so that you don't need to know the actual class, just its methods.

An impl class is usually a class that implements the behaviour described by one of these interfaces.

TreyE
  • 2,649
  • 22
  • 24
  • 1
    [ATL](http://en.wikipedia.org/wiki/Active_Template_Library) also likes to uses `Impl` as a suffix in COM class implementation modules (to differentiate them from the library's entry point module). – Frédéric Hamidi Oct 29 '10 at 18:19
  • 12
    this is a really horrible [naming convention anti-pattern](http://www.vertigrated.com/blog/2011/02/interface-and-class-naming-anti-patterns-java-naming-convention-tautologies/) –  Feb 28 '11 at 18:12
  • 3
    @feelingunwelcome I don't disagree - the main thing here is that if you want to test easily in java/j2ee you often end up with a 1:1 class/interface ratio to break apart your dependencies. Naming can start to be a real pain in those circumstances. It *does* avoid the "IInterfaceName" issue - it just moves the ugly to a different place. – TreyE May 01 '18 at 14:54
  • 1
    To me the `Impl` convention is an indicator that the class is intended to be instantiated through something like a factory rather than directly via its constructor. Though if that's the intent there are better ways to accomplish that. – David DeMar May 05 '22 at 17:00
16

It's short for "implementation". Generally it's used when the parent package contains abstract classes, interfaces, and perhaps some factory classes which are the main point of access, and then the impl package contains various concrete implementations of those abstract classes and interfaces.

Brad Mace
  • 27,194
  • 17
  • 102
  • 148