First reading of Google's own language------go language and Dart language

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

The Go language is a new language, so far the first version of the official version has not been released. The Go language designers are Robert Griesemer, Rob Pike and Ken Thompson, who designed C and Unix, later in the Plan9 team. The go language design concept is very clear, is the dynamic type language programming ease and static type language security efficiency combined. For a deeper understanding of the history of the Go language and its complete goals, please refer to the Go language FAQ.


Go language has a very strong legacy of C, as far as possible to block the impact of C + + and Java, such as no independent OO system (not to say not oo), all with a struct-centric, no exceptions (Oh yes!), still have pointers, and so on. However, the go language draws on the essence of many new languages, with its own unique design. Like what

1. Retain but significantly simplify pointers

The go language retains the difference between the values in C and pointers, but it makes a lot of simplification for the cumbersome use of pointers, introducing the concept of references. So in the go language, you almost don't have to worry about getting all sorts of errors due to the direct manipulation of the inside inch.

2. Multi-parameter return

Remember in C in order to give back multiple parameters, have to open up a few pointers to the target function to let it operate it? This is completely unnecessary in go. and multi-parameter support allows go without the cumbersome exceptions system, a function can return the expected return value plus error, call the function immediately after processing the error message, clear.

3. Built-in basic data structures such as Array,slice,map

If you're used to simple list and dict operations in Python, you won't feel lonely in the go language. Everything is so familiar and more efficient. If you are a C + + programmer, you will find that you have found the STL vector and map of the friend.

4. Interface

The most impressive feature of the Go language is the interface design. Any data structure, as long as the implementation of interface defined functions, automatically implement the interface, there is no lengthy class declaration like Java, provides flexibility too much design and OO abstraction, so that your code is also very clean. Do not think you are accustomed to the Java kind of a implements way, feel OK, and other interface design more and more complex, countless bugs are waiting for you behind.

At the same time, because of this, the interface of the go language can be used to represent anything generic, such as an empty interface, can be a string can be an int, can be any data type, because these data types do not need to implement any function, Nature satisfies the definition of empty interface. In addition to the type assertion of the go language, you can provide duck typing features in general dynamic languages, while still capturing obvious errors in compile.

5. OO

The go language is not an object-oriented language in nature, it is still procedural. However, in the go language, you can easily do most of the things you can do in other OO languages with simpler and clearer logic. Yes, here, you don't need class, you can still inherit, you can still be polymorphic, but it's much faster. Because in essence, oo is a common struct operation in the go language.

6. Goroutine

It's almost a sign of the go language, and I don't want to mention it. If you don't know goroutine at all, then you just need to know that this thing is super lightweight like a thread, but through it, you don't need a complex threading operation, you don't need care scheduling, you can play basic parallel programs. In the go language, triggering a routine is as simple as Erlang spawn. Basically to master the Go language, the memory model with Goroutine and channel as the core must be understood. But please be assured that it is really very simple.

7. More modern features

and c comparison, go language is completely a modern language, native support Unicode, garbage collection, Closures (yes, and functional programming language similar), function is first class object, and so on.

Easy, simple, and fast adjectives are used to describe the features of the Go language. It can be said that this is not exaggerated, even the introduction of the Go language learning to improve, are more than the other language threshold too much less. In a time when most people have a C background, for the go language, from getting started to being able to get started, it's up to half a month. Go language gives a person's feeling is too direct, what all direct, read source code direct, write own code also direct.

Go must be the pros and cons, and many shortcomings are because the whole language is too new, immature, with the passage of time can be resolved, in contrast can endure. If you want to learn more about the pros and cons of the go language, you can refer to the following Yufeng written in this article, System programming language tomorrow star-go click here to download.

The go language has gradually begun to be received by people and is being used in development. The go language is Google's database for YouTube, and is used by a growing number of foreign companies (most startups) for back-end development, even in the celestial world, as well as cloud applications that are fully developed with Go language services. It can be said that with the upcoming launch of Go 1, the use of the go language should be more and more extensive.


Go language Getting Started Guide


A year ago, Google released Dart, a modern language, library, and tool dedicated to helping developers build complex web applications. A year from now, Google unveiled the Dart's Open source SDK, available at dartlang.org, which also includes the Dart editor and Dartium (native support for Dart's chromium build). In addition, DART itself has many improvements:

  • Faster Dart VMs, even faster than octane test V8
  • New Dart-to-javascript translator
  • An HTML library to work in a modern browser
  • Code libraries that can interoperate with JavaScript
  • A new, easier-to-use editor
  • New Package Manager Pub
  • Native support for Dart's chromium build Dartium
  • Server-side I/O Library
  • There are two ways in which Dart works: one on a local virtual machine and the other with the dart code in JavaScript, running directly on the JavaScript engine.
  • More detailed access to Dart's official introduction





Related Article

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.