Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why Go?

 
Rogerio Kioshi
Ranch Hand
Posts: 690
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why should I use Go instead of any other language, like Java, Ruby, C#,... ?
 
Mark Summerfield
author
Ranch Hand
Posts: 37
Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rogerio,

Another way of putting your question is "What is the best programming language?". And unfortunately there is no definitive right answer to that.

As for Go, you should use it if it is the language which best suits your needs. IMO Go's particular strengths are (in no particular order):

  • code scalability thanks to a very nice packaging paradigm---and with very fast compilation even for very large programs
  • code scalability because Go doesn't support inheritance---this makes it much easier to (in effect) extend types without needing massive recompiles or worrying about messing up an inheritance tree
  • high-level support for concurrency that makes it easier to write and reason about concurrent programs
  • goroutines that are so lightweight that it is reasonable to have 1000s of them if that best fits the algorithm at hand
  • a clean lightweight syntax that avoids repetition
  • excellent Unicode support (far better than C++11 IMO)
  • zero intialization of every value that isn't explicitly initialized: this avoids uninitialized values errors and doesn't require programmers to remember arcane rules for when initialization takes place (e.g., C++)
  • a language that is small enough for average programmers to master (C++11 is so big and complicated that mastery requires a lot of time and guru-level coding)
  • no annoying and in concurrent programs very complex bookkeeping thanks to Go having a decent garbage collector
  • the best successor to C I've yet encountered
  • the best alternative to C++98/03 I know of---C++11 is just too big and complicated
  •  
    Palak Mathur
    Ranch Hand
    Posts: 342
    IntelliJ IDE Java Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    As per the Go's official FAQs, the reason that led to the thought to create a new language are:-

  • Computers are enormously quicker but software development is not faster.
  • Dependency management is a big part of software development today but the “header files” of languages in the C tradition are antithetical to clean dependency analysis—and fast compilation.
  • There is a growing rebellion against cumbersome type systems like those of Java and C++, pushing people towards dynamically typed languages such as Python and JavaScript.
  • Some fundamental concepts such as garbage collection and parallel computation are not well supported by popular systems languages.
  • The emergence of multicore computers has generated worry and confusion.


  • The advantages of a Go, again as mentioned in the Go's official FAQs are:-

  • It is possible to compile a large Go program in a few seconds on a single computer.
  • Go provides a model for software construction that makes dependency analysis easy and avoids much of the overhead of C-style include files and libraries.
  • Go's type system has no hierarchy, so no time is spent defining the relationships between types. Also, although Go has static types the language attempts to make types feel lighter weight than in typical OO languages.
  • Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
  • By its design, Go proposes an approach for the construction of system software on multicore machines.
  •  
    Walter Ho
    Greenhorn
    Posts: 22
    Chrome Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Mr. Summerfield, I have your "Programming in Python" book.
    Would you say that programming in Go is easier than Python?
    Which language would you prefer to program in?

    Mark Summerfield wrote:Hi Rogerio,

    Another way of putting your question is "What is the best programming language?". And unfortunately there is no definitive right answer to that.

    As for Go, you should use it if it is the language which best suits your needs. IMO Go's particular strengths are (in no particular order):

  • code scalability thanks to a very nice packaging paradigm---and with very fast compilation even for very large programs
  • code scalability because Go doesn't support inheritance---this makes it much easier to (in effect) extend types without needing massive recompiles or worrying about messing up an inheritance tree
  • high-level support for concurrency that makes it easier to write and reason about concurrent programs
  • goroutines that are so lightweight that it is reasonable to have 1000s of them if that best fits the algorithm at hand
  • a clean lightweight syntax that avoids repetition
  • excellent Unicode support (far better than C++11 IMO)
  • zero intialization of every value that isn't explicitly initialized: this avoids uninitialized values errors and doesn't require programmers to remember arcane rules for when initialization takes place (e.g., C++)
  • a language that is small enough for average programmers to master (C++11 is so big and complicated that mastery requires a lot of time and guru-level coding)
  • no annoying and in concurrent programs very complex bookkeeping thanks to Go having a decent garbage collector
  • the best successor to C I've yet encountered
  • the best alternative to C++98/03 I know of---C++11 is just too big and complicated
  •  
    Mark Summerfield
    author
    Ranch Hand
    Posts: 37
    Linux VI Editor Windows
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Walter,

    I think that Python is easier to learn from Go because Python completely insulates you from memory management. OTOH Go's low-level facilities such as pointers make it possible to create more memory efficient programs than Python. I think that Go is much easier to learn than C, C++, or Java because the Go language is much smaller and more consistent. (And despite Go being a small language it has a really good standard library with far more real-world packages, i.e., for cryptography, web data handling, etc., than C++ provides.)

    When starting a new project my default is to use Python 3. However, if speed, memory use, or concurrency are critical, Go is my choice.
     
    Walter Ho
    Greenhorn
    Posts: 22
    Chrome Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Very cool. Thanks so much. Big fan!

    Mark Summerfield wrote:Hi Walter,

    I think that Python is easier to learn from Go because Python completely insulates you from memory management. OTOH Go's low-level facilities such as pointers make it possible to create more memory efficient programs than Python. I think that Go is much easier to learn than C, C++, or Java because the Go language is much smaller and more consistent. (And despite Go being a small language it has a really good standard library with far more real-world packages, i.e., for cryptography, web data handling, etc., than C++ provides.)

    When starting a new project my default is to use Python 3. However, if speed, memory use, or concurrency are critical, Go is my choice.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic