IOS design model learning (21) enjoy RMB

Source: Internet
Author: User

1 Preface

In object-oriented software design, using public objects not only saves resources but also improves performance. Shared Objects can only provide some internal information, but cannot be used to identify objects. A Design pattern specifically used to design shared objects is called the Flyweight pattern ).

2. Details

2.1 Brief Introduction

Two key components are required to implement the metadata sharing mode. They are usually shared object objects and their pools. A central object maintains this pool and returns an appropriate instance from it.

Use the sharing technology to effectively support a large number of fine-grained objects.

2.2 When to use

(1) applications use many objects;

(2) saving objects in the memory will affect the memory performance;

(3) most special states (external States) of objects can be put outside and lightweight;

(3) After the external State is removed, a small number of shared objects can be used to replace the original group of objects;

(4) applications do not rely on object identifiers because shared objects cannot provide unique identifiers.

3 conclusion

The above is all content and I hope it will help you.

 

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.