247 points · by dwevlo · 12y ago · 75 comments
As far as I can see, Go is doing the same. We need a language that has some mechanisms of higher level languages, like CSP style concurrency and GC, but which still allows for low level control of things like memory layout.
I ported a partly done multiplayer game server written in Clojure to Go, and I find that I'm more productive in Go. The tooling and server monitoring is more developed for the JVM platform, but coding in Go is more fun because everything is immediately responsive, and nothing "falls over" like it can with nREPL/bREPL with Clojure/ClojureScript. Always paying that several seconds environment startup delay, or the additional management required to avoid it, does wear on you in the long run.
There were plenty of languages with similar capabilities at the time. Algol, PL/I, Mesa, ....
Also, to write fast code, I don't have to decompile bytecodes or do obscure things to make sure arithmetic is what I meant it to be. Int64 addition is int64 addition.
Some things are definitely more powerful in Clojure. But that isn't where my priorities lie right now.
I don't see that Go allows you to avoid GC any more than Java does, really. You can (and Java programmers do, with regularity) use things like sync.Pool in Java as well.
Problems:
1) Is it for noobs or the guy learning his 10th language? Starts with "what is a file, what is a folder, what is a text editor". Then leaps into a very matter of fact "and this is how you do recursion". So a noob is going to be totally lost after the first chapters and an old timer is going to be pretty bored with the "what is a folder" level stuff.
2) Strange text encoding errors on the site. ... Bullet point "Strings are" a-hat (as in a with top hat, not ahat) lowercase-epsilon c-concat-e "indexed" a-hat epsilon "starting at 0 not 1" ... current firefox if that matters (which it absolutely shouldn't)
Other than that, its a pretty good intro level book, like I wrote I'd "buy the author a beer" level of goodness.
"of information – everything"UTF-8 / GMT / ISO8601 people. It's (should be) law.
"Go is an open source programming language designed for building simple, fast, and reliable software."
So that's opposed to all the languages designed for building complicate, slow, unreliable software... OK, I'll bear that in mind.
There are so many viable languages out there now that any introduction needs to give readers informed advice on when it's worth using, and therefore when it's worth learning.
Is there any online resource that does a good job of this, for a wide variety of languages?
There is no "when you want to do X, use language Y" guide, because it would be pretty stupid. Every good programming language can be used for nearly all your programming needs.
The only thing you need to keep in mind, is where the target program should run (and the list is very small):
- should the target program run in a browser? Use Javascript or a language that compiles to it (Coffeescript, Dart, TypeScript, ...)
- should the target program run on an embedded board (very low memory footprint, very low CPU cycles available)? Use a language with manual memory management: C, C++, Nimrod, Rust, D ...
- should the target program takes the most performance out of the hardware (games, HPC, performant system library, ...)? Use a language that makes fast executables: C, C++, Nimrod, Rust, D, Go, ...
- should the target program runs on a web server? On a desktop computer? Any case that doesn't fit the previous three? Use whatever language you want or are familiar with, they all can do it, and there is no "best choice".
Heck, people are running embedded Java with garbage collection and all with just a few kilobytes of RAM.
Low memory does not mean you need to do manual memory management. Of course, when you add requirements for predictable memory usage, it might be a different matter. Like embedded devices that need to run for extended time periods reliably without issues.
But then again, a lot of Commodore 64 programs written in BASIC managed to do just that without issues. Running for years without hick-ups.
"Go is an open source programming language designed for building simple, fast, and reliable software. It's a good choice where squeezing maximum performance out of the hardware is a primary concern."
Maybe a minor point -- but it makes the book far more compelling to people who will benefit from it, while enabling those who won't to move on.
So given that your choices for high performance is:
"C, C++, Nimrod, Rust, D, Go, ..."
Is there really nothing the author could say to help choose between them?
Forth?
After reading it and writing some trivial code, the advantages it has don't really help me with any problems I face being a 1 man shop. Just losing a lot of libraries so I'll probably stick to using Python for 99% of the stuff I do.
It's an easy read, and it does a good job showing what Go is like. It piqued my interest, and yesterday I started reading 'Programming in Go: Creating Applications for the 21st Century' by Mark Summerfield. Does anybody know how it compares to 'The Go Programming Language Phrasebook' by David Chisnall?
Bit entry level so far, even for a moron like me, but enjoying it.
If so, I've found this site helpful but "Introduction" is the proper term, it doesn't go particularly deep into anything.
* Drone (CI platform) - https://github.com/drone/drone
* Gogs (GitHub clone) - https://github.com/gogits/gogs
There are quite a few others, but those are the two most notable that I know of.
I've heard good things about Golang, then I hear things like its lack of generics make it useless for a lot of cases.
Even when generics are available, they're about a fraction of one percent of code. Other languages have been doing just fine without generics. Even Java has just syntactic sugar compile time type erasure hack instead of the real deal. Those List<String>s are just List<Object>s in bytecode. I don't remember any C-programmer complaining either.
What's very cool about golang in general, is that rather than including all the possible features you can think of (looking at you, C++!), it's more of how few features you can have while still having an expressive and powerful language.
I don't mean to talk down other languages or to praise golang, but I do want to point out one should look at the big picture and not let small details distract. Such as lack of generics.
In my experience programming in Go is very nice. It feels like you are coding in a scripted language but compiles.
I don't recommend it for production unless you are one of those master coders. Its still a fairly new language and a lot of time I had trouble finding easy solutions that normally can be found on google / stackoverflow. I also wished the error handling was different. Although Golang community loves the error handling methods (you are suppose to handle the error like this), my code tend to be overflown by it.
It was sort of a quick answer, so not really detailed.
As well, panic/recover is there if you would prefer that, but err seems to work just fine.
The biggest problem with that is that throwing exceptions has a purpose : it makes errors interrupt program by default.
With errors in go, that's the reverse : errors are ignored by default.
Maybe it's just I'm too new in go, but I feel like I'd rather have my errors taken cautiously by default, with the possibility to ignore them (catch) than having to use variable and put if statement everywhere I care about errors (which pretty much means everywhere, in my current design style).
Am I missing something, here, than can allow to avoid this verbosity ? (as for panic / recover, that's good for functions you implement yourself, but you still have to deal with errors from core / lib functions).
High level languages and compiled languages are pretty orthogonal. A language being interpreted/running on a VM# is not a prerequisite for being at a certain level or higher.
# And someone will complain that these are implementation details, not something to do with the abstract specification of the language itself.
You can have a book on APL or Forth that starts out in the first chapter targeting people new to programming, but that does not mean the language itself is the best choice.
Regarding Golang for novice coders, I would say it is an OK choice for a beginner, probably better than starting with Java, but not a good a choice as Python.
http://www.golang-book.com/2/index.htm
Go's "Hello World" is not quite as complex as java, but a lot more complex than Python, in terms of number of concepts to explain.
By the way, is there a suck book?