== Why is this an issue? The use of factory methods lets you abstract the job you need to do from the specific tool implementations needed to do it with, and helps insulate you from changes. This rule raises an issue when instances of these are instantiated directly: * ``++javax.xml.parsers.DocumentBuilder++`` * ``++javax.xml.parsers.SAXParser++`` * ``++javax.xml.transform.Transformer++`` * ``++org.xml.sax.XMLReader++`` * ``++org.xml.sax.XMLFilter++`` * ``++org.w3c.dom.*++`` === Noncompliant code example [source,java] ---- DocumentBuilder builder = new DocumentBuilderImpl(); // Noncompliant ---- === Compliant solution [source,java] ---- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); ---- ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message Use a factory method to create this "xxx". ''' == Comments And Links (visible only on this page) === on 15 Jun 2015, 20:14:10 Nicolas Peru wrote: Looks good endif::env-github,rspecator-view[]