Some views on the design pattern of Golang
For C, C + +, the object of design exist these several problems
1, the object is dead, only their own properties, behavior (function). There are no mechanisms that can be implemented independently
2, the object is alive, has its own attributes, behavior (functions), as well as independent execution of the activities (their own independent thread). However, due to system constraints, this number of objects can not be too much (the number of threads can not be too many).
3, the object is half alive, has its own attributes, behavior, no independent execution activities (no independent thread). Requires the use of thread scheduling by other objects.
These are the C, C + + language restrictions. Other languages are not familiar, not judged. But most of them are similar.
So for the Golang language, the object of design can be
Survival, each object, has its own attributes, has its own behavior, also has its own activities (through the process to achieve). So, Golang can realize the complete simulation of the object. As we are in the real world, individuals can remain independent and autonomous.
So the relationship between individuals, in the Golang language, can be achieved through Chan. Just like the existing social network.
The object in the Golang is the analog node, while Chan is the analog link letter. These are golang different from other languages of some of the major features, so the use of Golang language development, can better understand and realize our world.
So with these mechanisms, for swarm intelligence, it can be well simulated. Each individual's behavior is independent and the individual communicates through some information. When the number of individuals reaches a certain level, the group behavior emerges. To some extent, this is also a way of large data analysis.
I am very optimistic about Golang language, it is these things, so that Golang language and other languages have essential differences.
Hao Haohua
The Long Crescent Moon Road
QQ 29185807
December 15, 2014 09:07:52