SlideShare a Scribd company logo
Google’s Go
Introduction to the next “C” language!
S G Ganesh
Agenda
 Introduction to Go (What is “Go”?)
 “Hello world” in Go
 Examples for “getting a hang of” Go
 Examples using some novel features
 Implementation status
 Resources
 Let’s Go!
First things first: Setting the stage
 It’s not possible to cover all details of a new language in a
45-mins presentation
 We’ll quickly cover most important aspects of Go
 Can’t drink ocean in a day – let alone in an hour!
 No one is an “expert” in Go yet
 Creators of the language are the only experts right now
 I am an early adopter and got hooked-on to the
language
 I am making this presentation based on my experience
 For many questions, there are no right or wrong answers:
 Go is still an evolving language and answers might
change!
So, what’s all the buzz about?
 Go: new programming language announced by Google (Sep 09)
 Created lots of excitement in the programming community
 Many tout it as the next C language
 ‘C’ evolved from ‘B’; many languages are named as ‘D’, or
want to be the ‘D’ language
 But nothing has made the cut so far; “Go” might (or will it be
“Gone” in a few years ;-) )
 Is there substance behind hype?
 Yes, a lot! Most system programmers find it very good
 Go won Tiobe’s ‘language of the year award 2009’
 Tiobe is a programming language popularity index:
http://www.tiobe.com/
 Latest status (march 2010)

Recommended for you

Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang

The document provides an overview of the Go programming language. It discusses that Go was designed by Google to help solve their large-scale programming problems. It then summarizes Go's history, purpose, features, and syntax elements such as data types, operators, functions, concurrency using goroutines and channels. The document also provides examples of Go code and concludes that Go has emerged as a popular language for cloud infrastructure due to its simplicity, concurrency, and performance.

googlegogolang
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language

Go is a statically typed, compiled programming language designed for building simple, reliable, and efficient software. Some key points: - Go is natively compiled and uses static typing with type inference. It is targeted for system programming and server-side applications. - It was created at Google in 2007 to address issues with other languages like dependency management, garbage collection, and support for concurrency. - Popular users include Google, Docker, Dropbox, SoundCloud, and MongoDB. Domains it is used include distributed systems, cloud, web development, and systems programming. - Key features include built-in concurrency and networking support, a rich standard library, and fast compilation. It aims to be

golanggooglego
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective

My talk from Functional Vilnius MeetUp #6. http://www.functionalvilnius.lt/posts/2015-10-03-6th-meetup-announcement.html Golang is becoming more and more popular. Most likely many of you have heard of its upgraded garbage collector and possibilities to work with lightweight threads – goroutines. Obviously, Golang is quite a good choice for server-side software oriented on a huge load. As Scala backend developer, I am a big fan of functional programming and actor model. Golang seems very promising, but from the first glance, its a totally imperative language. In my speech I’m going to tell about my experiments with Golang and attempt to use it as a functional language.

Okay, so what’s Go?
 Go is a new, experimental, concurrent, garbage-collected,
systems-programming language.
 New & Experimental: Go is still at experimental stage
 with tools, packages etc. still in development.
 No production system implemented using Go till now
 Concurrent: Supports 'communication channels’ for
concurrency - Communicating Sequential Processes (CSP).
 Garbage-collected: The memory is automatically garbage
collected
 For systems-programming: Intended for writing things like
compilers, web servers…

Still, we can use it as a general purpose language.
Who’s behind Go?
 Robert Griesemer, Ken Thompson (of Unix
fame), and Rob Pike are the creators of the
language.
 All three are well-known in programming community
 This is how things fell in place:
 Go project was started around May 2007. Ken Thompson
wrote a Go compiler and runtime from scratch.
 By mid of 2008, working compiler and runtime was ready.
 Ian Lance Taylor and Russ Cox joined Go team in 2008. Ian
Taylor implemented GCC front-end for Go.
Why a new language?
 This description is as given by the creators
 No major sys. programming language came-up in last
