Some views on the design pattern of Golang

Source: Internet
Author: User
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


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.