What are the prerequisites for learning Go?

10,084 views
Skip to first unread message

Aahan Krish

unread,
Apr 3, 2012, 10:47:46 AM4/3/12
to golan...@googlegroups.com
Hello,

I am completely new to programming, so new that all I know is bits and pieces of HTML and CSS. So, my mind is completely ready to get adopted to a programming language.

Here's the thing -- I should probably learn JavaScript (or Dart) next, but that's front-end programming, so lets set that aside.

1) Since 'Go Lang' is actually meant to replace C/C++ and Java, and also belongs to the same family, should I learnt it only after learning something simple like Python? or is it a not-too-complex language that I can get started right away?

2) What's Go meant to be used for? Is it meant for doing only low-level stuff (I don't know how to define it, but I guess you can understand), or can it be used for any general purpose like Python or Ruby?

PS: I did check the FAQ, and also searched this groups archive. I couldn't find my answer. I hope for the community to provide me (and thereby anyone with similar questions) with some good advise / input, so that I/we can get started in the right direction.

best,
Aahan

Andrew Gerrand

unread,
Apr 3, 2012, 5:43:15 PM4/3/12
to Aahan Krish, golan...@googlegroups.com
Go is a general purpose language; it may be used for almost anything. It sounds like you are a web developer. I think you will find Go very well-suited to writing web back end servers. 

You should learn Go. It is a clean language with good documentation, a rich set of standard packages (for writing web servers and other things) and a helpful community. 

I would argue that Go is simpler than Python in almost every way. Python may be more forgiving to a novice programmer, as it lets you write pretty shaky code that still runs, but I don't see that as a virtue. It's nice to have a compiler to catch your (many and frequent) mistakes. 

Cheers,
Andrew

Kyle Finley

unread,
Apr 3, 2012, 6:05:43 PM4/3/12
to golan...@googlegroups.com
Aahan,
 
1) Since 'Go Lang' is actually meant to replace C/C++ and Java, and also belongs to the same family, should I learnt it only after learning something simple like Python? or is it a not-too-complex language that I can get started right away?

Start right away. I believe that you're actually at an advantage if you have not yet learned other languages.
 
2) What's Go meant to be used for? Is it meant for doing only low-level stuff (I don't know how to define it, but I guess you can understand), or can it be used for any general purpose like Python or Ruby?

The great thing about Go is that it can do both.

I recommend that you read through this book:


I just discovered it over the weekend. It's the best beginners guide to Go that I've seen. Maybe there should be a link to this on the Go home/reference page.


- Kyle

 

Hotei

unread,
Apr 3, 2012, 7:10:38 PM4/3/12
to golan...@googlegroups.com
I think go is an excellent first language choice.  Better than Python in many ways, and arguably simpler as well.  You don't have to use all the bells and whistles right away and you can still write useful things.  And as you get more experience you'll find the go standard library has a treasure-trove of useful code.

Bolang

unread,
Apr 3, 2012, 7:36:54 PM4/3/12
to golang-nuts
On 04/04/2012 05:05 AM, Kyle Finley wrote:
>
>
> The great thing about Go is that it can do both.
>
> I recommend that you read through this book:
>
> http://go-book.appspot.com/

Adding another question,
Can someone point to design patterns (or algorithm) that commonly used
in Go.
I can successfully rewrite my python socket code to Go.
But i'm still not happy with my program design, it feels not clean,
although it is simpler than the python one.

Kyle Lemons

unread,
Apr 3, 2012, 7:44:14 PM4/3/12
to Bolang, golang-nuts
On Tue, Apr 3, 2012 at 4:36 PM, Bolang <boo....@gmail.com> wrote:
On 04/04/2012 05:05 AM, Kyle Finley wrote:


The great thing about Go is that it can do both.

I recommend that you read through this book:

http://go-book.appspot.com/

Adding another question,
Can someone point to design patterns (or algorithm) that commonly used in Go.
I can successfully rewrite my python socket code to Go.
But i'm still not happy with my program design, it feels not clean,
although it is simpler than the python one.

Design patterns tend to be anti-patterns in Go, at least design patterns in the usual sense.  You can implement many of them, and doing so might be an interesting exercise, but you wouldn't want to use that in an actual project because you would most likely lose the clarity and flexibility that the language offers you.

