a OA system needs to provide a cryptographic module, the user confidential information (such as password, mailbox, etc.) after encryption, stored in the database, the system has defined the database operation class, in order to improve the development efficiency, now need to reuse existing encryption algorithms, these cryptographic algorithms are encapsulated in the class provided by the third party, some even no source code, Try the adapter mode, design the module, and reuse the third-party encryption algorithm on the basis of not modifying the existing classes.
An existing interface Dataoperation defines the sorting algorithm sort (int []), and the Lookup method search (Int[],int), the Quicksort method of the known class Quiksort implements the fast sorting algorithm, The Class BinarySearch class BinarySearch (int[], int) implements a two-point lookup method, and now uses the adapter pattern to design a system that will class without modifying the source code, The methods of the Quicksort and class BinarySearch classes are applied to the Dataoperation interface.
(1) Draw the adapter mode structure view;
(2) Please draw the instance class diagram and code implementation.
If you need to develop a cross-platform video player, you can work on different platforms (Windows,Linux,UNIX, etc.)play video files in multiple formats, such as Pmeg, RMVB ,AVI,WMVwaitCommon adaptation format, now uses bridging mode to design the player.
(1) Draw a bridge Mode structure View
(2) give the instance class diagram and implement the code.
This article is from the "10924720" blog, please be sure to keep this source http://10934720.blog.51cto.com/10924720/1886632
Design Pattern Java Architecture pattern