4 ms·
One of Go's selling points is always it's a pragmatic language. But after using it for awhile and implementing a few web apps and APIs in it. I've crossed it of
by jrobn 11y ago
One of Go's selling points is always it's a pragmatic language. But after using it for awhile and implementing a few web apps and APIs in it. I've crossed it off my list for web app or API development. It's great at making standalone CLI tools, however.
I've since moved to using Elixir (erlang) for web app stuff (even some scripts) and I am much happier. I'm not in love with Elixirs syntax, but it's nice and includes meta programming. Elixir is a much more pragmatic language in my opinion. Once you use things like pattern matching (what could be more pragmatic) you can't go back. Raw performance is nothing to write home about but in my use cases elixir does a great job of hitting the sweet spot.
- spinlock 11y agoWhat's the performance of Elixir been like for you? We're looking into it because of the actor concuttrncy model which we think will be much more performant than our current ruby or clojure solutions.
- jrobn 11y agoIt's great at IO. Period. Get a request, pipeline it, transform it, call out to a database, get some data back, fire off emails, talk to third party APIs.... All of those can be structured as processes. All of those can be independently fault tolerant. All of those can be inspected while they are running...in production. Seriously, for HA APIs or web apps it feels like a no brainer. I just wouldn't us it for things that are CPU bound, like image processing for example. Try implementing something that is a bottleneck in your system in elixir and then throw some data at it and see how it performs. Elixir + Phoenix is a real treat for web app devs.
- spinlock 11y agoFantastic. Thanks for the response. Our use case is talking to an API, doing a little bit of processing then writing to a database. It's all IO with barely any processing (just a few string substitutions to "normalize" the API responses).
- ngrilly 11y agoWhat are the rationales underlying your choice to stop using Go and move to Elixir for web app or API development?
- jrobn 11y agoIn no particular order: No sane story for request contexts. I got tired of waiting for net/http support for x/net/context. Coercing Go structs into JSON and vice versus was just annoying enough. I felt like I was paying the price (being more explicit) for static typing without a lot of the benefits of other static typed languages. and this: //go:generate stringer -type=Pill [https://blog.golang.org/generate https://blog.golang.org/generate]
- ngrilly 11y ago> No sane story for request contexts. I got tired of waiting for net/http support for x/net/context. This is moving forward. A package context would probably be added to the standard library and integrated with net/http.Request: https://github.com/golang/go/issues/14660 https://github.com/golang/go/issues/14660 How is this issue solved in Erlang/Elixir? > Coercing Go structs into JSON and vice versus was just annoying enough. I had the same feeling when I started using Go (coming from Python/JS, and Java/C++ a long time ago). But then I realised that I have to validate my inputs anyway, even in Python, JS or Erlang. Defining a struct and unmarshal to the struct gives me that for free in Go. How do you solve that in Erlang/Elixir?