4 ms·
Go recently, and Clojure previously. Clojure forced me to think in a radical different way than I was used to. I started with massive functions that easily bec
by dvcrn 10y ago
Go recently, and Clojure previously.
Clojure forced me to think in a radical different way than I was used to. I started with massive functions that easily became unreadable, and slowly adapted purity and wrote side-effect free code. The paradigm shift affected me so much that even in other languages, I started writing pure code and use function composition more and more often. Coming from an imperative background, functional programming was a bit difficult at first to wrap my head around, but now I love it! (Eventually I even ditched JavaScript for ClojureScript).
Go recently because it was my first truly compiled, statically typed language after almost 7 years of working (I know, right?). My entire career consisted of Python, PHP, JS, Ruby - you get the idea. Go changed that. On top of that, it is a very biased language that forces it's coding standards on you. Not all are good but you learn a lot about the design decisions behind them and why things work in the way they do.
Plus after working with it for a while, even other compiled, statically typed languages like C++ became a good chunk easier.
And as a extra, very recently: Elixir. Loving functional language, Elixir taught me erlangs genservers and process manage and oh boy! I don't understand why that's not the default tool we use for webservers all the time. It just seems like a natural fit vs other languages. Thanks to supervision trees, it is very easy to write fault tolerant, highly concurrent applications that span multiple servers, without the need for extra tools.
For example: You can spin subprocesses up at any point, communicate with them, kill them, let them crash without fearing that anything else in your application is affected. When previously you needed a queue server, a cache server, background workers, service crash recovery, long running requests processing and more to build a concurrent system, Elixir makes it very easy to implement these things extremely easily as subprocessed without the need to leave your application and grab tool X (upstart/cron/rabbitmq). Worried that something will crash? Just let it crash and the supervisor restarts it. Worried that the supervisor crashes? Then the supervisor of the supervisor restarts the supervisor.
Your background worker process is on server 2 and you want to dispatch something from server 1 from the same mesh? Just use it's PID and let BEAM handle the rest. Same for Queues, Stores, Caches or anything really.
I am highly convinced that learning Elixir is something every web engineer should learn.
- farm_code 10y agoI am decade old Java dev, but Elixir changed the way I design web apps.
- nhorob67 10y agoWe just switched some of our back-end code to Phoenix in our farm management web app (https://www.harvestprofit.com/ https://www.harvestprofit.com/). Your username intrigues me....what are you working on?
- mountaineer22 10y agoSo, what stack would/do you use/recommend? Elixir + Go + ???
- dvcrn 10y agoI would almost always use Elixir these days, the advantages are just that good. I don't see anything python or ruby can give me in a server context that Elixir doesn't bring. If I need to go for speed or write a CLI tool, then I'd probably pick Go. For frontend work, clojurescript. So Elixir+CLJS for almost all web-based apps (or, you know, react native).
- 59nadir 10y agoThere's no need to involve Go in that stack if you're building on Elixir. If you absolutely need interop with something else it'd be better to go with something more focused (either on speed, correctness or something else, as Go doesn't really focus on much of anything, except design-wise) and use it through ports or the like, from the BEAM. Go as an addition to a BEAM app won't add anything as it mostly does nothing much better than the BEAM and what it does better will be better handled by other languages. Some people would attempt to make a case for it being able to spawn threads, etc., but its scheduling makes in inherently as incompatible with the BEAM as any other language, so it's not a reasonable point to make.