Yves Junqueira

unread,
Apr 3, 2012, 8:00:32 PM4/3/12
to Aahan Krish, golan...@googlegroups.com

Hi Aahan. I just wanted to an additional perspective.

Go is a great language for learning how to program. Just be aware that certain concepts may be hard to comprehend at first (pointers, for example), but don't let yourself be discouraged: it's going to be worth it!

Since you asked specifically about prerequisites, I strongly recommend that you familiarize yourself with the fundamentals of Computer Science if you didn't already. No book about programming will fill that gap. Luckily there are many online resources available these days, including free courses from Stanford (Coursera), Udacity, MIT, etc, and easy to read books. That said, you can study CS in parallel to learning how to write programs.

For that I suggest that you start by reading a book about Go, and maybe stay away from the official Go documentation for a little bit, because it usually doesn't explain the fundamentals and it assumes that the reader is an experienced programmer already (there's nothing wrong with this).

Besides the online free book already mentioned in this thread, there is a more complete book in English called The Way To Go. You should have a look at that. Other books have been published or are about to.

The various videos and tutorials about writing a web application in AppEngine are very nice, so you could try those after you've learned the basics.

Anyway, it would be cool if you keep us posted about your progress about learning Go as your first programming language. We are all interested in improving the documentation and resources available for new programmers, and we know there is a lot to improve, but any feedback or suggestions you might have would be greatly appreciated: tell us what worked well for you and what didn't.

Good luck.
- Yves

Aahan Krish

unread,
Apr 3, 2012, 8:09:54 PM4/3/12
to golan...@googlegroups.com
Yves, I will definitely do that. There's one question though -- when I read about 'Go' it was always said that it has very few libraries compared to other languages, for example, say Python. Yeah sure, because it's a  new programming language.

But at some point, I'll probably need a library that doesn't exist for Go -- where porting is probably the quickest way of doing so. So, the question is, don't you really think I should learn PHP or Python or some other more mature language (by age) that has a number of libraries, first?

Aahan Krish

unread,
Apr 3, 2012, 8:16:52 PM4/3/12
to golan...@googlegroups.com
Andrew, Bo and Hotei: Thanks a lot for your input and advise. I am glad that I got some good advise.

Kyle: Thanks for the book! I also found another in some other thread in this group: "Learning Go" by Miek Gieben

Again, thanks to all! Your advise means a lot.

best,
Aahan

Sameer Ajmani

unread,
Apr 3, 2012, 8:18:05 PM4/3/12
to Bolang, golang-nuts

The "Effective Go" tutorial will help you learn how to write clean, idiomatic Go code. It discusses how to use most Go language features, like interfaces and concurrency primitives, and covers style points like naming conventions and how to document your code.

John Barham

unread,
Apr 4, 2012, 12:32:35 AM4/4/12
to Aahan Krish, golan...@googlegroups.com

