O'Reilly logo

Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition by Craig Larman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required