During past projects / reviews I found the following naming conventions for interfaces and their realizations:
- IService service = new Service();
- Service service = new ServiceImpl();
- ServiceIF service = new Service();
Each one contains redundant information. Either your are emphasizing the interface, or its implementation. The information is already contained in the source code, so both is redundant.
Such naming conventions are only necessary if you have really no idea how to name the implementation, so instead of thinking about a sound name, its easier to rely on existing template.
The lack of name for the implementation is probably also an indicator for it's unsufficient responsibilities. So if you can not find a proper name for the implementation, it is a good idea to think about removing the interface and exposing directly the implementation - then without strange conventions. Actually there are no such conventions in the JDK. The interfaces and their implementations are often even called differently:
Runnable r = new Thread();
RootPaneContainer c = new JFrame();
TableModel t = new DefaultTableModel();
Remote remote = new UnicastRemoteObject();
The purpose of an interface is the abstraction or decoupling from several implementations. A single implementation do not needs to decoupled with an interface. There are some exceptions from the rule, like the need to use dynamic proxies etc.
An interface realized by a single implementation with strange naming conventions shouldn't be considered as a general best practice...
NEW: Java EE 7 Testing-- Available For Streaming