<hr/>**评论:**<br/><br/>ChasingLogic: <pre><p>So I love Elixir and I think Phoenix will replace Rails and when that happens the world will be better for it. However, I use Go for pretty much everything at this point and if someone were to ask me which they should learn I would say Go every time (and likely I will say Go for pretty much ever). Allow me to elaborate:</p>
<p><strong>Go is simpler and works much like our brains do (imperative programming)</strong></p>
<p>I really enjoyed my foray into functional programming and it made me a lot better developer overall however I find that largely it's impractical in day to day use when I'm trying to "just get the job done" an imperative solution is faster.</p>
<p><strong>Go makes you learn it all</strong></p>
<p>Elixir / Phoenix like to hide complexity, they do so in the most elegant way I've seen (i.e. less magic and you can extend their model very easily) but at the end of the day it can be hard to know exactly what's going on. You might think that's a great thing for a beginner but Phoenix (and Ecto) has lacking documentation and if you want to do anything outside of the lines it becomes extremely difficult, so here if the goal is for a beginner to get something working the easiest Rails still takes the cake and if the goal of the beginner is to learn Go will make you understand everything. (be this good or bad depending on your own views)</p>
<p><strong>Go is more hackable</strong></p>
<p>This spawns more from the previous point but since I'm doing everything anyway it makes it really easy for me to plug in libraries or extra code wherever I want so that I can change the behavior any way I see fit, which matters a lot for non-trivial development.</p>
<p><strong>Go is better at everything other than web development</strong></p>
<p>This may not be particularly useful for your question but it is a point that I use in Go's favor when someone asks me what language to learn. Elixir for writing CLI's is frankly not fun (IMO). Not to mention the fact that you have to have the BEAM installed on the targets machine, I write a lot of small command line utilities and just compiling a binary and dumping it wherever I need it is the bomb and something that I found very frustrating. There's also a lot of work to get Go working for mobile and desktop applications which is HUGE and is something that Elixir cannot do today and doesn't appear to be on the road map.</p>
<p><strong>You don't need npm</strong></p>
<p>This is a small point because almost all of my Go web projects use Ember or React on the frontend so end up requiring npm anyway but I do think it's weird that a full MVC framework like Phoenix requires npm. I think this point is largely irrelevant but I'm sure some people care.</p></pre>lucasvmiguel: <pre><p>We tried to build an API with elixir in my job, we had already APIs with go. My team is not expert in Elixir, but we know many things. After two days, we gave up of elixir.</p>
<p>Our opinion:</p>
<p>Go:</p>
<ul>
<li>Faster (Performance)</li>
<li>Medium (Productivity)</li>
<li>Safe</li>
<li>Easy to write code</li>
</ul>
<p>Elixir:</p>
<ul>
<li>Slow (Performance)</li>
<li>Not so Fast (Productivity) - Maybe could be faster, if we know even more... =/</li>
<li>Safe - Could be more safe than Go</li>
<li>Very hard to write code - there are so many ways to write!!!</li>
</ul></pre>sairamk: <pre><p>the message passing is pretty safe and intuitive. Go has borrowed the concept of channels from Erlang</p></pre>lucasvmiguel: <pre><p>Golang doesn't have supervisor too..</p></pre>Redundancy_: <pre><p>I think that the question is largely what advantages are you looking for?</p>
<ul>
<li>Both Elixir and Go can be very robust if you use them correctly</li>
<li>Generally speaking, Go is going to use your compute more efficiently (see techempower web benchmarks), so depending on that it's possible you could see up to a cost reduction at scale.</li>
<li>You may or may not benefit from Erlang messaging - if your application is stateless anyway, you can potentially just load balance (and messaging + shared state solutions are pretty numerous)</li>
<li>You don't necessarily need the live update features of Erlang's VM (there are plenty of techniques for 0 downtime deployments)</li>
<li>You'll probably find more developers who can easily pick up a Go codebase than an Elixir one (looking at Google trends, TIOBE and considering how easy it is to learn etc)</li>
<li>I'm not immediately sure how easily Elixir / Erlang mixes with things like Containers / Kubernetes and concepts like micro-services, but I think that's relatively well established for Go (that may just be my lack of knowledge)</li>
</ul>
<p>For the right problem, there's almost certainly an argument to be made for Elixir, but I would be hard pressed to convince myself that it was work moving overall when Go is so well positioned to fit easily into and integrate with the large number of systems, patterns and solutions in the web space. </p>
<p>YMMV</p></pre>mixedCase_: <pre><p>It's faster, simpler, has a syntax much closer to C and a bigger ecosystem.</p>
<p>Go already has first class functions, so I don't really miss anything from the FP world.</p>
<p>As for BEAM, its tradeoffs do not benefit web dev as much as it does its original domain (telecoms).</p></pre>sairamk: <pre><p>I code in Go and Ruby, tried Elixir.</p>
<p>Assuming by Web Development, you mean REST APIs with database and views. A typical MVC architecture. </p>
<p><em>It Depends!</em></p>
<p>Elixir has a steeper learning curve compared Go for setting up models, complexity of application etc., Once you get accustomed to something, you'd prefer experience over anything else. </p>
<p>There was a time I was hell bent on using Ruby/Rails for every problem because of the ease of writing code. May be I would have done that 1-2 years ago, but not anymore. It totally depends on what you/your team knows and how to slowly transition to what you need. </p>
<p>Speed of development vs Speed of Delivering. Both Go and Elixir may fall under that category with enough practice.</p></pre>sairamk: <pre><p>(teeny bit off topic, but I found the link to 10m only yesterday)</p>
<p>Comparison of Go vs Elixir - Definitely not Apples to Apples. </p>
<p>Go was pushed to make <strong>10million clients on 32-core / 208GB</strong></p>
<p>source: <a href="http://goroutines.com/10m" rel="nofollow">http://goroutines.com/10m</a></p>
<p>Phoenix was portrayed to <strong>2 million clients on 40core / 128 GB</strong> (but there were significant improvements made within few months of releasing this post) </p>
<p>source: <a href="http://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections" rel="nofollow">http://www.phoenixframework.org/blog/the-road-to-2-million-websocket-connections</a></p></pre>andradei: <pre><blockquote>
<p>you'd prefer experience over anything else</p>
</blockquote>
<p>I agree. This gets more important the more programmers you have involved on the project, regardless of whether it is a web app.</p></pre>PacNinja: <pre><p>I don't have any experience with ruby or functional languages so Go is much easier to pickup.
It isn't technical but plays a role for many companies and people when picking languages.</p></pre>pinpinbo: <pre><p>I think Elixir requires user to deploy Beam VM, no?</p>
<p>After tasting single binary deploy in Go, it's hard to make me want to go back to managing Ansible scripts for VM upgrade on every box.</p>
<p>Go culture appeals to me more because of minimalism, they reminded me to Python culture pre-Django: Build minimal library that does one thing well. I am not familiar with Elixir community to make comment, but when I looked at Phoenix framework, it's pretty involved.</p>
<p>Non-ceremonial static typing is very nice to have. It gives me the confidence to move faster without worrying about runtime errors/panics. I used to be hardcore on the side of dynamic language (because I think computer should do its very best to accommodate users to express ideas) but I have since changed my stance.</p></pre>sairamk: <pre><p>One of the good features of Erlang/Elixir (Beam VM) is that you can deploy code without restarting the process ensuring zero downtime. A runtime error does not take down the server, it just takes down that particular process. </p>
<p>The supervisor tree that handles the restarting of processes is definitely worth a look.</p></pre>karma_vacuum123: <pre><p>Go also wins on practical matters like being able to hire developers and search StackOverflow</p></pre>mrmylanman: <pre><p>I love elixir and attempted to use it for a rather large project recently, however I found a few issues that were blockers for me:</p>
<ul>
<li>The ecosystem still lacks officially supported packages from various online services</li>
<li>The language and core packages are going through quite a bit of flux with a fast release cycle.</li>
<li>Raw performance isn't terrible but it isn't as fast as I would like for a lot of what we do.</li>
</ul>
<p>This might be changing now, however the solution that is ready now is Go.</p>
<p>If Elixir had a few more years I might very well be using it instead of Go, because I really do like elixir but for now I just wasn't productive enough.</p>
<p>I like functional programming but u don't think I'm at that point yet.</p></pre>robvdl: <pre><p>For me it's because I don't come from a Ruby background but a Python background. Elixir might be attractive to someone that has just come from Ruby, but not so much for me as a Python developer, it doesn't really do it for me.</p>
<p>Then the last thing is Elixir still requires the Erlang runtime, with Go I can just drop a binary on a server and that is it.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传