decade. But much has changed during the last decade(s)
 Libraries becoming bigger with lots of dependencies
 Internet and networking is becoming pervasive
 Client/server systems, massive clusters used today
 Multi-core processors becoming mainstream.
 Systems programming languages were not designed with
these in mind.
 Other reasons
 construction (enterprise software) has become very slow
 OOP using inheritance hierarchies not effective
Goals of the language
 Efficiency and ease of use:
 Efficiency of C, but ease like Ruby.
 Performance: within 10%-20% of equivalent C
 Safe to use:
 Both type-safe as well as memory-safe.
 Concurrency:
 Good support for concurrency and communication
 Garbage Collected:
 "Attempts" to build an efficient, and latency-free Garbage
Collection mechanism.
 High-speed builds:
 Fast compilation & linking

Recommended for you

Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang

Introduction to GoLang by Amal Mohan N. This presentation is an introduction to GoLang - it's history, features, syntax, importance etc. concurrency, go-routines, golang, google, gopher, introduction, programming

concurrencygo-routinesgolang
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation

Go is a compiled, concurrent, garbage-collected, statically typed language developed at Google in 2007 to address issues with large software systems. It was created to facilitate easy memory management, enable rapid compilation, and handle concurrency through built-in goroutines and channels. Many large companies now use Go for its improved developer productivity compared to other languages.

golangprogramminglanguage
Go Lang
Go LangGo Lang
Go Lang

Go is a compiled, garbage-collected programming language that supports concurrent programming through lightweight threads called goroutines and communication between goroutines via channels. It aims to provide both high-level and low-level programming with a clean syntax and minimal features. The document discusses Go's concurrency model, syntax, goroutines, channels, and use cases including cloud infrastructure, mobile development, and audio synthesis.

concurrentgo langgoogle go
Some important capabilities of Go
 Simplicity: GO has a clean and concise syntax
 Characteristic of Google products
 For example, light-weight type system
 Use it to believe it
 Separation of interface and the implementation
 I know it’s often misused statement, but Go has it!
 Arguably a novel feature of Go
 Goroutines
 Is based on CSP: much safer than lock-based, like Java
 And more:
 E.g. Reflection (yes! but this is systems prog. lang!)
Enough theory, lets see examples!
 All programs in Go should be in a package, its “main”
here
 We import “fmt” package for using Printf function
 Execution starts with ‘main.main()’ function
 Functions have “func” keyword
 Printf is in fmt package
Now we’ll find factorial of a number
 Lack of declarations
 “fact” and “i” inferred as “ints” from init value 1 because of :=
 “for” loop is the only loop construct supported in Go
 Others like “while” are variations of “for”
 An example of minimal features
 Note the lack of semi-colons
 Have to use only if “necessary”
Looks like C, but not C!
 Go has elegant declaration syntax
 See how arguments are passed and returned
 Not like C: it is infamous for its declaration syntax
 Can return multiple values from functions
 See swap for similar functionality in = operator
 Example for “orthogonal” language features

Recommended for you

Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang

This document summarizes some key features and benefits of the Go programming language. It discusses Go's support for concurrency with lightweight goroutines and channels for communication between goroutines. It also covers Go's syntax which is similar to C but with memory safety due to garbage collection, and its standard library and tools. Finally it provides an example of Go's use at a large company for building high throughput low latency network services.

golanggogoogle developer group
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...

Go is presented as an alternative to C and C++ for system programming, distributed systems, and cloud workloads. It has performance characteristics of C/C++ but also flexibility of modern languages. Go is well-suited for web development with various frameworks and is supported on cloud platforms like Google Cloud and AWS. The document argues that Go will emerge as a strong alternative to C/C++ in these areas.

distributed systemsgooglesystems programming
Ready, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageReady, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming language

A brief primer on Go - it's origins, its features, and why you may want to use it in your next software project

