In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you the relevant knowledge about what the motivation of the web memo mode is. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
Intention
The data that saves the internal state is generated by the object according to the requirements of the external environment and handed over to the external storage. The external environment can return the data to this object and restore the previously saved state when needed.
motivation
There is often a need to save the internal state of an object. For example, in some important systems, in order to prevent operational errors, you may want to save the state of the settings so that there is a way to restore them if necessary. The undo functionality used in many software has similar requirements. A necessary condition for restoring the original state of an object is to obtain and save the state of the object first.
There are two ways to get the state of an object. One is to get it from the outside. However, this approach requires the user to understand the internal state of the object, which violates the principle of encapsulation. It may cause unnecessary coupling. Another way is to let the user generate the data that saves the state, which maintains the encapsulation of the object and simplifies the work of the user.
For example, the graphic editing software in the image above, as the user drags the rectangle. The state of the connection line changes. When the user drags the lower rectangle to the right, the position of the connection line changes accordingly. However, due to the need to maintain the connection between the connection line and the rectangular box. The final connecting line stays in the lower right corner and the upper left corner of the two rectangles. It is not easy to cancel this operation: there is more than one initial state that ends up in the right state. When the user drags the following rectangle back to its original position, the software does not know where the connection line should be restored.
At this point, a more realistic way is to save the state of the connection line before dragging. When the user starts to drag the rectangle, the software saves the state of the connection line and the rectangle, and when the undo operation is needed, the software can restore the state of the connection line and the rectangle.
If we leave both the operations of getting the state of the connector and restoring the state of the connector to the connector object itself, this is an application example of the memo pattern.
These are all the contents of the article "what is the motivation of the web memo mode". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you 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.