Go as a general purpose programming language

agolangf · · 673 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hey all, </p> <p>I&#39;ve been looking for a while now for a new programming language to learn, maybe build few projects with it to keep my wits sharp. </p> <p>I&#39;ve been a software engineer for few years, and I&#39;ve done quite a variety of projects ( web, games, iOS, etc. ) in different languages ( RoR, C/C++, Objective-C, PHP, etc. ) and I&#39;m starting to feel that I&#39;m not an expert in any of them. And I want to change that. </p> <p>So I started looking for a general purpose programming language worth the investment, and I came to choose Go because it captures everything I like about OOP while dismissing everything I hate, it&#39;s compiled, and has a reasonable garbage collection with the option to turn it off, what&#39;s not to like. </p> <p>What bothered me was the general sense I got from looking around that Go is more of a &#39;systems language&#39;, this worries me because I&#39;ve seen how Ruby is made famous and enslaved by the Rails framework, I do realize it does so much more ( homebrew, etc. ) but that&#39;s the exception I&#39;d say. </p> <p>So as far as someone who wants to adopt a language for variety of purposes, and what I mean by that is being able to build a reporting tool on a dataset, build my own blog engine, maybe make a super hard version of tetris for fun. Is Go a good fit for this ? and where does it lack ? ( other than the mobile apps ) </p> <hr/>**评论:**<br/><br/>jbuberel: <pre><p>Let&#39;s see how Go does:</p> <ul> <li>Blog Engine and website generator: <a href="http://gohugo.io/">http://gohugo.io/</a></li> <li>General purpose, configurable web server: <a href="https://caddyserver.com/">https://caddyserver.com/</a></li> <li>Real-time log data processing: <a href="http://hekad.readthedocs.org/en/v0.9.2/">http://hekad.readthedocs.org/en/v0.9.2/</a></li> <li>Tetris: <a href="https://github.com/nsf/gotris">https://github.com/nsf/gotris</a></li> <li>Mobile (Android &amp; iOS): <a href="https://github.com/golang/go/wiki/Mobile">https://github.com/golang/go/wiki/Mobile</a></li> <li>Robotics: <a href="http://gobot.io/">http://gobot.io/</a></li> <li>Containers: <a href="https://github.com/docker/docker">Docker</a> and <a href="https://github.com/coreos/rkt">Rkt</a></li> </ul> <p>What is missing? For more: <a href="https://github.com/golang/go/wiki">https://github.com/golang/go/wiki</a></p></pre>TheMerovius: <pre><blockquote> <p>Is Go a good fit for this?</p> </blockquote> <p>Yes, go has been already successfully used for all of the named things. :)</p> <blockquote> <p>and where does it lack ?</p> </blockquote> <p>Currently GUI apps. Hopefully that will change over the next year or so, there are two very promising contenders.</p> <blockquote> <p>( other than the mobile apps )</p> </blockquote> <p>Go is actually one of the best languages for developing mobile apps, after the native ones (java/obj c. respectively for android/ios). :)</p></pre>Str8firefam: <pre><p>I am sure the go mobile is just used as an alternative to game dev and for making libraries for those platforms. It can&#39;t replace Java for android or swift/obj-c for iOS with regards to normal apps.</p></pre>jerf: <pre><p>If you&#39;ve got a task that you believe is suitable for Go, then it might be OK. However, given the list of languages you list, if you put them all on a chart, Go would be mostly sitting in the middle of them. You should expect to find that Go would be very easy to learn, and probably will do very little to &#34;keep you wits sharp&#34;, precisely because it would be too easy. A characteristic very good for working with it and choosing it for work plays against you here.</p> <p>I would suggest something more far-out, such as Haskell, Clojure, F#, Rust or Scala. Listed in no particular order; my opinion is that for your stated purpose Haskell is the best, but any would teach you more than Go.</p> <p>(So as to defend myself against downvotes, bear in mind my recommendations for &#34;next language to learn&#34; are always contingent on the languages someone already knows. There are plenty of other language sets for which I would happily recommend Go.)</p></pre>TheMerovius: <pre><p>You should bear in mind that OP didn&#39;t ask to &#34;learn something new&#34;, but to &#34;become expert in a programming language&#34;. go is quite easy to become an expert in and it will give you quite a lot of flexibility. Haskell is next to impossible to become expert in and the flexibility it gives you is meh.</p></pre>TheMerovius: <pre><p>Also, I believe go has quite a lot of new things to learn for the named set of languages. Or rather &#34;quite a lot of old things to unlearn&#34;. The language might be boring as a language, but it is quite challenging to learn as a philosophy (in fact, quite a few people posting here on the reddit <em>don&#39;t</em> get that part very well).</p></pre>jerf: <pre><blockquote> <p>go is quite easy to become an expert in</p> </blockquote> <p>I think I said something about that.</p> <p>The very fact that it is <em>easy</em> means it isn&#39;t that great to &#34;keep my wits sharp&#34;.</p> <p>You really, really can&#39;t have both of &#34;Go is a mindblowing language that will teach you a lot&#34; and &#34;Go is really easy to learn because it&#39;s like the languages you know&#34;. Go extremely clearly has chosen the latter.</p></pre>AnimalMachine: <pre><blockquote> <p>The very fact that it is easy means it isn&#39;t that great to &#34;keep my wits sharp&#34;.</p> </blockquote> <p>They shouldn&#39;t have to rely on the language being difficult for this. If someone wants to keep their wits sharp, they should solve complex problems with a language and not fight the language/tools themselves.</p></pre>jerf: <pre><p>You don&#39;t keep your wits sharp doing easy things.</p> <p>Seriously, you can&#39;t thread this needle. Either Go is really easy to learn, or Go keeps your wits sharp. Fighting for the latter is just being illogical... if someone came along and claimed Go was hard to learn, you&#39;d be fighting just as hard about how easy Go is to learn. Just go ahead and be consistent. It&#39;s better advocacy. Go is not the solution to everything everywhere all the time.</p></pre>AnimalMachine: <pre><blockquote> <p>Either Go is really easy to learn, or Go keeps your wits sharp.</p> </blockquote> <p>Writing a real-time physics engine has challenges regardless if you use a language like Go or C++. </p> <p>My argument is that actions like making a real-time physics engine is what keeps you sharp not learning the tool itself.</p></pre>lapingvino: <pre><p>That would be like learning Ithkuil to learn better communication.</p> <p>I really prefer Esperanto for that.</p></pre>: <pre><p>[deleted]</p></pre>fubo: <pre><p>Go was built as a language for large high-performance systems, particularly servers that handle tens of thousands of simultaneous requests. Hence the centrality of concurrent I/O to the whole design.</p> <p>Consider where it&#39;s coming from. Google production is historically a C++ and Java shop packed full of multi-layer services tied together with <a href="https://developers.google.com/protocol-buffers/?hl=en">protobuf</a>-based RPC. Handling stupidly huge numbers of requests per second is kind of what every Google service is about, and that&#39;s what Go is built for.</p> <p>Go is safer than C++ and faster than Java. It&#39;s less verbose than either, and it compiles incredibly quickly — something that matters in a large organization with thousands of source files. And Go&#39;s toolchain encourages a range of software engineering practices that matter primarily in large organizations. Just to pick a trivial example: Having all the pigheaded coding-style arguments settled once and or all (by <code>go fmt</code> reformatting everyone&#39;s code to look the same dumb way) <em>actually matters</em> when you care about the human time of thousands of coders who are passing code-reviews around among multiple time-zones, where a quibble about indentation might cost someone a day&#39;s time before they can get their change in.</p> <p>The fact that Go is supplanting Python for system automation tasks says more about the problems of Python than the design of Go. I&#39;ve been using Python for ~14 years and it&#39;s still my primary language ... and getting good performance out of it has never been straightforward, especially once concurrency is in the mix. And as sysadmins scale systems from three servers in a closet to three thousand servers in the cloud, concurrent performance starts to matter a hell of a lot.</p></pre>jakub_h: <pre><blockquote> <p>Go is not a system language. </p> </blockquote> <p>Oh yes, it is. In the same sense that Oberon is a system language.</p> <p>It doesn&#39;t replace C nor C++ for realtime or mission critical system software , it was purely marketing from the Go team.</p> <p>Except that Go as a language doesn&#39;t have any obvious deficiencies that would prevent that. It&#39;s all a matter of implementation.</p></pre>jjolla888: <pre><p>being an expert in one language is sort of a thing of the past</p> <p>what you have (ability to do stuff with a number of languages) is actually the way forward</p> <p>Just add Go to the list .. don&#39;t aim to be any better at than your other langs .. if it happens it&#39;s probably because you became ensconsed in some big Go project, so enjoy that ride if it comes.</p> <p>You will chose Go to look at first wherever concurrency is important. But for other stuff you may be happy with what you already know.</p> <p>fyi, my top list looks like: (i) concurrency: Go, (ii) math/stats: Python, (iii) low-level: C, (iv) glue: Perl</p> <p>of course there are others .. driven by whatever the package im working on was written in</p></pre>BoTuLoX: <pre><blockquote> <p>being an expert in one language is sort of a thing of the past</p> </blockquote> <p>Unless you work with C++ and a small chance of Rust joining it in the future.</p> <p>Feature creep is a bitch.</p></pre>jakub_h: <pre><p>But being an expert on Go allows you to integrate with greater ease specialized languages for significant parts of your larger projects that have special needs. In fact, based on the balance of features exposed by the runtime, Go is probably one the significantly easier-to-work-with environments in which you should be able to do that.</p></pre>jjolla888: <pre><blockquote> <p>Go allows you to integrate with greater ease specialized languages for significant parts of your larger projects that have special needs</p> </blockquote> <p>genuinely curious ... would like to see some examples</p></pre>jakub_h: <pre><p>Examples of what? Go gives you a decent but not overcomplicated type system and good support for concurrent and parallel execution of code. Some people like the VPRI folks are trying to integrate languages on a lower level (roughly a BCPL level) but that puts greater burden of proof on the higher levels that you won&#39;t screw up at runtime, and concurrency and parallelism in shared memory on current architectures are not even considered (they appear to be trying to avoid it, which is not practical until future computers drop the multi-core approach). On the other hand, you could complicate the language further (like Haskell does, for example) but there appear to be diminishing returns with those efforts.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

673 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传