Modeling Method (1)-Is it possible to be defeated?

Source: Internet
Author: User

Therefore, good fighters can win, but cannot win. Therefore, it is said that victory is unknown and cannot be.
--Sun Wu Sun Tzu's Art of War

We all know that martial arts include tactics and methods, and they are indispensable. If you only know the tricks and do not know the way, the tricks are useless. In some special circumstances, it may be the way to beat a dog, but in the dark it is the way to use the Quanzhen jianfa. At this time, in essence, it is actually using the Quanzhen jianfa. Even some martial arts have the same tactics but there are two sets of methods. Which method should be used depends on the situation? If the wrong method is used, not only cannot win the enemy, instead, they will die worse than those who won't do anything!

For the martial arts of modeling, its approach is relatively simple. Whether it is a UML diagram, an erdiagram, or a data flow diagram, you can learn it for at most a month. However, its approach is very complicated, it is not easy to integrate and use data as needed. The basic method is to understand what a model is and why modeling is required.

What is model?

ModelIt is a conscious simplification of theory, system, or something, focusing only on their main objects or methods of operation. A model can be represented in multiple ways. It can be an imitation product (for example, a sand table model of a building), a certain representation (like the "A box represents an object, a one-way arrow represents the force direction" that we use to learn force analysis in the middle school physics class), text description, two-dimensional or three-dimensional, and any other convenient expression method. There are three key points:
1) The objects presented by the model can be something, the most common of which are buildings, automobiles, and machinery. It can be a system, for example, a human system, a city, an enterprise, an ecological environment, an animal group, an application, and so on. It can be a theory, such as relativity, evolution, and Newton's second law.
2) The model is a conscious simplification of the research object, so that we can focus on the main objects we care about or the way we operate, and (more importantly) only remove irrelevant attributes, it is possible to discover reproducible patterns (so as to predict future observations, which is also the main purpose of scientific research ). For example, Newton's second law simplifies an object into a particle (only concerned with the object's quality attribute) and simplifies the space into a flat three-dimensional space, the time is simplified to the absolute time that does not depend on the speed and quality of the object.
3) The model only exists in our minds and is no longer realistic in any other sense. The value of a model only serves a theory, or represents something or something that we are interested in. Relativity is very different from the spatiotemporal model in Newton's second law. It cannot be said which of the two models is closer to "reality", but they are only applicable to different theories.

Is modeling necessary?