golang go software programming
Built-in support for features like maps
 Maps are built-in, so no need to import
 Initialized with pair separated by “:”
 “range” keyword is useful for traversal
 Using a for loop
 Works for slices, strings etc. (“orthogonal” feature)
Functions as first class objects
 Functions are first
class objects in Go
 We can have
“function literals”
(similar to
“closures” in
functional
languages) for
example
Structures
 Structs are declared with type keyword
 We can have struct literals
 Created in heap
 And print struct members using %v in Printf
Methods
 Methods are implemented by specifying the struct
name before the method name

Recommended for you

Coding with golang
Coding with golangCoding with golang
Coding with golang

Join us to learn the basics of Go, a Google created language with strong concurrent features, and build a Discord bot!

golanggoogleprogramming
Golang
GolangGolang
Golang

GoLang is an open source programming language created by Google in 2009. It has a large community and was designed for scalability and concurrency. Some key features include being statically typed, compiled, and having built-in support for concurrency through goroutines and channels. Google uses GoLang extensively to build systems that scale to thousands of machines.

golanggo language
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction

Go is a statically-typed, compiled programming language developed by Google. It aims for fast build times and single binary deployments. Go emphasizes concurrency through lightweight goroutines and channels for communication between them. While it lacks some object-oriented features like inheritance, it provides built-in support for concurrency and parallelism which makes it well-suited for backend services, network applications, and processing large amounts of data.

technologyengineeringgoogle
Interfaces: A novel feature
 Interfaces specified with
‘interface’ keyword
 Not same as in C#/Java
 The structs doesn’t have to
say it implements an
interface
 Any struct that implements
the methods as specified
by any interface satisfies
that interface
 Strict static type checking &
“duck typing”!
Goroutines: easy & safe multithreading
 Goroutines are functions executing in parallel
 in the same address space in stack
 They communicate using “channels” (based on CSP)
 Cleaner, simpler and less-bug prone than using locks
 This shows an example* of how a Sort on big list can be done in
parallel with some other computation
We haven’t covered a lot!
 Important features not covered because of limited time
 reflection, embedding structs (aka inheritance), package
construction etc.
 Lots of libraries already implemented
 math, crypto, networking, regex, OS, testing, html gen….
 Garbage collection & Go runtime capabilities
 Currently mark-and-sweep collector, but better ones under
construction
 Small runtime: GC, channels, stack allocation, goroutines
etc.
Implementation status
 Currently compiler tool-chain available for Mac & Linux
 No “official” windows port; “unofficial” old ports exist
 Compilers: GCC implementation and a stand-alone implementation
 You can download the compilers/tools from this website & try it
 It’s open source (BSD license): We can contribute!
 Lots of work going on in libraries and improving the existing
tool chain
 Frequent builds & releases, quick response times etc.
 Many features & tools still lacking in Go
 For example, generics and debugger tool

Recommended for you

Golang
GolangGolang
Golang

Go is an open source programming language designed by Google to be concurrent, garbage collected, and efficient. It has a simple syntax and is used by Google and others to build large distributed systems. Key features include garbage collection, concurrency with goroutines and channels, interfaces without inheritance, and a large standard library.

googlegolanggo
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language

This document introduces the Go programming language, which was announced by Google in 2009. It summarizes Go's key features, including being a concurrent, garbage-collected systems programming language. It also provides instructions on installing Go and a simple "Hello World" program example. The document argues that Go has substantial features for systems programming in today's networked, multi-core world.

programming languagesprogramminggoogle
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go

This document discusses the Go programming language and why it has become popular. It notes that Go is an optional language released in 2012 that does not force developers to use it for certain applications like Java does for Android. The document states that the one main reason Go has become popular is that "It just works" - Go makes development simpler by handling things like concurrency and deployment automatically while still exposing lower-level functionality. It recommends using Go for distributed systems, portable command line tools, and situations where team productivity is important.

