5 ms·
What was the main factor for choosing Go instead of C or Java?
by geeklord 6y ago
What was the main factor for choosing Go instead of C or Java?
- Kaze404 6y agoWhat makes C or Java such better options that they had to have explicit reasons to use Go?
- KaoruAoiShiho 6y agoIt's probably because they existed when he first started learning programming.
- IshKebab 6y agoThere's a whole section in the article about that. C would be a pretty obviously terrible choice so I'm not sure why you would consider that. Java would be ok but Go is much simpler to get started with and to deploy. In general it is more lightweight and easier to use (unless you need generics, though Java doesn't really do those right either).
- vijaybritto 6y agoinstant feedback is possible in Go as it compiles super fast. Also its much simpler to write cause its a small language and the concurrency primitives are so simple to understand and use. It has its problems but its a great choice here. The most valid reason for using a language is simply because the team is comfortable with it.
- 3fe9a03ccd14ca5 6y agoConsidering they got it working so quickly, I think they made the right choice.
- capableweb 6y ago> instant feedback is possible in Go as it compiles super fast Heh, you should try a language that comes with a repl and allows you to evaluate code directly from your editor in any context and get the results back. Then you'll have experienced "instant feedback". Until then, I can agree that Golang compiles faster than other languages, but it's nowhere near instant. In some other languages, you don't really care how fast it compiles as you only do it for deployments anyways (like Clojure).
- kortex 6y agoMany options https://repl.it/languages/go https://repl.it/languages/go https://github.com/d5/tengo https://github.com/d5/tengo https://github.com/motemen/gore https://github.com/motemen/gore Also you kinda don't need a repl as much with go (coming from a python background and constantly repl-dev-ing), especially with an IDE. Everything is so clear and type-safe there is little divide between the architecture in my mind and the code's behavior.
- capableweb 6y agoIt's not that you don't need a repl. It's that you don't really get the many benefits other repl-heavy languages have, like Smalltalk and the many different lisps. You got a lot of implicit state and other non-ergonimic constructs in the language that doesn't lend itself to live in a repl for development. Also I expanded a bit more on why Golang doesn't fit for repls in general here: https://news.ycombinator.com/item?id=23053343 https://news.ycombinator.com/item?id=23053343
- foldr 6y agoA REPL only gives you instant feedback on code that you type into the REPL. If you make some changes to three modules and you want to find out the effect of those changes then you need to...recompile the modules. Having a REPL doesn't help. I don't find that a REPL really gives me anything that I don't get from tests in Go. The only difference in practice is that I type the code into a text editor rather than into a REPL prompt (which is actually a better experience). On top of that, it's usually good to have that kind of code saved somewhere rather than existing ephemerally in a REPL session.
- capableweb 6y agoDepends on how the language you use works. Golang is not made for repl usage so of course you don't really get the full power. Compare with something like Clojure where redefining a function in a repl, makes every function using that function also use the new definition. Start treating functions as just functions without any implicit state, and you can start to overwrite things in the program on the fly. Super valuable when debugging and otherwise also when creating code as you can much easier test ideas. I don't know if it has a different word, but a repl for Clojure using a repl-workflow is very different from a repl for Golang with the normal "save -> compile -> run" workflow you have with Go. For example, using a repl-workflow in Clojure doesn't mean you don't write code in your editor. I use vim + vim-fireplace to write my code, then highlight the parts I want to evaluate. So I get both in one. The repl is running in the background, and vim-fireplace communicates with it. Combine this with a SPA and I can have something like `(.alert js/window @username)`, highlight it and evaluate, then have an alert prompt in my browser window, which is next to my editor. Saves me a ton of time.
- geeklord 6y agoI see. Being comfortable is the one of the most important factors.
- jftuga 6y agoOne nice thing about Go and C vs Java, is that a program can be (statically) compiled into a single, stand-alone executable that have no external dependencies.
- esprehn 6y agoJava supports packaging as well: https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html https://docs.oracle.com/javase/8/docs/technotes/guides/deplo...