Ask HN: New OSS Projects: Go or Java?

19 points by arrsingh ↗ HN
I'm thinking of working on building something new and open sourcing it. I know java really well so my first choice is to build it in java (pure java - no J2EE or other bloat) but Go also looks like a great alternative. Plus I'll have an excuse to learn Go.

Since I'm hoping others in the community will want to contribute, I thought I'd ask here before making a decision.

What do folks think - should I build it in Java or Go? Would you prefer to contribute to a Java or a Go codebase?

30 comments

[ 3.0 ms ] story [ 68.1 ms ] thread
I think you should decide what your single most important goal is:

1) launch a project

2) learn a language

Learning a new language will derail your project completion and launch indefinitely, often permanently.

This is actually a great point.
Totally. IMO it's equivalent to deciding whether to write a book in your native language or in another language you don't speak because they have more words in the domain of the book's topic.
You wrote this in English? What kind of comment-writer are you? English has so many spelling inconsistencies and homonyms it's a wonder that anyone can understand anyone else. Everyone knows that real authors write in Spanish. Neruda, Borges, Márquez. Spanish's clear pronunciation rules, elegant conjugations, and separation of mutable state (`estar`) from immutable state (`ser`) ensure you'll never run into any dangerous misunderstandings. Consider this sentence:

    "¡Hola, mundo!"
Note that the sentence is one character shorter than the corresponding phrase in english (`"Hello, world!"`) - this kind of efficiency is quite common when you write in Spanish. Also note that the extra space won by removing a character was then used to add a pre-exclamation flag (`¡`). This flag is a neat optimization to ensure that the interpreter knows to prepare for an exclamation ahead of time.

Better interpretation, pronunciation, efficiency. Why are you not writing Spanish today?

The most important thing is to use the right tool for the right job. If the project has networking and doesn't involve building a GUI or graphics, then Go is a great choice. (Not that Go can't do GUIs or graphics, but there aren't very robust and mature libraries for those things yet).
Does Go do networking better than Java?
Go's standard library is pretty nice.
I know that Java's standard library is very complete. I know very little about Go's, but I presume that it's not more complete than Java's. Is Go's library easier to use than Java's? Is it significantly easier?
Go is through it's integrated support goroutines (green-threads) very efficient at IO, while still presenting it in a traditional fashion (like blocking IO).

Java can also be very efficient, but only provides the lower level NIO library out of the box. To use that you either have to build und understand a lot of components for yourself (e.g. an IO Reactor, timer handling, etc.) or include one of the bigger frameworks for this purpose (e.g. Netty).

(comment deleted)
If I did any UI pieces it would probably be in React talking back to an API handled by the core server.
With network applications, you're often trying to optimize performance. It seems to me that the Go GC would make it a non optimal choice for network applications. I think writing it in Go would be good for the prototype.
Go is great for I/O bound applications.
Java's networking capabilities are rock solid, battle-tested and have got very fast as it is used in many heavy duty back end systems all over the world
How about C?
personally if I were you I would use this as an excuse to learn Scala especially as you have a Java background.
Between Java and Go, definitely Go. I think you'll find it surprisingly easy to learn, although a bit constraining compared to Java.

OTOH, if the project will require heavy loads you might want to consider Phoenix/Elixir. That's would be learning something truly different too.

> What do folks think - should I build it in Java or Go?

There is an old quote that when people ask for advice you should carefully figure out what they want to hear and then tell them that.

In this case even more so: if you are starting an open source project I'd strongly recommend optimizing for long-term motivation. Whatever that means in this case I'm afraid I cannot tell.

> Would you prefer to contribute to a Java or a Go codebase?

I personally would have a way simpler time contributing to a Java project than a Golang project.

Get to read so much good about Go and I want to try. But then you see the syntax of Go - its plain-ugly - why ?
plain-ugly is a lot better than unclear-ugly
What qualifies as unclear-ugly ?
Being too clever for your own good and writing wonderfully elegant code that randomly breaks on some other engineer who doesn't know you long after you have left the company. Surprise tire fire!
This:

    $,="\t"; print readlines.map{|r| s=r.split; [s[0].to_i,r]}\
    .max{|a,b| a[0]<=>b[0]}
It's a ruby one-liner that prints the largest first field and the lines that contains that field.
(comment deleted)
I was wrestling with the same question a few months ago and ended up choosing Scala! I got to learn something new but could still fall back to things I liked about Java.
whether you want to ship or you want to learn more?
Given the scope of the question, if you are thinking about creating something useful in the OSS space, then I would clearly recommend to start with Java since you would be laying the foundation of the project in a language you know.

Otherwise pick Go.

What's the nature of your project? If you want people to use it and maybe create a community around it, the language might play a big role.

My impression is that Java is used by enterprise and more established sectors, whereas Go is popular with hobbyists and early adopters.

I tried to start another project in Go instead of Python/Flask. I never really started.

If you want to learn, Go is a good choice. If you want to get things done, use what you already know.