News for hackers. Stuff that matters.
[dead]
Re:Open Sourcing Our Go Libraries (2014) by tptacek on Tuesday January 06, 2015 @11:57AM (#8845379)
This is probably not a great thread in which to have that conversation. Java isn't even implicated in the story, and this is a language-war topic.

We'd all be better off if this thread were actually a discussion of the libraries Dropbox released, and if subthreads like this dropped to the bottom of the page.

I downvoted you for that reason; not because it's a dumb question, but because it's in a very unfortunate spot on the thread.

Re:Open Sourcing Our Go Libraries (2014) by yalue on Tuesday January 06, 2015 @11:35AM (#8845201)
There are several reasons we've been using go for web backends where I work:

- Very easy deployment (we can just copy the same binaries between our 64 bit linux boxes and run them)

- Go's libraries for developing minimal web interfaces are excellent

- Being strongly encouraged to do all the explicit error checking made our Go code much more reliable and easy to debug than our previous python versions.

Of course, all of this depends on how big the project is. We just have several components of a project that require a simple webpage frontend with a small REST backend to interact with Redis. Our entire server for both the frontend and backend is ~1200 lines of Go and easy to understand. If your project is much bigger, you may end up needing features that aren't present in Go (as was the case with Dropbox), which may slow you down some.

Re:Open Sourcing Our Go Libraries (2014) by nkozyra on Tuesday January 06, 2015 @11:48AM (#8845305)
Java might be one of the few languages for which there isn't an immediately compelling sell.

For scripting languages like Python or Ruby you can sell out-of-the-box performance and concurrency benefits.

For lower-level compiled languages you can sell the ease of cross-platform binary compilation and direct compatibility with C.

The only thing I can think of that might be interesting to someone with a monolithic Java codebase is the syntactical simplicity and speed of testing / deploying. But if you have such a codebase that's a major prospect for potentially minimal benefit. Not to mention you have a much larger set of developers to choose from.

edit: weirdest downvotes ever

Re:Open Sourcing Our Go Libraries (2014) by NateDad on Tuesday January 06, 2015 @05:02PM (#8847400)
The one major benefit is much lower memory overhead due to having real value types and not needing to box simple types.
Re:Open Sourcing Our Go Libraries (2014) by rattray on Tuesday January 06, 2015 @12:03PM (#8845415)
Can someone explain why this was being downvoted?
Re:Open Sourcing Our Go Libraries (2014) by beagle3 on Tuesday January 06, 2015 @11:58AM (#8845390)
Would that be over Java the Language? Java the Virtual Machine? Java the Ecosystem (Libraries, alternative languages)?

Java the Language:

1. Go is more concise. You might not care, but I do.

2. Go uses explicit error return codes.

My experience is that practically and counter intuitively, explicit error return codes (that have to be explicitly checked for errors) result in more robust code than exceptions (checked or not). YMMV.

Java the Virtual Machine:

1. Go produces single file native binaries. You may not care, but if you do, that's a win.

Java the Ecosystem:

1. Go interfaces to C more easily;

2. Go has a more vibrant, more enthusiastic community right now.

3. Go advances more quickly.

(Of course, I can think of a lot more reasons that the Java ecosystem wins - but you asked to sell you on Go...)

But if you're looking for a new language, rather then Go specifically, I urge you to have a look at Nim (nee Nimrod). It's very impressive. I think it's what Go wanted to be.

Re:Open Sourcing Our Go Libraries (2014) by pstuart on Tuesday January 06, 2015 @12:14PM (#8845481)
> 2. Go uses explicit error return codes

Small nitpick, but the default error value returned is a string.

Re:Open Sourcing Our Go Libraries (2014) by 2mur on Tuesday January 06, 2015 @12:46PM (#8845743)
Even more nitpicky, it is an interface. It is where you get into problems with nil interfaces and not returning an explicit nil value for the error.
Re:Open Sourcing Our Go Libraries (2014) by pjmlp on Tuesday January 06, 2015 @12:49PM (#8845772)
>Java the Virtual Machine:

> 1. Go produces single file native binaries. You may not care, but if you do, that's a win.

So does Java. It is only a matter of picking the right implementation.

There are certified implementations with AOT compilers.

Re:Open Sourcing Our Go Libraries (2014) by iends on Tuesday January 06, 2015 @11:41AM (#8845258)
Go compiles to native code and uses less memory than Java does. Go is slower than Java right now (for most things), but is less optimized so there is hope that it catches up and maybe one day is faster. Both languages have GC. Go has OOP, but not with classes. Go does not have generics, see the 50,000 blog posts for details. Go has less boilerplate than java but still some (mainly it is explicit in checking for errors). Go has built in HTTP server, and you don't have to deal with containers, application servers, etc. Go has some pretty incredible tools that come for free (race detector, gofmt, etc) but is lacking in some tools that Java excels with (IDEs & debuggers).

If you're already writing Java, Go isn't a huge win. If you're using Ruby/Python/JS and want more performance Go is a choice instead of the JVM.

Re:Open Sourcing Our Go Libraries (2014) by waps on Tuesday January 06, 2015 @09:55PM (#8848618)
The difference that seems to matter to most people is that Go has a standard library that's (currently) free of cruft, and free of "historical reasons".

Java's standard library is bytecode-compatible with Java1 programs, which will run fine on today's JVM's. This results in several very dumb and ugly inconveniences.

For example, take a look at the ArrayList javadoc. Notice the Object methods (clone(), and toArray()), which are there because the return-type polymorphism doesn't work (you cannot call a different method based on what you assign the function result to). So it's not possible to provide a valid Clone() method that returns something other than Object without breaking java1 programs that use it. (Go's has compiler hacks for core datatypes for some things, which of course means it's a matter of time until things break, but for now ...).

Of course if this was the only instance of this sort of problem, nobody would care, but you can find examples like this in most core classes.

TLDR: Go is in it's honeymoon period.

More detailed explanation :

http://stackoverflow.com/questions/17509659/why-standard-jav...

Re:Open Sourcing Our Go Libraries (2014) by sz4kerto on Tuesday January 06, 2015 @11:33AM (#8845185)
Very different use cases. If you can simply choose between the two, then your situation is quite unique. It means that you don't need to rely on the wealth of Java libs available already; hiring is not really an issue; probably you're starting a new project and you either don't have any kind of time pressure or you don't know neither of the languages. :)

There isn't anything that you can write in Go but you cannot in Java. (Probably it's true the other way around as well.)

Re:Open Sourcing Our Go Libraries (2014) by jbooth on Tuesday January 06, 2015 @01:08PM (#8845943)
Java dev who loves Go here.

Go takes what I consider 'best practices' in Java, things like delegation-rather-than-inheritance, and manage-concurrency-through-BlockingQueues-and-ExecutorServices, and makes them the 'idiomatic' way to do things.

It's not so much huge wins as a bunch of small wins, a much tighter stdlib, and making it much harder to do some common java antipatterns like implementation inheritance and overdone design patterns. Oh, and the C interop is amazing.

The error handling, having to explicitly check return codes, seems like a huge burden at first but pays off later when you realize you can't have random exceptions bubbling all the way up the stack from anyplace in the code.

Re:Open Sourcing Our Go Libraries (2014) by aikah on Tuesday January 06, 2015 @12:27PM (#8845585)
> Can someone sell me on Go over Java?

Do you need generics? then Go isn't for you.

Re:Open Sourcing Our Go Libraries (2014) by gnewton77 on Tuesday January 06, 2015 @02:21PM (#8846354)
>Do you _think_ you need generics? then Go isn't for you.

FTFU ;-)

Re:Open Sourcing Our Go Libraries (2014) by jdcarter on Tuesday January 06, 2015 @11:40AM (#8845248)
In my case I frequently need to link to C libraries, so Java is a non-starter. (I realize many others have the opposite problem.) Go allows me to easily build wrappers for the libraries I need, then get to business.

From there it's the concurrency primitives, goroutines and channels, that make Go a true winner. It's easy to build network services that can move work through various stages quickly and in parallel. SEDA-style workloads are a pleasure to implement in Go.

Re:Open Sourcing Our Go Libraries (2014) by lojack on Tuesday January 06, 2015 @11:46AM (#8845294)
> I know there is a lot of hate for Java on HN

I can't speak to the technical merits of either language, but something can be said about choosing a language with a lot of hype as opposed to one that's hated in the community. From a recruitment perspective, choosing Go may be more favorable in a lot of developers eyes.

Re:Open Sourcing Our Go Libraries (2014) by sz4kerto on Tuesday January 06, 2015 @11:51AM (#8845322)
Java is hated in 'the community'? Well, Java is not hated at all in the Java community, it just happens that HN is a place where people are hyping the latest & greatest stuff - until it turns out that it isn't _that_ better than the old stuff. Go does not represent a fundamental paradigm shift, it's just a language with slightly different compromises to Java. We have a _lot_ of experience with Java in the industry so we know the advantages and weaknesses -- not so much with Go.

"From a recruitment perspective, choosing Go may be more favorable in a lot of developers eyes." -- from a recruitment perspective it's extremely easy to find (experienced) Java devs, and not so easy to find (experienced) Go devs.

Re:Open Sourcing Our Go Libraries (2014) by beagle3 on Tuesday January 06, 2015 @12:10PM (#8845463)
> it just happens that HN is a place where people are hyping the latest & greatest stuff - until it turns out that it isn't _that_ better than the old stuff.

That brought a smile to my face. I've been saying this about Java since 1994.

> from a recruitment perspective it's extremely easy to find (experienced) Java devs,

From my experience, that is true in the literal sense of "experienced = having experience". But not so true in the sense of "experienced = competent and knows their stuff", which is often implied. One of the things about new and fringe languages is that they are effectively a competence filter:

It is much more likely that e.g. a Lisp programmer, a Haskell programmer, an OCaml programmer or a $NEW_HOTNESS programmer for most values of $NEW_HOTNESS is a good one. I suspect Go is beyond NEW_HOTNESS status to work as a filter, though.

Re:Open Sourcing Our Go Libraries (2014) by NateDad on Tuesday January 06, 2015 @05:59PM (#8847693)
One nice thing about go is that you don't have to hire good "Go devs", you can just hire good devs and they can learn Go in a week. We do that on Juju. 2/3rds of our devs wrote their first line of go on the job, and were still productive right away.
Re:Open Sourcing Our Go Libraries (2014) by matthewmacleod on Tuesday January 06, 2015 @11:48AM (#8845307)
I can't speak to the technical merits of either language, but something can be said about choosing a language with a lot of hype as opposed to one that's hated in the community. From a recruitment perspective, choosing Go may be more favorable in a lot of developers eyes.

The problem is that the 'HN community' has IMO a pretty small overlap with the overall software development community.

Hype in the former does not equate to hype in the latter.