As a programmer who's been using Python for over a decade, and Go
since it was publicly released, IMO the Go standard library is very
comprehensive, much more comprehensive than the relative youth of the
language might imply. It compares very favourably w/ the Python
standard library and in some areas (e.g., cryptography:
http://golang.org/pkg/crypto/, image manipulation:
http://golang.org/pkg/image/) Go's standard library has features that
Python's doesn't.

Note too that for performance reasons many of the standard libraries
for the scripting/dynamic languages (Python, Ruby, Perl et al) have
been implemented in C, so becoming an expert in Python requires at
some point that you learn C if you want to mess w/ the internals. By
comparison, virtually all of the Go standard packages and are written
in Go itself, and if you need to wrap C libraries, cgo
(http://golang.org/cmd/cgo/) make the process a relative walk in the
park. You still need to understand C enough to be able to call C
functions, but cgo allows you to write the actual wrapper in pure Go
and generates the boilerplate C integration code for you.

Admittedly Go does not yet have the variety of 3rd party modules that
Perl or Python do, but w/ the stability of Go 1, any obvious holes
should be filled in pretty quickly. And Go's ability to easily
install 3rd party code via "go get" is the best implementation I've
seen yet since you don't have to do anything special to package up
your code, and it supports all of the top code hosting sites.

However, one important area where Go is currently behind is in
comprehensive web development frameworks like Django or Ruby on Rails.
Depending on your needs, Go on App Engine or the built-in web server
and template package might be sufficient, but if you're developing a
web application, IMO it's currently hard to beat the productivity of
starting w/ a mature framework like Django where the ORM can really
make the most of Python's more dynamic nature.

Having said all that, I believe that Go is an ideal first programming
language. It's low-level enough that you get a feel for what's going
on in the machine, but has high-level capabilities like garbage
collection and maps that make you more productive, and has very little
voodoo like "public static void main" (don't ask!). Importantly, Go's
excellent support for concurrency is a great introduction to a topic
that is generally poorly supported in other mainstream languages, but
using concurrency and understanding parallelism will be an
increasingly necessary skill as chips have essentially hit the clock
speed wall.

I wouldn't be surprised to see Go fairly quickly displace Java and C++
as the introductory programming language for undergraduate CS.

John

Yves Junqueira

unread,
Apr 4, 2012, 4:25:13 AM4/4/12
to John Barham, golang-nuts, Aahan Krish

If a library that is fundamental to your work is missing, mention that on this list to see if nobody is working on it already. If there are no replies, then you can either write the library yourself and share it with the community, or you can use another language.

You should learn other languages in addition to your primary one, anyway. That will also make it easier for you to find work.

Hopefully though you'll find that Go hits the sweet spot of being a fun/easy language that is also great for serious/professional work because it's fast and clean. So for projects that don't need that library, you'll be coming back to Go for sure :-).

Dave Rose

unread,
Apr 4, 2012, 10:03:33 AM4/4/12
to golan...@googlegroups.com
Kyle ad all, I've started reading the online Go book go-book.appsopt.com and have to say from a newbies POV, it's outstanding. Please keep steering newbies to that site. The other book , The Way to Go, mentioned further down this thread , from a brief review of the contents at Amazon is a bit dry and not IMHO the best for someone who has never written a line of code.

André Moraes

unread,
Apr 4, 2012, 12:46:40 PM4/4/12
to Aahan Krish, golan...@googlegroups.com
> But at some point, I'll probably need a library that doesn't exist for Go --
> where porting is probably the quickest way of doing so. So, the question is,
> don't you really think I should learn PHP or Python or some other more
> mature language (by age) that has a number of libraries, first?

Many of the Python or PHP libraries, are in fact, C libraries with a
small ammount of python code.
Go allows you to do that, with CGO you can use a library written in C inside Go.

You can even run Python inside Go, since there is a library that wrap
the CPython.

--
André Moraes
http://andredevchannel.blogspot.com/

Aahan Krish

unread,
Apr 4, 2012, 12:53:34 PM4/4/12
to golan...@googlegroups.com, Aahan Krish
Wow! That's kinda awesome! I am really excited about learning Go!

Peter Kleiweg

unread,
Apr 4, 2012, 3:29:57 PM4/4/12
to golang-nuts, pkle...@xs4all.nl
On Apr 3, 4:47 pm, Aahan Krish <geekpant...@gmail.com> wrote:

> *1)* Since 'Go Lang' is actually meant to replace C/C++ and Java, and also
> belongs to the same family, should I learnt it only after learning
> something simple like Python? or is it a not-too-complex language that I
> can get started right away?

Python isn't simpler than Go.

I think Go and Python are the best programming languages when you
start to learn programming. I think I have a preference for Go. (I
learned programming in Basic, and my second "language" was assembler.
Those were the days.)

But learning to program and learning a programming language are not
the same. Programming in itself is an art you need to learn to grasp,
on a conceptual level. There are excellent books for learning to
program, that do so by teaching you to program in Python at the same
time. I would really like to see such a book for Go, but I don't know
of any. That's a shame, because I think Go would make a better
teaching language than python.

Examples for Python:

- John Zelle: Python Programming: An Introduction to Computer Science
- Mark Lutz: Learning Python

Reinhard Wobst

unread,
Apr 4, 2012, 5:29:02 PM4/4/12
to golang-nuts
On 4 Apr., 21:29, Peter Kleiweg <pklei...@xs4all.nl> wrote:

> Python isn't simpler than Go.

I think you should not say that so absolutely - you compare a
dynamically typed script language with a type-strong compiled
language. Both worlds are quite different, in developoment, debugging
and learning.

I had to start once with Fortran (even Algol60 - OK, only during
studies :-), Assembler, most of code I wrote in C, I know Basic, I did
much in C++, ksh ... and now Python for more than 10 years. So I very
like the new, simple ideas of Go, though I wrote maybe even less than
1000 lines in Go up to now (soon to be more).

But: I have been teaching Python for far more than 100 people within
the last 8 years, and I never saw people learning a programming
language faster than Python. There were people with almost no
programming knowledge, Java experts (even they acknowledged that
Python is nice :-), C programmers - all they could write their first
small scripts during second day of the course.

So I know that they would have problems to understand what a Go
interface is (though Python also uses interfaces, but not as a type),
what a slice type is (though Python slices are easy to understand),
the defer/panic concept vs. exceptions, "implicit pointers" in Go,
unnamed struct fields ... think of people which have never been firm
with C!

I think that Go is an excellent solution for a compiled language, and
I hope tha I can prefer Go instead of e.g. C/C++ in the future. But
for beginners, Python seems to be easier, and you are able to solve
many, many problems astonishingly easy since the set of modules and
their methods is of course still richer than that of Go (e.g., I had
to mix flat and deflated entries in zip archive for modifying ODF
files, generate POSIX.1-2001 compatible tar archives with very long
pathnames containing UTF-8 etc). No wonder, Python is now about 20
years old. Go will gain it.

> I think Go and Python are the best programming languages when you
> start to learn programming.

Yes, I think one should learn both - how to handle an interpreted,
dynamically typed language and a "strong" one like Go. I believe both
have their application fields and right to live, and Python is not
only for education (so many plugins, script interfaces and data
analysis is/are now written in Python) ...

Reinhard

Andrew Gerrand

unread,
Apr 4, 2012, 10:01:54 PM4/4/12
to Reinhard Wobst, golang-nuts
On 5 April 2012 07:29, Reinhard Wobst <zwi...@gmx.de> wrote:
> On 4 Apr., 21:29, Peter Kleiweg <pklei...@xs4all.nl> wrote:
>
>> Python isn't simpler than Go.
>
> I think you should not say that so absolutely - you compare a
> dynamically typed script language with a type-strong compiled
> language. Both worlds are quite different, in developoment, debugging
> and learning.
[snip]

> But: I have been teaching Python for far more than 100 people within
> the last 8 years, and I never saw people learning a programming
> language faster than Python.

"Simple" does not necessarily correlate to "easy to learn [and use
effectively]."

