Some views on Golang design pattern

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed. some views on Golang design pattern  


for C , C + + In terms of this, there are some problems with the design object .

1. The object is dead, only its own property, the behavior (function). There are no mechanisms that can be independently executed.

2. The object is alive, has its own properties, behaves (functions), and is independently executed (its own independent thread). However, due to system limitations, this number of objects cannot be too large (the number of threads cannot be too many).

3. objects are semi-viable, have their own attributes, behaviors, and do not have independent execution activities (without their own independent threads). Thread scheduling with other objects is required.

above is C , C + + some limitations of language. Other languages are not familiar and are not judged. But most of them are similar.

Then for Golang in terms of language, the object of design can be

The surviving, each object, has its own properties, has its own behavior, and has its own activity (through the process to achieve). In this way,Golang can implement a complete simulation of the object. Just like in our real world, individuals can maintain independence and autonomy.

So what is the connection between individuals, Golang language, you can use the Chan to achieve. Just like the existing social networks.

Golang is the simulation node, and the object in the Chan is the analog link connect letter. These are Some of the major features of Golang that are differentiated from other languages, so they are developed in Golang languages to better understand and realize our world.

Then with these mechanisms, for group intelligence, it can be a good simulation. 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 will emerge. To some extent, this is also a way of big data analysis.

Personally, I'm very optimistic . Golang language, and it is these things that make Golang language can be fundamentally different from other languages.

Hao Haohua

QQ 29185807

the years A Month the Day 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.