Factory - Netflix

Largely improvised, this 1/2-hr comedy revolves around 4 long-time friends - Gary, Smitty, Gus and Chase - who all work at the local factory in a small Illinois town.

Factory - Netflix

Type: Scripted

Languages: English

Status: Ended

Runtime: 30 minutes

Premier: 2008-06-29

Factory - Factory method pattern - Netflix

In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method—either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.

Factory - Java - Netflix

In the above snippet, the MazeGame constructor is a template method that makes some common logic. It refers to the makeRoom factory method that encapsulates the creation of rooms such that other rooms can be used in a subclass. To implement the other game mode that has magic rooms, it suffices to override the makeRoom method:

A maze game may be played in two modes, one with regular rooms that are only connected with adjacent rooms, and one with magic rooms that allow players to be transported at random (this Java example is similar to one in the book Design Patterns). The MazeGame uses Rooms but it puts the responsibility of creating Rooms to its subclasses which create the concrete classes. The regular game mode could use this template method:

Factory - References - Netflix