by stiff · 12y ago · 0 comments
- Why pick Go for this project in the first place? Those days the biggest productivity difference that arises from language choice comes from the availability of libraries, and it does not take much research to see that Go wasn't particularly targeted at numeric computing and that library support for those kinds of things is very poor. There is a number of mature platforms for this class of problems, SciPy, MatLab/Octave, C/C++ with various BLAS-derived libraries etc.
- The bit on poor performance is unconvincing because the source of the difference has not been identified. The speculations about Go and Java that follow are so poorly backed by any evidence and so wild they should have been cut out from the article. It's clear that the author has no clue what really happens in either case, and he proceeds to draw conclusions anyway. This kind of "magical" thinking about black boxes one doesn't understand is unfortunately all too common across software engineering.
- One place where I agree with the author is that Go's zoo of builtin data structures is really, really poor compared to Java. I mean compare:
http://golang.org/pkg/container/
http://docs.oracle.com/javase/tutorial/collections/interface...
http://docs.oracle.com/javase/tutorial/collections/implement...
I hate this type of non-productive comment.
"Why he picked Go" is beside the point. That was his personal choice, and it's of no concern to us if it was a good or bad choice when he made it.
What IS of interest to us, is his findings, ie. about how (non) fitting was Go for the kind of work he describes, and for what reasons. Because that can helps us access the language ourselves for such uses.
>Those days the biggest productivity difference that arises from language choice comes from the availability of libraries
Again, not true for his needs. For what he needed, core library built-ins have sufficed in Java (Set etc). As for Go, he did find 2 libraries implementing them, but he still wished for a good core implementation.
>The bit on poor performance is unconvincing because the source of the difference has not been identified.
No, but it's well known that Go lags behind the JVM, something even the Go team aknowledges and attributes to maturity of the compiler/GC.
Plus, from the writeup, he sounds like a thoroughly decent programer to not be able to code his way out of Go performance bottlenecks. Doesn't sound like the guy who can't use a profiler (and in fact, he points in his article that he DID use one).
>This kind of "magical" thinking about black boxes one doesn't understand is unfortunately all too common across software engineering.
Random rant unrelated to TFA.
On another note, I built an algorithm using a bitset. At first, I used one of the libraries the author linked, but then I saw that it was easier to just do the bit-bashing myself for my particular use case. It's not that difficult if you are familiar with C and C++ programming.
If, however, you are coming over from a language like Python, Ruby, and even Java to criticize Go is an easy thing to do. Those are very high level languages that protect you from needing to understand types. The object oriented parts of Java languages give you the ability to use polymorphism, which is not as straight forward in Go. You don't have a common base class. You only have interfaces. Trying to recreate generic structures and then blame the language for not having them is foolish. If you can't program without generics, stick with Java from the beginning. Or better yet, don't do a project in Go until you understand how to approach problems the Go way.
I happen to like Go for the very reason that you don't deal with generics. Seeing the types make it easier for me to follow as opposed to following a chain of inheritance. Getting rid of all the factory code trims my code down. This makes things easier to read when you are not the author.
Comparing Java's compiler to any other compiler is going to have predictable results. Java may have the best compiler out there.
Inheritance is overrated, and the factory pattern is often overused. Both of those happen with generics.
Generics have nothing to do with inheritance and the factory pattern. There are lots of languages that have generics but neither inheritance neither factories: SML, OCaml, Haskell, etc.
Inheritance makes generics harder, in fact, because type inference becomes undecidable in the general case.
Factories are basically a workaround for functions not being able to be freestanding (unattached to a class) in Java (the "kingdom of nouns"), a problem that Go doesn't have.
No, both of those have absolutely nothing to do with "generics".
I like the fact that you are forced to look at the algorithm vs the class hierarchy. I like that you don't have to read through factories.
I do think that generics would be great if they found a way of implementing them, however, I do not think that you need generics in order to write this kind of project.
I've demonstrated this myself by comparing the goroutines example prime number generator to a similar version written using Python generators.
The python generator code was faster, but there was a hard limit to how many primes could be calculated this way; I hit the stack limit.
[Edit] Code & times: http://pastebin.com/CqkMcxdK
Yes, with the exception of that being a story about some random idiot with an axe to grind, and this being a totally competent guy, that goes into detail about what he did and how, what trouble spots he found etc.
I guess, it being a hired project, he can't share the actual code. But he provided tons of pain points, well articulated.
I think that person was just frustrated.
I like Java as well. It can be difficult to read the implementation when you are surrounded with classes. That was the point I was trying to make.
If you are thinking in generic containers and are programming in Go, you either chose the wrong language or need to change how you are thinking.
Lots of languages are not object oriented and still have parametic polymorphism. Like SML. In 1973.
>If you are thinking in generic containers and are programming in Go, you either chose the wrong language or need to change how you are thinking.
If you are repeating the same baseless assertion routed in ignorance, then you either chose the wrong forum, or need to change how you are thinking.
I really like the language, enough to use it and work around the lack of generics, but that's a glaring weakness. They need some way to enable container classes.
Channels are a way of queueing work, which is great for many use cases.
You can use mutexes and shared memory if your situation calls for it. For example, if I am doing a graph traversal concurrently, I can use channels to send the work to many listening threads as I traverse that graph synchronously.
If for some reason, I need to update that graph's representation asynchronously, I may need to use mutexes to lock the graph since the graph is now shared memory.
[1] http://concurrencyfreaks.blogspot.com/2013/11/stampedlocktry...
[2] http://mechanical-sympathy.blogspot.ca/2013/08/lock-based-vs...
But the major problem is that many of the Java bashers tend to criticise without knowing what is possible to do in the Java ecosystem.
> Go's zoo of builtin data structures is really, really
> poor compared to Java.
This is a poor comparison because idiomatic Go typically doesn't use the `container` package.https://github.com/cosn/collections/
That being said, I completely agree that the author chose the wrong language for the problem at hand.