<p>The following text (adapted) is copied straight from the introduction to Elixir. </p>
<p>"Instead of asking “how to do X in {Elixir | Go}”, ask “how to solve Y in {Elixir | Go}”. In other words, don’t ask how to implement a particular solution, instead describe the problem at hand. Stating the problem gives more context and less bias for a correct answer."</p>
<p>I only wanted to share this to say, that instead of bringing solutions, patterns and technique from other languages and platforms, it is useful to think about the problem and how to solve it in idiomatic Go (or any other language). </p>
<p>I've been writing C# since the beta first came out, and I've been doing Go for a few years now, and I still have to fight the tendency to think "I need x feature from C#, or I'd structure it this way" instead of how to do it in Go. Go has set of strengths (composition, interfaces, duck typing, channels, goroutines, containment, no inheritance, embedding, garbage collection, simplicity, clarity), other languages have other strengths (functional constructs, generics, built in DSL's), some languages like C# have a bit of everything. What is true for Elixir, Go, C#, Rust, etc, is that they can solve most real world problems, but the solution to each doesn't take the same shape, and shouldn't need to, because then you aren't taking advantages of the strengths of the language.</p>
<hr/>**评论:**<br/><br/>jerf: <pre><p><a href="http://catb.org/%7Eesr/faqs/smart-questions.html">How to Ask Questions</a>. It's generally good stuff, and if perhaps some of it rubs you the wrong way, well... to some extent that may be because you are the one who needs to be reading the document. :)</p>
<p>I've actually been relatively pleased with at least the people posting on <a href="/r/golang">/r/golang</a>; there's a lot of "how do I do {{ .highLevelGoal }}" here, and a good amount of posting of real code, and not a lot of the typical "how do I do this small part of the crazy plan I'm not telling you about where in fact there's an easier way to do the whole thing that you can't guess because my question is too specific?"</p></pre>lluad: <pre><p><a href="http://xyproblem.info/">xyproblem.info</a> is a useful link to remember when explaining this to people.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传