33.6. Abstract Factory (GoF) for Families of Related Objects

The JavaPOS implementations will be purchased from manufacturers. For example[5]:

[5] These are fictitious package names.

						// IBM's drivers
						com.ibm.pos.jpos.CashDrawer (implements jpos.CashDrawer)
						com.ibm.pos.jpos.CoinDispenser (implements jpos.CoinDispenser)
						...
						// NCR's drivers
						com.ncr.posdrivers.CashDrawer (implements jpos.CashDrawer)
						com.ncr.posdrivers.CoinDispenser (implements jpos.CoinDispenser)
						...
					

Now, how to design the NextGen POS application to use the IBM Java drivers if IBM hardware is used, NCR drivers if appropriate, and so forth?

Note that there are families of classes (CashDrawer+CoinDispenser+...) that need to be created, and each family implements the same interfaces. ...

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.