Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Moving On from Here

In this article, we looked at creating a factory that allows the user to specify a class at runtime, rather than locking the application into a particular implementation for an interface.

In this case, we looked at two different Ferret objects, which performed searches and reported on the results. Because the FerretFactory looks at a system property before deciding which class to use, anyone can write a Ferret implementation that can plug into the system, giving us different results from potentially different sources without making a single change to the main application.

  • + Share This
  • 🔖 Save To Your Account