Why innovative software use go

xuanbao · · 699 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi all,<br/> I am very wondering, why innovative software like for example docker use Golang?<br/> I&#39;m sure, that everyone here, have hear from the rust programming and it should be faster, safer then Golang, provide generics etc.<br/> But why companies still use Golang? Not make a switch to Rust?</p> <hr/>**评论:**<br/><br/>davecheney: <pre><p>There is a weak argument that Rust is immature compared to Go, looking just at their relative ages. But I think that is wrong. </p> <p>Go continues to be the language of choice, not because it contains the most features, but because it contains only the <em>best</em> features, chosen with care, from hard won experience.</p> <p>I recommend everyone read <a href="https://talks.golang.org/2012/splash.article" rel="nofollow">https://talks.golang.org/2012/splash.article</a> to understand what motivated the Go authors to write a new language, and then compare their motivations with the requirements of the projects you cite.</p></pre>: <pre><p>[deleted]</p></pre>SupersonicSpitfire: <pre><p>You forget that Go is based on years of compiler development and programming for Plan 9 at Bell Labs, before that. </p></pre>: <pre><p>[deleted]</p></pre>SupersonicSpitfire: <pre><p>Go is much closer to its predecessor than C# is to Turbo Pascal.</p></pre>davecheney: <pre><p>You complete missed my point.</p></pre>thraxil: <pre><p>Aside from Rust not really being considered production ready yet, I think there&#39;s a lot to be said for Go being simple and &#34;boring&#34; in comparison.</p> <p>I think that most programmers have a limit on how much complexity and innovation they can handle at any given time. If the domain that you&#39;re working in is innovative and complex, that consumes a lot of cognitive bandwidth and doesn&#39;t leave much for thinking about the language that you&#39;re working in and vice versa. Go is great for this. You can basically learn every aspect of the language fairly quickly and then not have to think about it, being free to focus entirely on the problem you are solving. The code might not be as elegant or &#34;clever&#34; and take a few more lines, but the advantage is that it&#39;s straightforward to write and for another programmer to read.</p> <p>Meanwhile, when I write Rust (or C++, Haskell, Scala, Perl, or any more &#34;expressive&#34; and complicated language), I have a hard time getting my head out of the language itself and thinking in terms of the application domain.</p> <p>So are you interested in your code innovating in the problem domain, or do you want other programmers to look at your code and marvel at the elegant, clever abstractions and micro-optimizations?</p></pre>SupersonicSpitfire: <pre><p>Also, Go have large projects with teams of several programmers in mind. The compile times are fast, the code has a standard formatting, it&#39;s easy to read the code of others (compare this with C++ where everyone seems to write their own specific dialect) and there are no unused imports. It&#39;s a language that has been designed for efficient use by <em>teams</em>, right from the go. </p></pre>Bbbb1133: <pre><p>You are kicking off a common discussion again. Another question why do people use Java?</p> <p>However I can just point out my personal view on the things. I started with c++ like 5 years ago and I really liked it It&#39;s native + powerful + not hacked(I mean there are almost no compiler tricks to make any specific stuff working, you are able to use all functions completly dynamic). But there&#39;s no package manager and sometimes the syntax gets really weird and the biggest point is when you work alone you need to code a huge amount of code to make something simple working.</p> <p>So I&#39;m at go now. Go has it&#39;s niches the goroutine concept is a killer feature and Rust is not even close to that kind of syntactic sugar. Go solves and reinvents the wheel in many cases. Don&#39;t take me wrong but Rust looks super messy in all syntax wises(shortened, super weird operators, ...). I would prefer C++ all the time over Rust. Go is something different It&#39;s powerful and easy to use for most kind of web services. </p> <p>Ofcourse there are the 3 major downpoints for Go -&gt; Generics, Debugger, Performance(It&#39;s getting better).</p> <p>For me Go is the missing key to apps I dont want to write in c++(mainly networking apps). Uh and programming an app with rust is in 99% of all cases not faster than writing a go app.</p> <p>So yea I think people really like how simple, efficient and innovative go lang is. I guess most people who choose go also have a c++/c background.</p></pre>zero_coding: <pre><p>Wow...nice explanation.</p></pre>nuunien: <pre><p>Probably because Rust does not have a release version and their API is not stable at all.</p></pre>lethalman: <pre><p>Rust is the new C++/D, too many features and too much complex. Not worth it compared to Go, even if it was mature.</p> <p>So why new projects use Go? Because it&#39;s simple, does the job with a quite fast runtime and has few yet general purpose concurrency primitives.</p> <p>E.g. <a href="https://github.com/rust-lang/rust/issues/11165" rel="nofollow">https://github.com/rust-lang/rust/issues/11165</a> addressed only in 2014, while in 2009 go already had a clear mind about async I/O.</p></pre>Aangelikaa: <pre><p>This! </p></pre>jerf: <pre><p>Rust is significantly harder to understand and write, due to its type system being much stronger and making more demands on the nature of your code. Note &#34;demands more from your code&#34; is the key here, not &#34;Rust is hard and I don&#39;t understand it&#34;, I generally do having written a lot of Haskell which is even more demanding. Rust <em>demands</em> that you constantly be writing your code to be fully ownership correct, all the time, without stopping. I have limited anecdotal evidence this Rust is still slower to write even after one is fluent in Rust and only modestly skilled in Go; the Go still comes out faster. For the extra expense, the Rust code will run a few times faster (not dozens, like Python vs. Go, but probably 2-3x), avoid GC pauses by not using it, and be more correct in general.</p> <p>Sometimes this is a good tradeoff, and sometimes it isn&#39;t. I wouldn&#39;t dream of building Servo in Go. (I could see building the web browser UI shim, but not Servo itself.) On the other hand, &#34;a quick microservice to give access to a MongoDB database with some basic business rules added&#34; would be significantly slower to write in Rust and not meaningfully faster in execution than Go (both will be waiting on DB IO), even if it had a web handler as nice as Go&#39;s which it does not yet. (But that is a temporary situtation, I&#39;m sure.)</p> <p>Rust isn&#39;t simply &#34;better&#34; than Go... it&#39;s a language that asks for more, and gives more in return. It&#39;s awesome that we have this choice, and I wish Rust all the best and will probably learn it someday (personally I&#39;m really a 1.2-sorta guy, that&#39;s when I picked up Go too). They compete, but less than you would initially think.</p></pre>Betovsky: <pre><blockquote> <p>I have limited anecdotal evidence this Rust is still slower to write even after one is fluent in Rust and only modestly skilled in Go; the Go still comes out faster.</p> </blockquote> <p>I have no experience in either Rust or Golang, so I can&#39;t say anything about it. But recently there was a post of a thesis and it showed they were similar in programmer productivity, at least for that person.</p> <p>Having said that, I agree with you. The languages don&#39;t compare, they are proper for different tasks. I think you were spot on, on your examples, servo and microservices.</p></pre>HectorJ: <pre><p><a href="https://www.reddit.com/r/golang/comments/29ua55/rust_or_go/" rel="nofollow">https://www.reddit.com/r/golang/comments/29ua55/rust_or_go/</a></p></pre>Betovsky: <pre><blockquote> <p>But why companies still use Golang?</p> </blockquote> <p>Why wouldn&#39;t they? It&#39;s such an young language, that it will just have more companies using it, not less, in the next years. </p> <p>Why make a switch to Rust? Because that would be a very big mistake. Rust is not even ready for production. Even when it get &#34;production ready&#34; it needs still to mature a bit, have a better and rich library/tooling ecosystem.</p> <p>Even then, Rust and Golang are very different languages that are proper for different tasks. Docker probably isn&#39;t the best example for a use-case for Golang, and actually there is already a project in Rust similar to it, <a href="http://vagga.readthedocs.org/en/latest/" rel="nofollow">Vagga</a>.</p></pre>zero_coding: <pre><p>So it is probably better to write docker rust? </p></pre>davecheney: <pre><p>I&#39;m very disappointed in the number of commenters who state the <em>sole</em> reason why Rust is not being used is because it is not &#34;production ready&#34;. You are making the argument that the measure of a programming language is its years in the field. By that logic clearly Fortran 77 would be the defacto choice for every kind of programming task from numerical simulation to REST picoservices.</p> <p>Sure, yes, Rust is still a few days short of its May 15. 1.0 release, but I believe that is not important; some of the success stories we point to in Go got on the bandwagon even before the 1.0 release -- it&#39;s just a number, not a state of mind.</p> <p>Companies choose to write products in Go <em>because the language solves their problems</em>. Does Rust solve those companies problems ? Yes, if you subscribe to the theory of a universal Turing machine. But in the real world, the companies that got on board with Go did so because the <em>design principals</em> of Go resonated with their frustrations with their current language of choice.</p> <p>Rust and Go do not have anything in common save they arrived on the scene at roughly the same time and so have been cast as mortal enemies in some form of feudal langauge bloodsport.</p> <p>This isn&#39;t Highlander people, there won&#39;t be a &#34;there can be only one&#34; replacement of Go programs with Rust programs.</p></pre>Little_Johnny: <pre><p>As someone working at a start-up that decided to standardize on Go, I&#39;ll point out a couple of things. First - making a language switch isn&#39;t easy. We could incrementally begin using Rust for new projects, (who knows, maybe we will), but a wholesale rewrite of our code-base from Go to Rust would probably put us out of business. We simply don&#39;t have time to take on such a project, even if we wanted to.</p> <p>Another thing to note is developer experience. None of us know Rust; a couple of us have played with it a bit but nobody has done a major project with the language. We don&#39;t know what the caveats are when you use it for a large project, but we know the things to avoid for Go because we&#39;ve been writing Go code consistently for the last year or more. </p> <p>The most important reason though - why should we bother switching? Go solves our problems. We&#39;re productive with it, we know the language, and we haven&#39;t found a real problem with using it for our projects that would compel us to seek an alternative.</p> <p>You can say that Rust is better than Go (although in reality I think it&#39;s more correct to say that the two were designed to solve different problems), but from a business perspective if a company like Docker or my own were to switch from Go to Rust, it would most likely be a highly risky move with a dubious return on investment.</p></pre>tex0: <pre><p>Besides all other arguments, it`s probably because Go is a lot more mature than Rust. And by mature I just mean &#34;older&#34;.</p></pre>: <pre><p>[deleted]</p></pre>jerf: <pre><p>Rust was a research project, and still hasn&#39;t hit 1.0. Go is on 1.5, and that 1.5 is meaningful, as each release has been production-quality and backwards compatible.</p> <p>They may both have started at the same time, but Go became usable much earlier (basically due to its lower ambitions), and it&#39;s not unfair to say it&#39;s significantly older in an important way.</p></pre>kurin: <pre><p>Well, 1.4</p></pre>ItsNotMineISwear: <pre><p><a href="http://en.m.wikipedia.org/wiki/Worse_is_better" rel="nofollow">&#34;Worse is better&#34;</a> sums it up nicely.</p></pre>

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

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