Abstract Factory UI Toolkit that supports multiple UI styles Network diagramming tool that supports different vendor's equipment (different icons for switches, routers, hubs, wireless access points, etc.) Generic graph editor (createNode, createLink, ...) Abstract Factory for instantiating different kinds of data structures (createList, createSet, createMap, etc.) Different levels of difficulty in a computer game abstract factory creates different kinds of characters, objects, obstacles BeginnerFactory, IntermediateFactory, ExpertFactory Builder Constructing a complex object piece-by-piece Syntax-directed Translation Converting data files between different formats Word -> Word Perfect, RTF -> PDF, etc.) Programming tools (compilers, lint, etc.) source -> parse tree source(language A) -> source(language B) SAX XML Parser Convert XML to other representations Search XML document for information Builders often create composites Builder could use AbstractFactory to create piece objects Operations in Builder interface determined by the format being parsed Factory Method Abstract framework class delegates creation of objects to subclasses Microsoft Foundation Classes (MFC) framework for building Windows applications Application, Document, View factory methods for creating documents and views Collection.iterator method in Java java.net class URL { URLConnection openConnection(); // factory method } abstract class URLConnection { abstract InputStream getInputStream(); // factory method abstract OutputStream getOutputStream(); // factory method } class HttpURLConnection { InputStream getInputStream(); // factory method OutputStream getOutputStream(); // factory method } JDBC interface Driver { Connection connect(String url, Properties info); // factory method } interface Connection { Statement createStatement(); // factory method } interface Statement { ResultSet executeQuery(String sql); // factory method } An Abstract Factory is a bunch of factory methods that create a family of related objects