In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Look at the design from another angle
The truth may be on the side of the few.
-Plato
If you deviate from the truth at first, you will go a long way in the end.
-Aristotle
In the previous chapter, we explain the basic ideas and principles of software design from some formal point of view, however, if we are shackled in these so-called standardization, then our design will be overshadowed. If you don't look at it with the other eye, you can never make a real breakthrough. In this chapter, we will speak freely and look at the design from another perspective.
1. Unity
In physics, the unification of all things is one or more principles that are unified into a few, and such principles can better drive the operation of the whole world. just as there is mass, there is gravity (or general relativity with spatial bending under more esoteric mass objects), it is a great idea for our design to be unified. For example: in one of our tariff designs, we have two states of trial and formal use from the business, and the trial has a time limit and a quantity limit. On the other hand, it is officially used for timing and counting according to the rate. If we follow the general design, we must divide it into two states. Then it is treated differently in the program or database. But let's think about it. Is this superfluous? Whether we can be unified, we will try as a default processing, set the time to 1 week, the number is limited to 2. Then this setting can be used as a default setting in the database record. In this way, I do not have to do any special type screening, trial and formal use is only a numerical difference, so my design is greatly simplified.
As the whole world tends to be a unified feature, in the process of software design, there is an urgent need for our system to be able to carry out unified planning and design.
For example, in terms of computer architecture, the simplest unified address coding can bring us full benefits, which may be based on different access speeds and different hardware-constructed devices, but in terms of abstract concept addresses, if we code according to the same address, then our software system will first be independent from these complex hardware features, in our software system. Without reflecting the differences in the way of reading and writing on these addresses, the simplest unity of the software system is reflected.
In PWE3 edge-to-edge pseudo-line simulation, the motivation of PWE3 specified by IETF:
Universal label to provide a unified data transmission platform
A variety of different services, such as SDH/STM-N, ATM, IP networks are based on packets. Operators hope that these services can converge in a unified way during transmission, reducing the number of networks, the complexity of configuration and maintenance and the cost of links.
TDM uses fixed bandwidth time slot division, which does not support statistical multiplexing of burst data services.
ATM technology uses 5-byte head 48-byte payload fixed-length cells as the basic transmission unit. In addition to the overhead brought by ATM SMS, it also has ATM disassembly and assembly. (SAR) processes, especially at high rates, are very difficult, based on optimized PSN (packet switched networks), which should support network flows of any length. It has the ability to perform optimized network traffic engineering, classifies network traffic flows, implements traffic management and control, and ensures according to the priority of Qos.
Simulation dedicated line to improve the network business with high rate of return
Although Internet is the fastest growing business, it does not generate the highest return per bit. For end users, although the price of dedicated line is higher than that of IP data service, it has better service quality and security guarantee.
Data awareness, realizing the convergence of different data services
The burst of data service causes the deficiency of the whole network bandwidth and affects the Qos of the service, which must be differentiated. Another advantage of data perception is that the service is guaranteed by Qos on the PE side, and there is a special tunnel in the core IP/MPLS transmission network, which means that the core layer knows the quality requirements of user services through the PE side, which facilitates the end-to-end service and network resource configuration, and greatly simplifies the operation of the NGN network.
Protection of investment and provision of network services
PWE3 provides a general encapsulation layer, and the network built by PWE3+MPLS can be encapsulated in new layer 2 without any modification to the original network. A large number of traditional devices have been installed in the public network, which need to be retained and interconnected.
First of all, unification requires separation, although this seemingly contradictory process is not contradictory, because only separation can be unified, only separation can be better abstracted, and things in common can be abstracted independently, and then plan a unified processing process, so separation is the basis of unity, and the ways and methods of separation are described in detail in the separation mechanism, so I will not repeat them here.
In general, we can achieve a unified goal through two different abstract processes, which are called "weak abstraction" and "strong abstraction". The former is an abstract process from special to general, that is, the process of abstracting and summarizing the commonness in a class of concrete things or relations, and the latter is an abstract process that strengthens the original structure by introducing new features, which can be put simply. The former is that we often see that the common parts of the class things are "extracted" by abstract ways, while the latter is through the way of "filling" and introducing new features to achieve the consistency and completeness of the whole system.
The first way is common, as long as we use abstract, comparative transformation processing will be better able to achieve our expected goals, but this way is often easy to unify the failure of some special counterexamples. We still use coding examples to illustrate the confusion caused by special circumstances. The ASCII coding method we often used in the past can well describe English letters and characters. ASCII can be described completely with 8 bits, that is, 1 byte. However, when we need to express Chinese characters, Japanese, Korean and other forms, we need to expand, so we promote UNICODE coding, UNICODE coding uses 2 bytes. Although it is perfect to cover almost current language characters from a unified scene, there are still some special characters (such as some traditional characters in ancient Chinese) that can not be expressed by UNICODE, but at this time, through the expansion of more bytes, our system has become very stiff, and it is very difficult for us to carry out "smooth expansion" better. Note the meaning of "smooth" here (we can't unify it, at least in terms of compatibility and continued extension). Therefore, for better unification, there are some intermediate format character sets, such as the UTF-8 encoding that we often use.
UTF-8 coding rule: if there is only one byte, its highest binary bit is 0; if it is multibyte, its first byte starts from the highest bit, the number of consecutive binary bits 1 determines the number of bits it encodes, and the remaining bytes start with 10.
What are the benefits of coding through UTF-8? On the one hand, we are compatible with the information represented by ASCII,ASCII. Good UFT-8 is a value in the character that represents this area. On the other hand, we can extend the characters to 4 bytes, 6 bytes or more bytes according to the unified law, and such an extension does not need to disturb the previous coding sequence number, so that through the unification of the rules, to achieve a more "smooth" compatibility extension. At the same time, UTF-8 coding can be read and written quickly by shielding bit and shift operation.
Therefore, do you see that in the process of unification, on the one hand, we need to find these counterexamples in time, and on the other hand, we need to consider in time how to integrate these counterexamples into our unified system, sometimes, it is because such a counterexample overturns our unified design ideas and methods from a certain point of view, so this will be a very valuable experience for us.
The second kind of abstract way, in fact, requires us to make some appropriate supplements, and these supplements can be dealt with in a more uniform form, such as generalizing the pointer to the iterator, and so on, we use an example from the masters to illustrate the characteristics of this unified way (by defining NULL objects to unify our class system).
For example, in a system we can unify operations through interfaces and composition patterns, as shown in figure 7-2.
Figure 7-2
However, if we need to judge a pointer (reference), we need to perform the process of judging whether it is NULL or not, at this time, if we add the NULL to a NULL class and unify it into this system, then our program code can be better separated from the specific environment, can be better abstracted and form a system, as shown in figure 7-3.
Figure 7-3
In this way, we can do what we think is very reasonable in the function handling of the rewriting interface of NULL, and then beautifully achieve our formal unity. Therefore, this abstract method requires us to be able to classify it into a unified formal processing according to the further extension when the original features are insufficient. However, such an extension also has its conditions and limitations. In many cases, it is often possible to expand improperly and cause the system to become more non-uniform. I think there must be much more failures than successes. Otherwise, we can easily use it to form a unity, but the reality may be more "cruel".
Unified beauty reveals the universal connection of the system, and beauty lies in our harmonious, coordinated and orderly true reflection of the objective world, thus making people condescend, covering everything, and enhancing people's insight into the world. so that people can obtain more new achievements, understand more new phenomena, make more reliable predictions about unknown things, and win greater victories in transforming the world. The pursuit of unified beauty will promote the further development of software design.
This unity can directly bring us a solution that simplifies complexity into simplicity, which can greatly simplify the complexity of the system, and at the same time make other people who understand and analyze the system very simple to understand our system. And can be developed and applied in a better incremental way under this unified framework.
Take a look back at the REST design style:
REST (declarative State transfer, English: Representational State Transfer, REST) is a software architecture style proposed by Dr. Roy Fielding in his doctoral thesis in 2000. It is a way of design and development for network applications, which can reduce the complexity of development and improve the scalability of the system.
REST design guidelines:
Everything on the network is abstracted as a resource.
Each resource corresponds to a unique resource identifier (resource identifier)
The resource is manipulated through a common connector interface (generic connector interface).
Various operations on resources do not change the resource identifier.
All operations are stateless.
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.