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?
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.
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.
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
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.
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
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 :-).
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/
"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
"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 stand by that statement. Python may be easier for a novice to pick
> 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.
up, but I believe that one would become a better programmer by
learning Go.
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.
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!
Hi guysMy 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-goI 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.