In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, Xiaobian will share with you the relevant knowledge points of what the shortcomings of prototype are. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you will gain something after reading this article. Let's find out together.
Dynamic Configuration of Applications with Classes
Some runtime environments allow you to dynamically load classes into your application. In languages like C++, Prototype patterns are key to leveraging this functionality.
Some development environments can load classes (e.g., by serialization) as programs execute. Once loaded, these classes can be used either directly or as templates for generating other objects. The key to the second approach is prototype patterns.
An application wishing to create instances of dynamically loaded classes cannot statically reference the class constructor. Instead, it is up to the runtime environment to create an instance of each class automatically at load time and register it with the prototype manager (see the Implementation section). This allows the application to request instances of newly loaded classes from the prototype manager that are not originally linked to the program. ET++ Application Framework [WGM88] has an operating system that uses this solution.
In general, a dynamically loaded class should be considered a derivative of a predefined base class. So there's probably no way to know (and shouldn't know) the exact type. As a result, there is no way to use the constructor of a class (i.e., the constructor in the translation). This problem can be solved using prototype patterns.
We can refer to the Word software gallery function to understand this matter.
The first is to load the gallery, that is, open the gallery file operation. This process of opening a file is actually the process of reading composite graphic data stored in the file and building composite graphic instances in memory. These composite drawing instances are generated and logged into the Prototype Manager for later use. When we select a graphic from the gallery, the screen that opens is the graphic instance in the Prototype Manager.
Next, the user selects a shape and drags it to the drawing area. From the perspective of the program implementation, this operation is the process of requesting a new instance of the composite drawing from the prototype manager. As long as the implementation defines the appropriate interface, Word can import new classes defined elsewhere. This ensures scalability of the process.
The main drawback of Prototype is that every subclass of Prototype must implement Clone operations, which can be difficult. For example, it is difficult to add a Clone operation when the class under consideration already exists. Clones can also be difficult when internals include objects that do not support copying or have circular references.
Clones, as a means of generating instances in prototype patterns, are of course costly. Consider the case of adding cloning methods to an existing taxon: if every class in the taxon is composed differently, the workload is large; if there is information that cannot be copied (such as references pointing out of copy range) or circular references, more careful organization and design is required.
The above is "prototype shortcomings are what" all the content of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.