For example, a sword is much simpler in design and construction than a
gun, but it is much easier for the layperson to kill with a gun than
with a sword.

I quote myself earlier in this thread:

> I would argue that Go is simpler than Python in almost every way. Python may
> be more forgiving to a novice programmer, as it lets you write pretty shaky
> code that still runs, but I don't see that as a virtue. It's nice to have a
> compiler to catch your (many and frequent) mistakes.

I stand by that statement. Python may be easier for a novice to pick
up, but I believe that one would become a better programmer by
learning Go.

Andrew

Brad Fitzpatrick

unread,
Apr 4, 2012, 10:38:51 PM4/4/12
to Andrew Gerrand, Reinhard Wobst, golang-nuts
On Wed, Apr 4, 2012 at 7:01 PM, Andrew Gerrand <a...@golang.org> wrote:

"Simple" does not necessarily correlate to "easy to learn [and use
effectively]."

For example, a sword is much simpler in design and construction than a
gun, but it is much easier for the layperson to kill with a gun than
with a sword.

I quote myself earlier in this thread:

> I would argue that Go is simpler than Python in almost every way. Python may
> be more forgiving to a novice programmer, as it lets you write pretty shaky
> code that still runs, but I don't see that as a virtue. It's nice to have a
> compiler to catch your (many and frequent) mistakes.

I stand by that statement. Python may be easier for a novice to pick
up, but I believe that one would become a better programmer by
learning Go.

Enough with the confusing metaphors. Which language is a better murder weapon? 

Gustavo Niemeyer

unread,
Apr 4, 2012, 10:51:29 PM4/4/12
to Reinhard Wobst, golang-nuts
Hey Reinhard,

On Wed, Apr 4, 2012 at 18:29, Reinhard Wobst <zwi...@gmx.de> wrote:
>> Python isn't simpler than Go.
>
> I think you should not say that so absolutely - you compare a
> dynamically typed script language with a type-strong compiled
> language. Both worlds are quite different, in developoment, debugging
> and learning.

(...)


> But: I have been teaching Python for far more than 100 people within
> the last 8 years, and I never saw people learning a programming
> language faster than Python. There were people with almost no

The superficial appearance of Python is very comfortable, and very
close to one's gut feeling. That said, it's also very deep, and not
easy to keep things sane after a given point.

For example, in that time frame that you considered as "learning
fast", have they learned about all the possible ways obj.attr can
resolve, as in instance variable vs. class variable vs. class
descriptor vs. metaclasses, vs. __getattr__ vs. __getattribute__, and
about __slots__, and also about __new__ vs __init__, and how to make
__new__ work at all, and the possible ways to call a base method,
(self.method or super?), and about what happens when you use either of
these with multiple inheritance. The list of edges goes on for quite
a while, and all of these are not about libraries or forms in which
the language may be assembled. These are first-class language
characteristics.

Go, the language, is definitely simpler than Python, the language. It
is true, though, that you can teach a small subset of Python faster
than you can teach the whole Go language.

> like the new, simple ideas of Go, though I wrote maybe even less than
> 1000 lines in Go up to now (soon to be more).

Nice, please don't take this minor disagreement as discouragement.
I've done a lot of Python in the last decade or so, and quite a bit of
Go in the last couple of years, so can see both sides. I suspect (and
hope) you'll stay around.

Please drop a note if you need anything.

--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/plus
http://niemeyer.net/twitter
http://niemeyer.net/blog

-- I'm not absolutely sure of anything.

kortschak

unread,
Apr 4, 2012, 11:57:58 PM4/4/12
to golan...@googlegroups.com, Andrew Gerrand, Reinhard Wobst
Whose foot do you want to shoot?

Kyle Lemons

unread,
Apr 5, 2012, 12:13:25 AM4/5/12
to kortschak, golan...@googlegroups.com, Andrew Gerrand, Reinhard Wobst
Clearly Go is a superior weapon if the goal is to shoot everyone in the foot at the same time.  The GIL in python forces you to shoot each person in the foot in sequence :).

Reinhard Wobst

unread,
Apr 5, 2012, 5:46:07 AM4/5/12
to golang-nuts
> Clearly Go is a superior weapon if the goal is to shoot everyone in the
> foot at the same time.  The GIL in python forces you to shoot each person
> in the foot in sequence :).

:-)
Yes, one must know about the limits of the preferred language. I would
never try to do "essential parallelization" in Python.

@Gustavo: About getattr() and superclasses ... Any programmer is
curious to experiment with new features. It seems to be quite hard not
to become too complicated - people use soo many tricky features in
programs which should simply work and be reliable, either to prove
their extraordinary intelligence to others or (in most cases) "to play
around". The best way is always the simplest, not the most elegant ...
I think everybody here has such experiences.

So at most I mention in courses that "there is something like
getattr()" and add: You should know that such things exists and where
to look for, but use them only when you really need it. It is not
necessary to know anything what Python can, there is an excellent
documentation. And this is obviously why so many people like Go -
simpleness. (BTW, therefore I still miss default values for arguments
in Go and estimate named arguments in Python which we almost have in
Go, too - about this in another thread).

In the last two years I sometimes solved (not so compilicated)
problems first in Python (for test cases) and then in C++/Qt, and I
was astonished that I made LESS errors in Python. This was not because
of the "better" language Python, but since it is simpler and much
easier to test and debug. It was because of the limited complexity of
my brain. The older I get, the more I estimate simplicity. And as a
freelancer I am responsible that other people can understand and
improve my code. So I used getattr() only once: To make an attribute
"constant" after its first (complicated) initialization, as a nice
home task for C++ programmers ;-)

I think we agree almost completely, it is a matter of clear
formulation only.

Happy Easter wishes

Reinhard

Paul Borman

unread,
Apr 5, 2012, 12:22:59 PM4/5/12
to Aahan Krish, golan...@googlegroups.com
Programming languages are like the fingerings on a wood-wind instrument.  There are variations between the instruments but in the end, fingerings are not difficult to learn and learning one makes the others easier,  though some instruments have easier fingerings than others.  The real challenge is to think in the proper mindset.  Just as different instruments are better for expressing certain moods than others, the choice of programming languages will affect how you express your solutions.  The hard part is composing the melody for what ever instrument you are playing.  The same is true in programming.  You are trying to learn how to compose your own melodies.  Once you learn this way of thinking you will realize that you will be able to program in what ever language is required.

Learning logic is a great introduction to programming.

That all said, yes, Go is a great language.  I used to recommend C, and I think C still has some good teaching tools missing in Go (like learning how to manage memory), but now I would absolutely endorse Go.  In the past year I have taken a team of 4 from zero Go experience to all Go programmers.  All of them have said that Go turns out to be a nice language to program in, and they all knew Python and C++.  They all picked it up quickly, too.

So Go forth with Go!

    -Paul

Bennett Hagan

unread,
Apr 5, 2012, 12:25:23 PM4/5/12
to golan...@googlegroups.com, Aahan Krish
Hi guys

My bad for hi-jacking this thread but did not see the need for creating a new discussion. I've recently been intrigued about this language after taking a course that involved a lot of CSP and learning Go's concurrency is built up on the ideas on it (correct me if I am wrong).

I am starting to learn the language and will start with the Go tour and I have read about its purpose & of a couple of commercial companies using Go here: http://go-lang.cat-v.org/organizations-using-go

I just really wanted to know how are some of you guys using it as that list on the website does not give details about how exactly it's being used.

geekpanth3r

unread,
Apr 5, 2012, 12:31:15 PM4/5/12
to golan...@googlegroups.com, Aahan Krish
Thanks for the much needed advise Paul. :)

Gustavo Niemeyer

unread,
Apr 5, 2012, 2:05:59 PM4/5/12
to Reinhard Wobst, golang-nuts
On Thu, Apr 5, 2012 at 06:46, Reinhard Wobst <zwi...@gmx.de> wrote:
(...)

> So at most I mention in courses that "there is something like
> getattr()" and add: You should know that such things exists and where
> to look for, but use them only when you really need it. It is not
> necessary to know anything what Python can, there is an excellent
> documentation.

Exactly. We're in agreement, and this was the crux of the argument:
you're presenting a very small subset of what Python really is, and
it's great that Python is helping you to teach them programming that
way. The fact you can teach people a small subset of the language
doesn't mean the language is simple, though. It takes significant time
to become a programmer that actually knows all those edges which are
very commonly found in real code bases.

(...)


> improve my code. So I used getattr() only once: To make an attribute
> "constant" after its first (complicated) initialization, as a nice
> home task for C++ programmers ;-)

% grep getattr /usr/lib/python2.7/*.py | wc -l
238

If you don't understand the semantics, you can't read Python code.

> I think we agree almost completely, it is a matter of clear
> formulation only.

Agreed!

aaron.b...@gmail.com

unread,
Apr 5, 2012, 3:43:18 PM4/5/12
to golan...@googlegroups.com, Aahan Krish

Kyle Lemons

unread,
Apr 6, 2012, 12:18:01 AM4/6/12
to Bennett Hagan, golan...@googlegroups.com, Aahan Krish
On Thu, Apr 5, 2012 at 9:25 AM, Bennett Hagan <master....@gmail.com> wrote:
Hi guys

My bad for hi-jacking this thread but did not see the need for creating a new discussion. I've recently been intrigued about this language after taking a course that involved a lot of CSP and learning Go's concurrency is built up on the ideas on it (correct me if I am wrong).
You are not wrong, though I think the word would be "inspired" by Hoare's CSP :).
 
I am starting to learn the language and will start with the Go tour
Yep.  Highly recommended.  I've used it to great effect to get my managers excited about the language :).
 
and I have read about its purpose & of a couple of commercial companies using Go here: http://go-lang.cat-v.org/organizations-using-go

I just really wanted to know how are some of you guys using it as that list on the website does not give details about how exactly it's being used.
I use it for pretty much everything.  When shell scripts get too complicated, I move to Go now instead of Python (or, before that, Ruby).  My hobbyist hacking is all done in Go, and I'm writing production systems at work using Go.  It's remarkably flexible.
Reply all
Reply to author
Forward
0 new messages