If you have tried some of the examples in the Reading Objects from the Directory lesson, then you likely have noticed the use of object factories. An object factory is a producer of objects. It accepts some information about how to create an object, such as a reference, and then returns an instance of that object. Both the representation and the nature of the information that an object factory expects and accepts as valid are determined by the object factory and are closely tied to how that information is stored in the directory.
This lesson first describes how to write an object factory. It then discusses some other uses of object factories, in addition to those already seen in this trail, as well as the way in which factories relate to service providers. It concludes with three examples of object factories: