Design Pattern Java Architecture pattern

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.