Daily Reflections

Before when I was learning to program, always program as the protagonist to learn programming, it's like when we learn architecture to architecture as the protagonist to learn the building, but the building itself, the purpose is to build houses for people to live, If we consider only the time to build the building itself is elegant architectural design, and trying hard to comply with the rules, regardless of the feelings of people using the building itself, this is not the cart before the horse yet, but this is the state of my previous order programming and programming, the programming did not consider the feelings of the protagonist data.

I now find that I know of programming knowledge, you can return to their roots to three reasons,
1: based on business constant data deformation processing, and then call the api platform-specific (such as web platform, app platform, desktop platform ), to achieve a corresponding function.
2: With the increased complexity and change, and the introduction of more than stupid cooperation projects, project code management problem itself
3: data monitoring system and mature and online debugging and automated testing

Since the above three factors, so we had a lot of different solutions.
For the first question: generating programming language, which in itself is a computer-based computing capabilities to achieve computation and deformation data
for the second question: had decoupled and other object-oriented mvc way to solve the problem of the division of labor cooperative multiplayer
for the third question: had a monitoring system and automated test program debugging scenarios

Here I do not look at the second and third questions, just from the perspective of data to relearn js

So if the programming language to understand from the perspective of data:
1: JS basic data types
  from the data perspective, number string boolean null undefined object, which is why the six data types? Instead of other data types, this is because if we want to use data abstraction reality of things, these six types is sufficient, number used to make the calculation, string used for display, bool used to make logical judgment, null is essential no representation, undefined that there is no definition of the meaning and object provides a more complex but very flexible way to describe things in the real world.

2: reserved words and js branch structure of
  the data itself is mobile, we can be compared to the data flow, the system is a river, the water flow from the mountains to the sea, there are different things that will itself this process, the water in the mountains is on the creek, but the sea is in the river, so this process from the stream into a river in a certain things must occur, making this change come true, but the premise is to realize what happens branch, because there the concept of a branch, thus giving rise to choose, things will appear. Branch represents is a result of the determination of certain conditions, because our system need to describe the process of change from the creek to the river, and Guantanamo we have to describe under what circumstances would become a river, this is a kind of what branch structure.

3: Scope
  previously used the metaphor rivers and streams, is now using an automated kitchen metaphor, a metaphor for the data we live pigs, then we have an automated kitchen, this kitchen is the function of a pig through the pipeline input, then output a plate ZhuTouRou, so we can certainly expect this will automate the kitchen there is a lot to process, every process each occupy a space, each space which has a corresponding appliance, so the appliance a process which is not B procedure calls inside the appliance, the appliance a space can only call a space inside the appliance, because the kitchen automation in the design of the a space has been set to do well, and tell what he needs to do a space while the a space needs to have all the instruments inserted into the a space, so we can say that a is a separate space scope, the program is also in this way, there will be scope, each function has its own scope, because this function is implemented inside a function, the input data in the specified format, the output means Data format. Become inside the scope of the purpose of isolation, and do not want to be inside the function variable external access to the reason for this is that, if all the other instruments can be accessed inside the space in automation engineering, will cause confusion you probably will not say, because although put together, but we set up ahead of him, let them call across space, but think about it, this is a kind of a scope not set itself ahead of it?

4: Memory model
  people real world is the reason why people, because there is the real world, also became the reason why there is data inside the data stored in memory is because of people standing on the land, so only the space foothold, in memory space so only to gain a foothold, but the memory and the real world there are differences, for individuals, perhaps the world is infinite (so perhaps not appropriate metaphor, because the population has a big explosion), so the individual can be unlimited the amount obtained from the real world, but the memory is limited, and if a program inside of an unlimited amount of data obtained from memory, it will lead to memory ringing off the hook, so we have to build a memory model (also called the method to measure the survival program of the world), to regulate the procedure for call memory, so there is a stack and heap in the process of running the program will continue to call the function and the release function, and it will continue into the scope and out of scope, every time into the new scopes We need to allocate memory to store the corresponding scope, just like in the real world every room Need to store the same land, but the land business for individuals is infinite we do not consider this issue, but for computers, memory is limited, if you do not consider saving memory, that memory will run out sooner or later, so the emergence of push and pop operations, allocate memory when the stack memory is freed when the stack, at the same time, the computer can not be expected to detail the scope of the internal operation, so he left specific to developers a way of escape, that is the developer's own can application memory, the essential meaning of this step is that developers can freely create their own piece of land set aside is used to store anything, which greatly increases the flexibility of developers, are zoned out is heap.

5: function and significance closure of
  the computer itself is mathematical calculations, appear long, long time in the computer before, had appeared in mathematics, is also found in the computer a long time ago, there have been a function, the function is a concept in mathematics, he said that a another variable corresponding relationship between variables and, if certain variables, in a certain way dependent on other variables, i.e. variables changes when these latter, in front of these variables as changes, we have referred to in front of the variable after the variable The function. So the function is essentially used to describe a change in the law, so it is very suitable for use in the program, because the program itself is the continuous processing of the data, for continuous deformation, we will extract the data change function according to the specified rules, then use function package, the benefits of doing so is generated when the same changes, we no need to write the code side, just call the function to achieve it,
  meaning that the closure of the program is running dynamically create a scope, because before creating a scope usually by building different rooms to achieve that is modular, which rely on a statement in advance of the luck, while the closure has achieved such a situation: there is a room, the room inside, in advance store some data, while developers can go in incoming data, and then after a meal inside crunching, you can achieve some kind of operation, depending on the closure: function we can achieve inert execution, curried, private property, these are private scope because of the presence of the closure.

6: this understanding of
  this point to call his final target, not to understand this sentence from the surface, if present memory model point of view, the metaphor for a function to store a bunch of data in a heap inside, this function Guantanamo on essentially the stack pointer, and ultimately who owns this pointer, who is the final point to the object of this function.

Guess you like

Origin www.cnblogs.com/mrzhu/p/12012991.html