programmingapigolang
Resources
 Go websites:
 Official: www.golang.org (web server implemented in Go!)
 Unofficial: http://go-lang.cat-v.org/
 Want to learn Go?
 No “books” yet
 Read "Effective Go” (http://golang.org/doc/effective_go.html)
 tutorials available online
 Tech talk (http://www.youtube.com/watch?v=rKnDgT73v8s)
 Join go-nuts mailing list gonuts@googlegroups.com
 You can try (compile & run) Go programs online!
 This is really useful: http://ideone.com/
Q & A time
So what are you waiting for?
 Lets Go!

More Related Content

What's hot

Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
ShubhamMishra485
 
Go lang
Go langGo lang
Golang
GolangGolang
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
Basil N G
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective
Sveta Bozhko
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
Amal Mohan N
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
Gh-Mohammed Eldadah
 
Go Lang
Go LangGo Lang
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
Kartik Sura
 
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Aniruddha Chakrabarti
 
Ready, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageReady, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming language
RTigger
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
HannahMoss14
 
Golang
GolangGolang
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
Spandana Govindgari
 
Golang
GolangGolang
Golang
Felipe Mamud
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
Ganesh Samarthyam
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
Oliver N
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with Golang
Takaaki Mizuno
 

What's hot (19)

Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Go lang
Go langGo lang
Go lang
 
Golang
GolangGolang
Golang
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Golang from Scala developer’s perspective
Golang from Scala developer’s perspectiveGolang from Scala developer’s perspective
Golang from Scala developer’s perspective
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
 
Go Lang
Go LangGo Lang
Go Lang
 
Wonders of Golang
Wonders of GolangWonders of Golang
Wonders of Golang
 
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
 
Ready, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming languageReady, set, go! An introduction to the Go programming language
Ready, set, go! An introduction to the Go programming language
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
 
Golang
GolangGolang
Golang
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Golang
GolangGolang
Golang
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
Golang #5: To Go or not to Go
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
 
Building Command Line Tools with Golang
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with Golang
 

Similar to A First Look at Google's Go Programming Language

Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
Ganesh Samarthyam
 
Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
Equaleyes Solutions Ltd.
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
Simon Hewitt
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
Vimlesh Sharma
 
C c#
C c#C c#
C c#
Sireesh K
 
difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
Sireesh K
 
The Ring programming language version 1.10 book - Part 99 of 212
The Ring programming language version 1.10 book - Part 99 of 212The Ring programming language version 1.10 book - Part 99 of 212
The Ring programming language version 1.10 book - Part 99 of 212
Mahmoud Samir Fayed
 
Go programing language
Go programing languageGo programing language
Go programing language
Ramakrishna kapa
 
The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84
Mahmoud Samir Fayed
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
Imesh Gunaratne
 
The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
Mahmoud Samir Fayed
 
Go Within Cloud Foundry
Go Within Cloud FoundryGo Within Cloud Foundry
Go Within Cloud Foundry
Platform CF
 
Google GO
Google GOGoogle GO
Google GO
Ajay Gahlot
 
The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189
Mahmoud Samir Fayed
 
Golang : A Hype or the Future?
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
Mindfire LLC
 
Advantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworksAdvantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworks
Katy Slemon
 
Golang
GolangGolang
Golang
Saray Chak
 
Beyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in ProductionBeyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in Production
C4Media
 
The Ring programming language version 1.3 book - Part 81 of 88
The Ring programming language version 1.3 book - Part 81 of 88The Ring programming language version 1.3 book - Part 81 of 88
The Ring programming language version 1.3 book - Part 81 of 88
Mahmoud Samir Fayed
 
Golang, Future of Programming Language.
Golang, Future of Programming Language.Golang, Future of Programming Language.
Golang, Future of Programming Language.
Sunil Yadav
 

Similar to A First Look at Google's Go Programming Language (20)

Let's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming LanguageLet's Go: Introduction to Google's Go Programming Language
Let's Go: Introduction to Google's Go Programming Language
 
Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
 
Introduction to Go
Introduction to GoIntroduction to Go
Introduction to Go
 
Scaling applications with go
Scaling applications with goScaling applications with go
Scaling applications with go
 
C c#
C c#C c#
C c#
 
difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
 
The Ring programming language version 1.10 book - Part 99 of 212
The Ring programming language version 1.10 book - Part 99 of 212The Ring programming language version 1.10 book - Part 99 of 212
The Ring programming language version 1.10 book - Part 99 of 212
 
Go programing language
Go programing languageGo programing language
Go programing language
 
The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84The Ring programming language version 1.2 book - Part 4 of 84
The Ring programming language version 1.2 book - Part 4 of 84
 
An Introduction to Go
An Introduction to GoAn Introduction to Go
An Introduction to Go
 
The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180The Ring programming language version 1.5.1 book - Part 4 of 180
The Ring programming language version 1.5.1 book - Part 4 of 180
 
Go Within Cloud Foundry
Go Within Cloud FoundryGo Within Cloud Foundry
Go Within Cloud Foundry
 
Google GO
Google GOGoogle GO
Google GO
 
The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189The Ring programming language version 1.6 book - Part 6 of 189
The Ring programming language version 1.6 book - Part 6 of 189
 
Golang : A Hype or the Future?
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
 
Advantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworksAdvantages of golang development services & 10 most used go frameworks
Advantages of golang development services & 10 most used go frameworks
 
Golang
GolangGolang
Golang
 
Beyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in ProductionBeyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in Production
 
The Ring programming language version 1.3 book - Part 81 of 88
The Ring programming language version 1.3 book - Part 81 of 88The Ring programming language version 1.3 book - Part 81 of 88
The Ring programming language version 1.3 book - Part 81 of 88
 
Golang, Future of Programming Language.
Golang, Future of Programming Language.Golang, Future of Programming Language.
Golang, Future of Programming Language.
 

More from Ganesh Samarthyam

Wonders of the Sea
Wonders of the SeaWonders of the Sea
Wonders of the Sea
Ganesh Samarthyam
 
Animals - for kids
Animals - for kids Animals - for kids
Animals - for kids
Ganesh Samarthyam
 
Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in Practice
Ganesh Samarthyam
 
CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”
Ganesh Samarthyam
 
Great Coding Skills Aren't Enough
Great Coding Skills Aren't EnoughGreat Coding Skills Aren't Enough
Great Coding Skills Aren't Enough
Ganesh Samarthyam
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
Ganesh Samarthyam
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean Code
Ganesh Samarthyam
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
Ganesh Samarthyam
 
Bangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief PresentationBangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief Presentation
Ganesh Samarthyam
 
Bangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - PosterBangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - Poster
Ganesh Samarthyam
 
Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)
Ganesh Samarthyam
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
Ganesh Samarthyam
 
Bangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship DeckBangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship Deck
Ganesh Samarthyam
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
Ganesh Samarthyam
 
Java Generics - Quiz Questions
Java Generics - Quiz QuestionsJava Generics - Quiz Questions
Java Generics - Quiz Questions
Ganesh Samarthyam
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
Ganesh Samarthyam
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
Ganesh Samarthyam
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
Ganesh Samarthyam
 
Core Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quizCore Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quiz
Ganesh Samarthyam
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 

More from Ganesh Samarthyam (20)

Wonders of the Sea
Wonders of the SeaWonders of the Sea
Wonders of the Sea
 
Animals - for kids
Animals - for kids Animals - for kids
Animals - for kids
 
Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in Practice
 
CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”CFP - 1st Workshop on “AI Meets Blockchain”
CFP - 1st Workshop on “AI Meets Blockchain”
 
Great Coding Skills Aren't Enough
Great Coding Skills Aren't EnoughGreat Coding Skills Aren't Enough
Great Coding Skills Aren't Enough
 
College Project - Java Disassembler - Description
College Project - Java Disassembler - DescriptionCollege Project - Java Disassembler - Description
College Project - Java Disassembler - Description
 
Coding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean CodeCoding Guidelines - Crafting Clean Code
Coding Guidelines - Crafting Clean Code
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
 
Bangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief PresentationBangalore Container Conference 2017 - Brief Presentation
Bangalore Container Conference 2017 - Brief Presentation
 
Bangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - PosterBangalore Container Conference 2017 - Poster
Bangalore Container Conference 2017 - Poster
 
Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)Software Design in Practice (with Java examples)
Software Design in Practice (with Java examples)
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
Bangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship DeckBangalore Container Conference 2017 - Sponsorship Deck
Bangalore Container Conference 2017 - Sponsorship Deck
 
Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
 
Java Generics - Quiz Questions
Java Generics - Quiz QuestionsJava Generics - Quiz Questions
Java Generics - Quiz Questions
 
Java Generics - by Example
Java Generics - by ExampleJava Generics - by Example
Java Generics - by Example
 
Software Architecture - Quiz Questions
Software Architecture - Quiz QuestionsSoftware Architecture - Quiz Questions
Software Architecture - Quiz Questions
 
Docker by Example - Quiz
Docker by Example - QuizDocker by Example - Quiz
Docker by Example - Quiz
 
Core Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quizCore Java: Best practices and bytecodes quiz
Core Java: Best practices and bytecodes quiz
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 

Recently uploaded

MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
Mitchell Marsh
 
NBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial CompanyNBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial Company
NBFC Softwares
 
introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...
sachin chaurasia
 
What is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for FreeWhat is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for Free
TwisterTools
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
sheqnetworkmarketing
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
AUGNYC
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
Roshan Dwivedi
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
Ortus Solutions, Corp
 
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple StepsSeamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Estuary Flow
 
dachnug51 - Whats new in domino 14 .pdf
dachnug51 - Whats new in domino 14  .pdfdachnug51 - Whats new in domino 14  .pdf
dachnug51 - Whats new in domino 14 .pdf
DNUG e.V.
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
shivamt017
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
sofiafernandezon
 
Break data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud ConnectorsBreak data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud Connectors
confluent
 
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
bhatinidhi2001
 
How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
Ortus Solutions, Corp
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
sachin chaurasia
 
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdfAWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
karim wahed
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
VishrutGoyani1
 
WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
Severalnines
 
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
Hironori Washizaki
 

Recently uploaded (20)

MVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptxMVP Mobile Application - Codearrest.pptx
MVP Mobile Application - Codearrest.pptx
 
NBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial CompanyNBFC Software: Optimize Your Non-Banking Financial Company
NBFC Software: Optimize Your Non-Banking Financial Company
 
introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...introduction of Ansys software and basic and advance knowledge of modelling s...
introduction of Ansys software and basic and advance knowledge of modelling s...
 
What is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for FreeWhat is OCR Technology and How to Extract Text from Any Image for Free
What is OCR Technology and How to Extract Text from Any Image for Free
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
 
NYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdfNYC 26-Jun-2024 Combined Presentations.pdf
NYC 26-Jun-2024 Combined Presentations.pdf
 
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
FAST Channels: Explosive Growth Forecast 2024-2027 (Buckle Up!)
 
Intro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AIIntro to Amazon Web Services (AWS) and Gen AI
Intro to Amazon Web Services (AWS) and Gen AI
 
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple StepsSeamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
Seamless PostgreSQL to Snowflake Data Transfer in 8 Simple Steps
 
dachnug51 - Whats new in domino 14 .pdf
dachnug51 - Whats new in domino 14  .pdfdachnug51 - Whats new in domino 14  .pdf
dachnug51 - Whats new in domino 14 .pdf
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
 