What is simplified, abstract, and concept ...... Hearing these xuanjicang words makes people very proud. We (especially the boss) hope that we have signed a contract with the customer today. Tomorrow, the programmer will print both hands and give a big drink: "Ah, I'm a little girl -- I don't need money to open the door with sesame --" the big outbreak of the universe and Cracher, and then the program of Kazuo suddenly miraculously completed. Can this beautiful wish be fulfilled? To answer this question, we should first look at what is a program.
ProgramIsSystemIt has an internal state that exists in an external environment, and an external environment also has a state. These two statuses always uniquely determine the next internal status. This definition does not contain structures and behaviors. We can simply think that some aspects of the State can prove to be lasting, sustained, and unchanged, and this stable part is of the system.StructureAnd the changed part isAction. For example, if I say "I love you" to my wife on QQ, I can predict that my wife will either receive the word "I love you, either you cannot receive anything, but you will never receive "I hate you ". Why can I predict that my wife will receive the word "I love you? Because I amYes-- Observe the status changes of the system several times in a row (for example, when I send "I love you", my wife receives "I love you", I send "I hate you", my wife receives "I hate you", and I send "I "hate you, "My wife received" I hate you "), I figured out the law of the QQ system. The status of the external environment, in addition to the words I entered, also includes the network and my wife's computer. If the network is interrupted, my wife cannot receive anything, if my wife's computer does not have a Chinese font, it will receive a bunch of garbled characters. It is worth noting that the so-calledStatusIt refers to a situation that can be recognized by the observer again if it is reproduced. If I add the memory address attribute when observing the status change of the QQ system (the information my wife receives is stored), the status change of the system will be irregular, I cannot predict the next state of the system based on the current state of the system and the status of the external environment. In fact, I ignored too many items. For the internal status of the system, I ignored the storage address of the information received by my wife, the font size of the information displayed, and so on. For the external environment status, my wife is male, female, mood, weather is overcast, clear, day or night is not included in the model. Yes, a model is indispensable for any understanding of the system, even if we don't draw it out, we don't even realize its existence.
So what are the benefits of drawing a model? First of all, making a model is a process of forced thinking, which is the same as writing an article that forces thinking. Friends in the garden should have some experience. Second, the model is a good tool for thinking. Because the human brain has limited ability to think, and there are no more than seven objects to remember and think at the same time, it is much more effective to think about painting, repair, modification, and modification than to meditate only in the mind. Third, the model is an effective communication tool that helps eliminate misunderstandings between programmers and experts in the field. There are many questions about this. Some people say that many programmers cannot understand the UML diagram. How can they understand it? This is indeed a tricky problem. One method is to teach experts in the field to view UML diagrams. Of course, this requires experts in the field to be smart, learn, have time, and be interested. Otherwise, you only need to select or invent a communication tool that experts in the field can understand and be interested in. Generally, users of the information system are Excel experts, and verbal communication, sketch, and sample data are good moves.

Incomplete and too complete

All successes in Physical Research depend on wise choice of observed objects. This choice depends on the importance of the object, and on the subjective extraction of the object features. Although some features are attractive, the current science is still unable to handle them, so we have to discard them temporarily.
-- James C. Maxwell (James C. Maxwell)

Xuan Zhi and Xuan, the door to the masses.
-- Lao Tzu's moral Sutra

Xiao said: "Yuan shaoshi is so bold and thin that he has no plans to cut off his work. When he is doing big things, he will stay away from him. Not a hero, too ."
-- Luo Guanzhong Romance of the Three Kingdoms

As mentioned above, the model that reflects all the details of the system is meaningless. The model should include the attributes of the system. On the one hand, the model is subjective Extraction Based on the importance of the attributes. "Xuanzhi and xuanzhi, the door to the masses" cannot be used as a "Tao" model. In addition to increasing our reverence and yearning for the "Tao", the empty descriptions of "extremely mysterious and far-reaching" have no more features. Similarly, the sand table model only focuses on the appearance of buildings. It does not have much function except fooling investors and buyers. As Yuan Shao's model, it is also very simple to "be brave and thin, seeking for nothing to break down; doing big things and turning yourself away, seeing small profits and forgetting to live", but it can be used to predict Yuan Shao's behavior based on it, so it is a good model. According to this model, Cao made a lot of important decisions, and eventually won more victories in the Battle of Guandu, defeating Yuan Shao.

A model is an understanding.

The model is subjective. This conclusion may make many people feel lost, because it means that there is no correct or true model. Models are neither mysterious nor advanced. They are just tools for humans to understand and express the world.

As a simulation program

If you look at the various applications around us, you can find that most of them are usedSimulationIn the real world, the goal is to save costs. In the anti-terrorism elite game, players are armed with a variety of popular firearms for a 5-to-5 fight, which takes only 10 minutes. Computer Aided Design and Simulation Technology have long been widely used in mechanical manufacturing, aerospace and even simulation of the steel frame structure of the Bird's Nest Gymnasium, saving hundreds of millions of dollars. The information system is used to simulate the actual business of an enterprise. It also hopes to complete information flow, sharing, storage, processing and retrieval at a lower cost and higher efficiency.

A simulation is an understanding of the real world.

I once imagined that in the future, such a game could be used to fully simulate all the details of the real world. People enter this game, just like entering another real world. Therefore, this game does not require human design of any plots and roles. Yes, this game is just like the Matrix system in the hacking empire.
Can such a game be developed? As we already know, if we focus on all the details of the real world, we will not be able to see any reproducible state. Similarly, if the game simulates all the details of the real world, we cannot get any reproducible status of the game. Then, we will never prove that the game has completely simulated the real world.
As we will see next, due to our own limitations, both the white box and the black box cannot be fully presented. Even if the system is constructed by ourselves, this is the same.

Martian VS 1-2-3

I want to tell you that the Martian wants to intrude into the earth. Their ship has already flown 36,888 laps in the near-Earth orbit. Their purpose is not to destroy the Earth, but to use the earth as their colony. Moreover, through observation, they found that there is something on Earth that has strong control over humans. The Martian believes that as long as the simulation of this thing is completed, it can easily enable humans. This is a traffic light, also known as a traffic light. Of course, it is not called by the Martian. But for the convenience of narration, we should call it a traffic light.
But the Martian is really crazy. They don't know how traffic lights control humans. To understand this problem, they need to do four tasks: 1) determine the system boundary: Should one light bulb, two light bulb, or three light bulb be studied as a system? Or should we use four sets of traffic lights on a transport post as a system? Do you want to include pedestrians and cars in the system? 2) select some system attributes as the research object. 3) make a large number of observations to summarize the laws of system state changes. 4) if you cannot find the rule or find it useless, you need to re-select the system boundary and research object, that is, repeat the work of 1), 2), and 3, until a satisfactory rule is found. This is a long process, and we don't know when to make a breakthrough. However, there is not much time for the Martian people-their leaders decided to set the milestones for intruding into the earth at the end of the month. Therefore, the Martian was about to ask a field expert, and I was the one who was unfortunately selected.
Martian: "Do you know traffic lights ?"
1-2-3: "Of course I understand ."
Martian: "Tell me ."
1-2-3: "What do you mean ?"
Martian: "I want to simulate a traffic light and use it to control humans. Tell me how traffic lights control humans ."
1-2-3: "Ha! Ha! Ha! You are not serious, are you? Simulation traffic lights? Still Controlling humans ?"
Martian: "Of course I am serious. This month's bonus depends on it ."
1-2-3: "However, I mean, since you are so smart, such a high level of UFO can also be created, why do you need to ask me? You only need to make one or more traffic lights.Exactly."
Martian: "you mean, I only need to make one thing, it has three bulbs of different colors, and a metal shell ......"
1-2-3: "Yes ."
Martian: "Does it have to use electricity? You know our ship does not use electricity, which is an inefficient energy source ."
1-2-3: "Of course you need to use electricity. You just need to imitate it ."
Martian: "What about the color of the shell? Is it important ?"
1-2-3: "just imitate ."
Martian: "Okay. How many dust and bacteria are on the shell to imitate ?"
1-2-3: "Hey, this ......"
Martian: "What about the shell temperature? What about the internal temperature? What is the reflectivity of the shell to alpha and beta rays? We also found that the traffic lights would radiate 2100 ~ 7600 of Jessica's energy, this energy will cause a space-time distortion of 0.027 kakaxisi, and this distortion will lead to a 2100 billion deviation from the lambda planetary orbit of the Big Bear constellation ......"
1-2-3: "Okay, I have served you. I told you directly, it's very simple-the red light stops and the green light goes on ."
Martian: "Oh, it is important to see which color of the light is on. But what is the yellow light used ?"
1-2-3: "the yellow light is only a warning, not very important ."
Martian: "Hey, you should not underestimate the IQ of our Martian. The yellow light, regardless of its size or position, is the same as other lights, but it doesn't matter at all. This is really not logical ."
1-2-3: "Okay, I'll give you a detailed explanation. After the green light goes off, before the red light goes on, the yellow light will be on for more than 10 or 20 seconds. for pedestrians who have already passed the line, it means: 'It will be switched to a red light. Please pass through the crossroads quickly. '; For pedestrians that haven't crossed the line, it indicates: 'Stop pass '. It is very important for traffic safety, but it is not important for your simulation for the purpose of controlling humans. Do you want to simulate it ."
Martian: "Well, my simulation model also determines. We decided to ignore the pedestrian's moving speed attribute, so our model was like this: for pedestrians that haven't passed the line, the green light is on, and the green light is off; people who have crossed the line must move forward in any way. Therefore, our model only includes two objects: green light and pedestrian ."

Mars programmer

When a programmer wants to write a simulation program for a strange field, he will not be much better than a Martian. The real world is a black box for him, but using the black box method for research will take a lot of time and the effect is not obvious. Most physicists use the black box method to study the universe because they cannot find God to ask.
For experts in this field, the field is a white box. Domain experts know all the details of the domain, all common and uncommon situations, and all reasonable and unreasonable solutions. If there is a device that can extract the knowledge of all fields in the brain of a domain expert, then programmers can study the field as a white box. However, such a device has not yet been developed, so programmers must be able to detect it. Programmers can gain a deep understanding of the field through appropriate questions, keen insights, bold imagination, and careful proof --Domain Model.
But what aspects should this model cover? Is it a workflow? Is data flow and processing? Is the organizational structure and the role of each participant? Are important events, transactions, and time? Is it legal, rule, and potential rule? Is it an object and a link? Is it a Data Structure and algorithm? In fact, a simulation program involves almost all of the above aspects, and each aspect is equally important. Simply focusing on some aspects of the simple model will inevitably lose other important essential attributes. If a model contains all attributes, it will be too complex and cannot be expressed using a two-dimensional image (text description is also two-dimensional, so there will be a dilemma that "one mouth of a book cannot be used as a table of two families ). The general practice is to use several models that focus on a certain number of important attributes to describe the domain separately. They finally form an integrated understanding of each other in the programmer's mind.
What we will focus onConceptual Model-- Use appropriate (including Creative concepts) Entities and relationships to form a concept and describe a model of the core concepts and principles of the domain.
Create a conceptual modelPurposeIs used as a guide for developing simulation programs. So from the very beginning, you must have a general idea of the customer's needs-What problems will the program solve for the customer? What aspects of the real world Will It simulate?
A simulation program is not a simple imitation of the real world. It is either simpler or more complex than the real world, or more nonstandard than the real world ...... What do customers really want? What is important? What is dispensable? This is what programmers need to use detective techniques to focus on exploration.
The conceptual model is profound and simple. The conceptual model does not show all details. It shows the concepts and principles behind the details. Programmers can gradually gain a deep understanding of the field by clarifying and implicit concepts, and even creating concepts when necessary.
After all, programmers are not Martian, and the field is not completely black box for programmers. Even new students know at least what is beautiful and comfortable (instinct level); what is simple and useful (behavior level ); what is polite and friendly (EMOTIONAL) and what is reasonable and legal (Cultural ). If you have already developed programs in other fields, you will find that some concepts are the same. These known domain knowledge is of great help to programmers to understand new areas and help programmers to raise sharp questions.

Become a field expert or a detective?

It is possible for programmers to become field experts. Some programmers have long-term contact with field experts in a certain industry, or even colleagues from field experts. After years or even dozens of years of tempering, these programmers can have field knowledge comparable to that of field experts, or even know more than a single field expert.
On the other hand, some programmers have to often model new domains. They have developed another kind of talent-they have become no secret detectives. In the face of unfamiliar domain knowledge and detailed information, they will feel overwhelmed and overwhelmed at the beginning. But soon, they began to understand the core concepts in the field, and then slowly, a complete and profound domain model gradually emerged.
As a matter of fact, there are no purely professional or detective programmers in the field. Even in the same industry, the situation of each customer is more or less different. Even for the same customer, its business is quietly changing every day. Therefore, professional programmers in the field must also have the skills to be a detective. For detective programmers, as we can see in detective novels, excellent detectives have a wealth of field knowledge and they always understand everything, knowledge in every small field may be the key to solving the case.

Pragmatism and Bureaucracy

No one likes to create models, just as no one likes to write documents. If every day's overtime work is difficult to deliver the base code on time, who is still in the mood to get another demon moth? For a program, only code is essential, and other things are dispensable. If programmers have full pockets and plenty of time, who wouldn't want to make the program as a work of art? However, the reality is that customers are under pressure, bosses are under pressure, project managers are under pressure, and programmers are under sub-health. The advantage of modeling is nothing more than an empty check. Who knows if it can be fulfilled?
Some companies especially like to make "regular" models. They also like to make a large number of "regular" documents in a unified format. They spent a lot of money buying formal modeling software, and spent a lot of time drawing beautiful models. However, you need to know that the time it takes to create a document is inversely proportional to the possibility of synchronizing these documents and programs. So these huge documents soon lost syncing with the program. We call these dead documentsBotnets. Once the model becomes a zombie, all the money and money spent on it will be wasted, and the rest will be just a pretty waste. Of course, some companies make documents to pass XX certification, or sell documents to customers (customers who have such a bag of brains.
My suggestion is that you only need to take a small step forward. If you have never thought about the concepts and principles behind the details, you can try to explain them in depth when you are free. If you are already thinking about concepts and principles, try to draw them on paper to see if they can help you think? If you have already painted them on paper, but never shared them with colleagues or field experts, you can try to draw them at the next discussion. If you are really idle, you can use professional software to draw them out. But do not think that it is easy to draw. verbal explanations and discussions are always essential.

Detailed Design book

Detailed design books are highly respected by companies that require analysis, design, and coding staff separation. The detailed design book serves as a bridge between designers and coding personnel. In theory, the detailed design book contains all the information required to write the code. The coding staff does not need to have any understanding of the field, as long as the detailed design book is required to code the code. In this way, after designing a project and completing the detailed design book, the designer can be busy with other projects. Or the designer can be on the horizon (for example, outsourcing projects ). But the detailed design book cannot contain all the details. In fact, it lacks a lot of details, so that the coding staff cannot ask the designers one by one (or the designers can no longer find them ), if a clear and consistent conceptual model is missing, errors and chaos are inevitable. If there is a talented and diligent designer whose detailed design book is detailed, correct, and consistent, then this detailed design book inevitably takes thousands of pages, in this vast array of details, the coding staff will inevitably turn dizzy, read the front and forget the back. Of course, it may also happen that the coding staff is equally talented and diligent. He read the detailed design book N times without a single word, and finally understood the truth. This is actually because the code engineer has derived the conceptual model from the detailed design book. Why is it so troublesome?

Is it possible?

As Brooks said in his masterpiece "no silver bullet", due to the complexity of the software itself and the limitations of human beings, it is difficult for software development to suddenly change in quality. However, we have made a lot of progress in the accumulation of data. I mean, there are almost no simulation programs in any field. Some fields even have generic products, and have a complete theory.
We all have the feeling that if the software to be developed already has an old version program that has been in use for many years, the work will be much easier. Experts in the field will praise it for its excellent design and poor performance. These functions are used every day, and these functions are almost useless and why they are useless. With this information, the old version of the program can be thoroughly understood. This old version of the program is equivalent to a prototype at this time.
If this company does not have an old version of the program, but other companies already have it? What if there are already good people who have summarized and summarized the conceptual models in similar fields? So when I saw Martin Fowler's "analysis model: Reusable Object Model" four years ago, I was so lucky. However, four years have passed, and I have not read this book for 20 pages. Is my practice insufficient? Poor Foundation? Are you stupid? Is it true? Still impatient? I don't know ...... However, I firmly believe that the success of today's brilliant books can be achieved. We will be able to learn the results of others' thinking over a dozen or even 20 years. Only by standing on the shoulders of giants can we go further and higher. I believe that the induction, summarization, and sharing of conceptual models can greatly help programmers grow fast. Maybe, in the future, universities will also offer courses like "domain knowledge.

Summary

Can I get a pair of paintings on the canvas? No. Can I get a piece of music when I press a few times on the piano? No. Can programmers who do not understand the field compile programs? Yes! However, you can guess how many puzzles you have. The most terrible thing is that these guesses will become the basis for other guesses. As a result, there are not many projects using iterative development, and there are many projects using stacked guesses.
However, we do not know what a good conceptual model is or how to convert it into an implementation model. We do not know how much time should be spent on modeling, nor how much benefit it can bring to the project. As to whether the model can be consistent with the program, we have no idea. So we finally gave up. We told ourselves that it is still the most effective way to run rivers and lakes and eat mixed meals.
However, humans naturally have the desire to constantly explore. We have been looking for more effective working methods. Test first? Case first? I want to say, understanding first! Without understanding, everything is empty talk.
Therefore, you do not have to stick to specific moves. As long as we pay enough attention to our understanding of the field and constantly explore it, we can find a suitable strategy for ourselves and our project team.

The next article will focus on how to build a conceptual model. (Expected to be released by the end of the year)

References

Model. Wikipedia.
Eric Evans,Domain-driven design (photo printing plate). People's post and telecommunications Press, 2007.
Translated by Stephen Hawking and translated by Xu mingxian Wu zhongchao,A brief history of time (illustration). Hunan Science and Technology Press, 2007.
Translated by Dr. geralder winberger and translated by Dong Jing,Introduction to systematic thinking (silver year commemorative edition). Tsinghua University Press, 2003.
Translated by geralard wingberger danela wingberger, Zhang Kai Wang Jia,General principles of system design. Tsinghua University Press, 2004.
Translated by Brooks, Wang Ying,Mythical man-month. Tsinghua University Press, 2002.
Translated by donald a. NORMAN, Fu qiufang Cheng,Emotional Design. Electronic Industry Press, 2005.
Jin Yong,Condor Heroes. 1976.

 

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.