Java schema and Java Schema

Source: Internet
Author: User

Java schema and Java Schema

The structure mode describes how to combine class objects to form a larger structure. The structure mode describes two different things: Class and Class instance. Therefore, it can be divided into the class structure mode and the object structure mode.

In the GoF design mode, the structural modes include:
1. Adapter mode Adapter
The adapter mode converts an interface of a class to another interface that the customer wants. The adapter mode allows the classes that cannot work together due to interface incompatibility to work together.
Two mature classes need to communicate, but the interfaces are different. Due to the open and closed principle, we cannot modify the interfaces of these two classes, so we need an adapter to complete the connection process.


2. Bridge Mode
The Bridge Mode separates the abstract part from its implementation part, so that they can all change independently. It supports the principle of opening and closing and the principle of combining saw and reuse. The implementation system may have multi-angle classification, and each type of classification may change, so we can separate these multi-angle classifications to allow them to change independently and reduce coupling between them.


3. Composite
In the combination mode, objects are combined into a tree structure to represent part-whole hierarchies. In the combination mode, users can use a single object and a composite object in a consistent manner.


4. Decorator
The decoration mode dynamically adds some additional responsibilities to an object, which is more flexible than generating subclass. It can also be said that the decoration mode separates the core responsibilities of the complex class from the decoration functional area, which simplifies the complex class and removes the repeated decoration logic in the relevant class. The decoration mode does not extend functions by inheriting the original class, but achieves the same purpose and is more flexible than inheritance. Therefore, the decoration mode is an alternative to the inheritance relationship.


5. Appearance mode Facade
The appearance mode provides an agreed interface for a group of interfaces in the subsystem. The appearance mode defines a high-level interface, which makes the subsystem easier to use.
In appearance mode, the customer does not know specific subsystems. Therefore, these subsystems are encapsulated and only provide a single and simple interface that the user understands, you can directly use this interface to complete the operation without ignoring the specific process, and the subsystem changes do not affect the user, so that information is concealed.


6. Flyweight
The metadata mode effectively supports a large number of fine-grained objects by using the sharing technology. Because it can greatly reduce the number of individual instances through sharing, it avoids the overhead of a large number of very similar classes ..
The metadata mode allows multiple objects of a category to share an object of this category, rather than instantiating their own objects. This saves memory.


7. Proxy Mode
Provides a proxy for other objects and controls the reference to the original object by the proxy object to indirectly control access to the original object.

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.