Break data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud ConnectorsBreak data silos with real-time connectivity using Confluent Cloud Connectors
Break data silos with real-time connectivity using Confluent Cloud Connectors
 
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.CViewSurvey Digitech Pvt Ltd that  works on a proven C.A.A.G. model.
CViewSurvey Digitech Pvt Ltd that works on a proven C.A.A.G. model.
 
How we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hoursHow we built TryBoxLang in under 48 hours
How we built TryBoxLang in under 48 hours
 
ANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdfANSYS Mechanical APDL Introductory Tutorials.pdf
ANSYS Mechanical APDL Introductory Tutorials.pdf
 
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdfAWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
AWS Cloud Practitioner Essentials (Second Edition) (Arabic) AWS Security .pdf
 
Google ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learningGoogle ML-Kit - Understanding on-device machine learning
Google ML-Kit - Understanding on-device machine learning
 
WEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service ProvidersWEBINAR SLIDES: CCX for Cloud Service Providers
WEBINAR SLIDES: CCX for Cloud Service Providers
 
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
 

A First Look at Google's Go Programming Language

  • 1. Google’s Go Introduction to the next “C” language! S G Ganesh
  • 2. Agenda  Introduction to Go (What is “Go”?)  “Hello world” in Go  Examples for “getting a hang of” Go  Examples using some novel features  Implementation status  Resources  Let’s Go!
  • 3. First things first: Setting the stage  It’s not possible to cover all details of a new language in a 45-mins presentation  We’ll quickly cover most important aspects of Go  Can’t drink ocean in a day – let alone in an hour!  No one is an “expert” in Go yet  Creators of the language are the only experts right now  I am an early adopter and got hooked-on to the language  I am making this presentation based on my experience  For many questions, there are no right or wrong answers:  Go is still an evolving language and answers might change!
  • 4. So, what’s all the buzz about?  Go: new programming language announced by Google (Sep 09)  Created lots of excitement in the programming community  Many tout it as the next C language  ‘C’ evolved from ‘B’; many languages are named as ‘D’, or want to be the ‘D’ language  But nothing has made the cut so far; “Go” might (or will it be “Gone” in a few years ;-) )  Is there substance behind hype?  Yes, a lot! Most system programmers find it very good  Go won Tiobe’s ‘language of the year award 2009’  Tiobe is a programming language popularity index: http://www.tiobe.com/  Latest status (march 2010)
  • 5. Okay, so what’s Go?  Go is a new, experimental, concurrent, garbage-collected, systems-programming language.  New & Experimental: Go is still at experimental stage  with tools, packages etc. still in development.  No production system implemented using Go till now  Concurrent: Supports 'communication channels’ for concurrency - Communicating Sequential Processes (CSP).  Garbage-collected: The memory is automatically garbage collected  For systems-programming: Intended for writing things like compilers, web servers…  Still, we can use it as a general purpose language.
  • 6. Who’s behind Go?  Robert Griesemer, Ken Thompson (of Unix fame), and Rob Pike are the creators of the language.  All three are well-known in programming community  This is how things fell in place:  Go project was started around May 2007. Ken Thompson wrote a Go compiler and runtime from scratch.  By mid of 2008, working compiler and runtime was ready.  Ian Lance Taylor and Russ Cox joined Go team in 2008. Ian Taylor implemented GCC front-end for Go.
  • 7. Why a new language?  This description is as given by the creators  No major sys. programming language came-up in last decade. But much has changed during the last decade(s)  Libraries becoming bigger with lots of dependencies  Internet and networking is becoming pervasive  Client/server systems, massive clusters used today  Multi-core processors becoming mainstream.  Systems programming languages were not designed with these in mind.  Other reasons  construction (enterprise software) has become very slow  OOP using inheritance hierarchies not effective
  • 8. Goals of the language  Efficiency and ease of use:  Efficiency of C, but ease like Ruby.  Performance: within 10%-20% of equivalent C  Safe to use:  Both type-safe as well as memory-safe.  Concurrency:  Good support for concurrency and communication  Garbage Collected:  "Attempts" to build an efficient, and latency-free Garbage Collection mechanism.  High-speed builds:  Fast compilation & linking
  • 9. Some important capabilities of Go  Simplicity: GO has a clean and concise syntax  Characteristic of Google products  For example, light-weight type system  Use it to believe it  Separation of interface and the implementation  I know it’s often misused statement, but Go has it!  Arguably a novel feature of Go  Goroutines  Is based on CSP: much safer than lock-based, like Java  And more:  E.g. Reflection (yes! but this is systems prog. lang!)
  • 10. Enough theory, lets see examples!  All programs in Go should be in a package, its “main” here  We import “fmt” package for using Printf function  Execution starts with ‘main.main()’ function  Functions have “func” keyword  Printf is in fmt package
  • 11. Now we’ll find factorial of a number  Lack of declarations  “fact” and “i” inferred as “ints” from init value 1 because of :=  “for” loop is the only loop construct supported in Go  Others like “while” are variations of “for”  An example of minimal features  Note the lack of semi-colons  Have to use only if “necessary”
  • 12. Looks like C, but not C!  Go has elegant declaration syntax  See how arguments are passed and returned  Not like C: it is infamous for its declaration syntax  Can return multiple values from functions  See swap for similar functionality in = operator  Example for “orthogonal” language features
  • 13. Built-in support for features like maps  Maps are built-in, so no need to import  Initialized with pair separated by “:”  “range” keyword is useful for traversal  Using a for loop  Works for slices, strings etc. (“orthogonal” feature)
  • 14. Functions as first class objects  Functions are first class objects in Go  We can have “function literals” (similar to “closures” in functional languages) for example
  • 15. Structures  Structs are declared with type keyword  We can have struct literals  Created in heap  And print struct members using %v in Printf
  • 16. Methods  Methods are implemented by specifying the struct name before the method name
  • 17. Interfaces: A novel feature  Interfaces specified with ‘interface’ keyword  Not same as in C#/Java  The structs doesn’t have to say it implements an interface  Any struct that implements the methods as specified by any interface satisfies that interface  Strict static type checking & “duck typing”!
  • 18. Goroutines: easy & safe multithreading  Goroutines are functions executing in parallel  in the same address space in stack  They communicate using “channels” (based on CSP)  Cleaner, simpler and less-bug prone than using locks  This shows an example* of how a Sort on big list can be done in parallel with some other computation
  • 19. We haven’t covered a lot!  Important features not covered because of limited time  reflection, embedding structs (aka inheritance), package construction etc.  Lots of libraries already implemented  math, crypto, networking, regex, OS, testing, html gen….  Garbage collection & Go runtime capabilities  Currently mark-and-sweep collector, but better ones under construction  Small runtime: GC, channels, stack allocation, goroutines etc.
  • 20. Implementation status  Currently compiler tool-chain available for Mac & Linux  No “official” windows port; “unofficial” old ports exist  Compilers: GCC implementation and a stand-alone implementation  You can download the compilers/tools from this website & try it  It’s open source (BSD license): We can contribute!  Lots of work going on in libraries and improving the existing tool chain  Frequent builds & releases, quick response times etc.  Many features & tools still lacking in Go  For example, generics and debugger tool
  • 21. Resources  Go websites:  Official: www.golang.org (web server implemented in Go!)  Unofficial: http://go-lang.cat-v.org/  Want to learn Go?  No “books” yet  Read "Effective Go” (http://golang.org/doc/effective_go.html)  tutorials available online  Tech talk (http://www.youtube.com/watch?v=rKnDgT73v8s)  Join go-nuts mailing list gonuts@googlegroups.com  You can try (compile & run) Go programs online!  This is really useful: http://ideone.com/
  • 22. Q & A time
  • 23. So what are you waiting for?  Lets Go!