Go over .Net/C#, Why?

blov · · 472 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Looking for a convincing story to choose Go over .Net for &#34;anything&#34;. Yes Go has a great concurrency model - the present state of concurrency/async/etc is not too shabby in .Net. Yes Go has great tooling - like it or not, Visual Studio is pretty damn good, and with the right setup you can be very efficient. I&#39;ve built some decent CLI tools in Go, but I can do the same in .Net, perhaps not deployed in a single binary (unless you go the route of ILMerge), but still. Roughly equivalent and I can use F# if I want a more functional experience.</p> <p>I&#39;m asking this sincerely as someone who is trying to convince himself that there is value investing valuable time in Go in the future. I&#39;m always learning new languages and there is major value in just the learning aspect alone. That said, given the current and planned future state with .Net (Core, cross platform, etc), why would you pick Go over .Net?</p> <hr/>**评论:**<br/><br/>fortytw2: <pre><p>Choosing any tool &#34;for anything&#34; over anything else is fundamentally a mistake. Choose the right tool for your task, and don&#39;t be afraid to switch around. </p> <p>Go is incredibly good for building CLI tooling and network/performance dependent applications (daemons, monitoring tools, infrastructure tooling, etc), but for many other tasks there are languages/tools that will work better than Go :) </p></pre>qu33ksilver: <pre><blockquote> <p>Choose the right tool for your task</p> </blockquote> <p>My advice too.</p> <p>And lastly, if you are a Windows + Visual Studio shop, you are probably better off with C#. </p></pre>woozyking: <pre><p>Go is a first class citizen in the open source world. That can either be your reason to go for, or against it.</p></pre>ultra_brite: <pre><p>If you plan to use F# since you want a &#34;more functional experience&#34; you are certainly not going to enjoy writing go code, at all. </p></pre>salbass175: <pre><p>Sure, understood. That was just a minor point though.</p></pre>kl0nos: <pre><p>As someone that know and used both. They both have their use cases and different tooling. I would use C# over Go for any desktop(Windows)/mobile UI development because tooling is a lot better. I would use Go everywhere where i need control over allocations and performance (it&#39;s a lot easier to do with Go guarantees instead of using C# generational GC and hoping that all will go into first generation). I would use Go in every team that do not know either one, because Go is a lot simpler to learn than C# (with all it&#39;s concepts and rules). Simplicity is very strong argument to choose Go over C#. If i would need highly structured code with a lot of corporate constraints and composition (access restrictions private, public, protected, inheritance, generics etc.) I would choose C# because it shines there. As you see it depends, both are better than the other for different use cases, they have also common ground on which they are both good. It really boils down to your use case.</p></pre>weberc2: <pre><p>If you haven&#39;t already, go to the <a href="http://tour.golang.org">Go tour</a>. IIRC, it takes a couple hours and you should be able to write complete, interesting Go programs by the time you&#39;re done. Adding to that, the fact that you can learn a programming language to the point where you can be productive in <em>hours</em> (or at worst, a couple days) is a big selling point in and of itself.</p> <p>C# is a great language, but a few of my reasons for preferring Go are:</p> <ol> <li>In Go a type definition is neither pointer nor value, it&#39;s just a type. Individual instances can be passed around by value or by reference and converted back and forth. This makes it <em>much</em> easier to reason about memory allocations and collection (Go also has escape analysis, which C# doesn&#39;t, at least not yet), and eliminates the need for copy constructors and other such things.</li> <li>Go doesn&#39;t have classes (no extra runtime metadata on my object, though reflection still exists). In my opinion, C# would be much better if it only had its &#34;struct&#34; types, and passed these around by reference when necessary (see point 1).</li> <li>Go doesn&#39;t have inheritance, it has interfaces for polymorphism and some sugar for automatic delegation (&#34;struct embedding&#34;). One fewer footgun. Building your project is 1 command (<code>go build</code>) if you have all of your dependencies installed, otherwise it&#39;s <code>go get &amp;&amp; go build</code>.</li> <li>Simple build system. No project metadata files. Everything Just Works (this will be even more true in 1.8 when GOPATH defaults to $HOME/go). No runtime dependencies, so you can get a binary with <code>go build</code> and then pass it around to anyone on your platform. Want to compile for linux arm from your MacBook? <code>GOOS=linux GOARCH=arm go build</code>. Send the binary to whomever you want--there are literally no runtime dependencies besides a minimal OS (<del>not even libc</del> this isn&#39;t quite true, see <a href="https://www.reddit.com/r/golang/comments/5cenu6/go_over_netc_why/d9w653v/">conversation below</a>). Last I checked, there was no <em>practical</em> way to do this for .Net (though there were some experimental solutions).</li> <li>Implicit interfaces. If I&#39;m using your library, and I want to use one of your types to satisfy my interface, in C# I would have to create a new type that extends your type and implements my interface. In Go, I would just use your type and never think about it again.</li> <li>Great standard library. Go&#39;s standard library covers JSON, Templating, HTTP (production grade), testing, benchmarking, etc, etc. BTW, <code>go test</code> will run your tests by default., <code>go test -bench .</code> will run your tests and benchmarks.</li> <li>Standard formatting. Everyone uses the same style courtesy of <code>gofmt</code> (a program distributed with Go, which everyone binds to the save function in their text editor).</li> <li>Documentation for free. No special syntax, <code>godoc</code> parses the comments above any public declaration and produces documentation. <a href="http://godoc.org">http://godoc.org</a> does this for any repository path you pass it (e.g., <a href="http://godoc.org/github.com/russross/blackfriday">http://godoc.org/github.com/russross/blackfriday</a>).</li> </ol> <p>Did I mention you (and thus your entire team) can learn it in a couple hours?</p></pre>TheSpreader: <pre><blockquote> <p>Simple build system. No project metadata files. Everything Just Works (this will be even more true in 1.8 when GOPATH defaults to $HOME/go). No runtime dependencies, so you can get a binary with go build and then pass it around to anyone on your platform. Want to compile for linux arm from your MacBook? GOOS=linux GOARCH=arm go build. Send the binary to whomever you want--there are literally no runtime dependencies besides a minimal OS (not even libc). Last I checked, there was no practical way to do this for .Net (though there were some experimental solutions).</p> </blockquote> <p>This is mostly true, however I wanted to point out that unless you are cross compiling CGO is still enabled by default in many cases, so libc still gets linked to on mac and linux platforms. This is easy to overcome in some cases, you can just disable CGO, but certain features may not work (os/user as an example). And often it isn&#39;t a problem anyway, provided the system you&#39;re transferring the binary to uses a compatible version of libc. But then you get into situations on linux with distros like Alpine, popular in the Docker world, which use musl libc, and you can have problems. And never mind if you actually <em>need</em> CGO, i.e., to link to an external lib, then cross compiling gets back to being as hairy and complicated as it is on most systems that have native binaries.</p></pre>weberc2: <pre><p>Looks like this is true, at least if you depend on the <code>net</code> package. My mistake. I edited my answer and linked to your comment. Thanks for the information!</p></pre>szabba: <pre><p>You&#39;ve left out the &#34;github.com&#34; in the example godoc link.</p></pre>weberc2: <pre><p>Fixed now. Many thanks.</p></pre>-Nii-: <pre><p>Too bad in your godoc link to blackfriday, several of the exported funcs do not have documentation, and there isn&#39;t any example code either!</p></pre>weberc2: <pre><p>Yeah, not all projects are well documented.</p></pre>SaltTM: <pre><p>One thing I hope GO developers do more often is proper version control. There&#39;s way too many packages out there that sit on master without any versioning at all lol.</p></pre>weberc2: <pre><p>Probably true, but this hasn&#39;t been a problem for me yet. When I find a bug, I can move to the latest version with the fix; I don&#39;t have to wait 6 months for a release to drop (which seems to be the norm, at least in Python). I find I can do this with some degree of confidence because the quality of Go projects tends to be higher than projects of other languages.</p></pre>vimthrowaway: <pre><p>I have a current project that has a service running as dotnet core(C#, on linux. I originally wanted to go with java/scala - but the guy i am doing it with couldn&#39;t quite get into java from a C# background, no idea why, anyway), its self contained and released as a docker container, the reason why we chose that is the awesome generics in C#, it was easy to map our entire model in it, we have migrations with EF, the restful controllers are easy to maintain and the testing frameworks seem nice enough. Now we needed a webserver aswell, and it didn&#39;t need a good ORM, generics etc. So i started to look around and i hadn&#39;t tried Go at this point, i just looked around the programming community for an alternative to C#, and its mainly Java/scala, Node.js, php, ruby, python and the other huge languages, and honestly there wasn&#39;t any of those that i really wanted to work with. Now, my first encounter with Go, i have been an avid Vim user for a bit more than 1 year now, and i love it, when i joined golang a few weeks ago and realized that alot of people actually develop with vim in this environment i googled their setup, i installed neovim, vim-go, deoplete, deoplete-go and it is freaking awesome, i have never had intelligent autocompletion in Vim before, jump to declaration etc. and it just makes a world of difference when you combine a simple programming language with the power of vim, and at the same time you feel like youre not too far from the steel either, then it also auto indents your code in a specific way everytime you save the file(so awesome), easy to generate HTML from the docs you write, type-safety, the project structure is very UNIX like(and clever in the sense that it structures your project based on source control structure(hadn&#39;t thouth of doing that before Go). On the other side we had C#, which is &#34;fine&#34; i suppose with its View in the MVC pattern but its never something that blew me away, i think i spend most of my time just copying documentation when i write in C#, everything is just so laid out for you, which is nice when you need to get the job done. But if you want a code flow that is not interrupted all the time of frameworks, online docs and perceived best practices - its very liberating to just jump into Go and code, if you call a method from the std library, you can jump to its implementation and actually understand what it does. And of course, Go is opensource, which just makes a world of difference when talking about tooling, editor support etc. i am allways surprised when i see a successful opensource project in C#, i dont know why, it just seems so unnatural to me, why anyone would spend so many hours improving a companys product without them being paid for it. I just think that alot of it boils down to the UNIX feel vs the Microsoft feel - and some people just like one over the other, and i am 100% for the way of developing on UNIX, in general i think its more programming oriented, while microsoft has a whole market of casual users they have to take care of. </p></pre>abotalot: <pre><p>you have conjured the great <a href="http://i.imgur.com/C4Oao7G.png" rel="nofollow">alot</a>!</p> <hr/> <p><em><sup><sup>#bot</sup></sup></em><br/> <em><sup><sup><sup><sup><sup>If</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>you</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>would</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>no</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>longer</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>appreciate</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>occasional</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>alot</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>conjurings</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>in</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>replies</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>to</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>your</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>comments,</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>PM</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>me.</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>Also,</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>if</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>you</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>are</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>a</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>mod</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>or</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>admin</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>and</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>want</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>them</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>excluded</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>from</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>certain</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>subreddits,</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>please</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>PM</sup></sup></sup></sup></sup> <sup><sup><sup><sup><sup>me</sup></sup></sup></sup></sup></em> </p></pre>lucaspiller: <pre><p>Well that&#39;s random...</p></pre>weberc2: <pre><p>The OP was writing &#34;alot&#34; instead of &#34;a lot&#34;. The former is not a word in the English language, but a common typo. Evidently this bot is &#34;conjured&#34; by said typo.</p></pre>PaluMacil: <pre><p>I find that .NET is something I need to work with a lot to remain an expert because new frameworks and libraries are always coming out. There is a lot of great stuff there for the taking if you want to integrate with Active Directory, and I love ASP.NET and Active Directory Services. That said, Go is nice because it&#39;s simple enough that I can use it as a hobby. I&#39;d enjoy a job writing only Go, but I don&#39;t need one to keep up on the language. Where C# adds tooling, new syntax, and flexible features, Go instead tends to stay readable, understandable, and easy to leave and return to. Sometimes the explicit nature costs a few more lines of text, but it&#39;s a fantastic feeling. I find myself nearly never lost in a complicated codebase in Go where C# can hide a lot with its magic. I love both, and I feel no reason to choose between them since they both offer a lot of advantages. Both are more or less elegant for different things. I&#39;ve recently been using Angular 2 with Go, so I don&#39;t use the Go templating much but really enjoy making the APIs in Go. Microsoft&#39;s Web API framework is also wonderful, but even now that I know it well, the magic is sometimes too thick for my tastes. Core is fantastic, but still different pros and cons between them all.</p></pre>metamatic: <pre><p>Because I don&#39;t use Windows, and right now .NET&#39;s promises to be fully cross-platform are just that -- promises.</p></pre>jewishobo: <pre><p>I have production C# code running inside Docker containers on linux. It is already here.</p></pre>ultra_brite: <pre><p>.net core runs perfectly on linux.</p></pre>shadowmint: <pre><p>ha! Says a soul who wasn&#39;t tried actually doing that I&#39;m guessing.</p> <p>You can <em>technically</em> compile and run some things, and even use some nuget packages, but you can&#39;t use nuget 3.* yet, and many things don&#39;t quite work; the package.json format is depreciated and the new format isn&#39;t fully supported yet.</p> <p>Once Rider is out of EAP and doesn&#39;t crash any more (to be fair, it only crashes about 3 or 4 times an hour at the moment) at least there will be a compelling IDE story for it, but its <em>certainly</em> not there yet, and &#39;runs perfectly on linux&#39; is flat out not true. Try it. You&#39;ll immediately see that it&#39;s far from perfect.</p> <p>Its usable; barely, but definitely usable. You&#39;ll want to wait at least a few months before betting on it as a platform though. I don&#39;t think there&#39;s any real decision on the .Net standard vs. .Net core yet is there? </p></pre>ultra_brite: <pre><blockquote> <p>ha! Says a soul who wasn&#39;t tried actually doing that I&#39;m guessing.</p> </blockquote> <p>I have several .net core apps deployed on Heroku + MVC.net + postgres without a single issue. Maybe you should actually try to deploy .net core.</p></pre>shadowmint: <pre><p>/shrug</p> <p>Lucky you.</p> <p>All I can say is, my experience in no way mirrors that.</p> <p>I&#39;ve had dozens of problems with nuget DLLs, restoring packages, running applications, compatibility problems. </p> <p>I 100% recommend anyone who is thinking about using .net Core on linux: DONT.</p> <p>Wait until the dust settles, rider is out and things actually work.</p> <p>I think the number of open issues on the dotnet/* github repos speak for themselves in terms of &#39;works perfectly&#39;. </p></pre>jewishobo: <pre><p>I am running production .NET Core code, it&#39;s a perfectly viable 1.0 release. But if you get into it, you have to remember it is 1.0.</p></pre>jewishobo: <pre><p>Everyone please stop downvoting this. There is no reason why we can&#39;t acknowledge .net core works on linux today, because it does. Golang is still a great option, it&#39;s not competing with .net core, there is room for both.</p></pre>dcormier: <pre><p>Really, <a href="/r/golang" rel="nofollow">/r/golang</a>? Downvotes for contributing to the conversation? I expected better.</p></pre>MALE_SHOEGAZE: <pre><p>Congrats on your several apps, that&#39;s clearly evidence that .net works perfectly for everyone on linux.</p> <p>Also evidence that you&#39;re a tool.</p></pre>st1nc1ty: <pre><p>We should downvote this comment, not the one above.</p></pre>RagingAnemone: <pre><p>My guess the downvotes are because the use of the word &#39;perfectly&#39; is very fanboyish. I haven&#39;t used it, so I&#39;m in no position to judge, but it&#39;s hard to imagine a 1.0 release would be &#39;perfect&#39;. Of course, there isn&#39;t any software anywhere that I&#39;d call perfect.</p></pre>st1nc1ty: <pre><p>That&#39;s completely ridiculous.</p></pre>MALE_SHOEGAZE: <pre><p>The guy is declaring, completely unqualified, that .net works perfectly on linux. That&#39;s absurd. He&#39;s also being a dick about it. Are you under the impression that &#34;maybe you should actually try to to deploy .net core&#34; is a thing people say in good faith? Because it isn&#39;t.</p> <p>So he&#39;s wrong, and he&#39;s a dick. I don&#39;t really feel bad for calling him out on it.</p> <p>e: christ I just took a gander through my own comment history and I think <em>I</em> might be a dick.</p></pre>metamatic: <pre><p>Right, but since that&#39;s just console apps, what&#39;s the advantage over Go?</p></pre>jewishobo: <pre><p>Visual Studio, generics, more enterprise integrations.</p></pre>metamatic: <pre><p>There&#39;s no Visual Studio for Linux, and since our enterprise systems aren&#39;t Windows I&#39;m fine with what Go offers.</p></pre>xiegeo: <pre><p>If you are not felling any pain points developing in .Net, then I don&#39;t see why you should switch. You can just learn Go for fun and not use it for work.</p> <p>For me, I never got to much into the .net platform and don&#39;t feel the need to as Go covers my needs. Microsoft does have some very good developer tools, but I&#39;m not going to switch platform just for the tools.</p></pre>PsyWolf: <pre><p>I&#39;d call it a matter of preference. .NET can be easy, but go is simple.</p> <p>If you want all the features, in a massive monolithic framework/toolset that insists on doing all sorts of black magic at runtime, like having settings in your applications config file get overridden by some other setting in a machine level config file, then .NET is for you</p> <p>If you want your team to never update their software, because it just works now and when they change the framework, they spend hours trying to get it to build and run again before giving up and going to the one person who actually understands all the subtle differences and breaking changes between each version, then .NET is for you.</p> <p>If you want a magic build button in your ide that just works, but is subtly different than the msbuild job used in your continuous integration, and leaves your devs tearing their hair out wondering why the same exact code results in 2 drastically different build outputs, then .NET is for you.</p> <p>On the other hand, if you want a very small set of orthogonal features that stay out of your way, let you do your job, and provide as little magic as possible, then maybe you should check out Go.</p> <p>Disclaimer: I actually quite like C# as a language, it&#39;s just .NET that I have issues with. I know Microsoft lifers who learn enough about .NET to be very productive with it. However, the &#34;ease&#34; of .NET also breeds a whole other, more common class of developers who learn enough to write code, but not enough to actually understand how the tooling builds it and the framework runs it. Eventually, it just gets very hard to maintain.</p> <p>As a polyglot, I want a language that my team and I can pick up and be productive with, leave alone for 2 years, and then pick up where we left off without the ecosystem having totally shifted out from under us. IMO C# has never been that language. Go is.</p></pre>jocull: <pre><p>I have probably lost years off my life spending time fiddling with web.config and app.config files. The amount of XML and magic is astounding under the guise of being &#34;easy&#34;. More tools should exist that take the ceremony out of .NET development.</p></pre>SQLServerIO: <pre><p>my reasons for choosing golang <a href="http://sqlserverio.com/2016/08/17/go-go-golang/" rel="nofollow">http://sqlserverio.com/2016/08/17/go-go-golang/</a></p></pre>salbass175: <pre><p>MsSql is one thing from MS I love, trust, and will always defend. It ain&#39;t perfect, but it has rarely let me down. I&#39;ve built so many systems that live on top of it...</p> <p>Let me ask you, do you interface much with sql server from Go? If so, how has that been working for you?</p></pre>mobiledevguy5554: <pre><p>I am using this github.com/alexbrainman/odbc for SQL Server in go and its working beautifully. Go is fast and everything &#34;just works&#34;</p> <p>The standard library probably has about 98% of what you would need to build a web app back end.</p> <p>The only real issue i&#39;ve had is the lack of multiple results sets from SQL Server stored procedure support. This is arriving in Go 1.8</p></pre>jocull: <pre><p>Have you touched geometry support with that? That&#39;s a weird one I worry about.</p></pre>SQLServerIO: <pre><p>I&#39;ve been using <a href="https://github.com/denisenkom/go-mssqldb" rel="nofollow">https://github.com/denisenkom/go-mssqldb</a> with patches for bulk inserts. I find that it is pretty easy to work with and performs well. I&#39;m trying to make time to finish out some of the bits that are needed for bulk insert to support all data types.</p></pre>pinpinbo: <pre><p>I think it depends if the cost-benefit analysis makes sense to you. I don&#39;t see anything that .Net can, but Go cannot do.</p> <p>Go language spec is very small, 2-3 weekends and that&#39;s it. You are good to go. To me, that&#39;s a strength.</p> <p>Also, how&#39;s deployment story in .Net Core? Do you need to install a VM on every box? If it&#39;s anything like Java, there&#39;s an upgrade cost there that you don&#39;t have to pay in Go.</p></pre>mobiledevguy5554: <pre><p>Prior to the release of .Net core the obvious answer was Go. Now, i&#39;d say it depends. If you have people with .net experience already it makes sense to go to .net</p> <p>If you do a traditional MVC server rendering approach then .Net may also be a better choice.</p> <p>If you are doing most of your front end work in a SPA framework like Angular 2 or React/Flux and your Web App Server is effectively serving up static pages with REST API calls then I think go is an excellent choice.</p></pre>whizack: <pre><p>I would pick Go over .Net if there was genuine interest or experience within your team working in a polyglot environment. </p> <p>Go doesn&#39;t solve every problem. Some problems are easier to solve in Scala, Python, Ruby, etc. If your team&#39;s experience providing valuable code feedback is only in .Net, it&#39;ll be a long, uphill battle to get your team to the point where they can provide insight into good idiomatic patterns and behavior for your domain.</p> <p>If the long term desire is to start using other languages to solve problems within your domain, then I&#39;d suggest branching out into solving problems with scripting/dsl solutions first before transitioning core development to a different systems language.</p></pre>65a: <pre><p>portability for me.</p></pre>Sythe2o0: <pre><p>I enjoy coding Go more than I enjoy coding in .Net myself. </p></pre>NeverUse-YouPromised: <pre><ul> <li>C# is too Windows-centered.</li> <li><a href="https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=csharpcore&amp;lang2=go" rel="nofollow">Go has better performance on several benchmarks.</a></li> </ul></pre>tscs37: <pre><p>Go likes being on a distributed (or atleast any) service system like a webserver or a database. That&#39;s where Gophers feel at home.</p> <p>Or the command line.</p> <p>C# on the other hand is probably the next best thing to z***** for developing a GUI client.</p> <p>That&#39;s atleast my take on it; Go for CLI and Servers, C# for GUI (on Windows).</p></pre>salbass175: <pre><p>That&#39;s been my experience as well. I&#39;ve tried building comparable web apps using Go similar to what I&#39;ve done with the MS stack, and IMO I found it lacking and nowhere near as productive. Templating was particularly ugly. </p></pre>SYN_SYNACK_ACK: <pre><p>then that&#39;s the answer you&#39;re looking for.<br/> If you don&#39;t like the way go does those things and you feel more productive using something different then maybe go isn&#39;t for you?!</p></pre>Fireynis: <pre><p>Templating, especially for the web, is nowhere as nice as many other web based frameworks. I use go as everything right now and that is my biggest gripe.</p> <p>I plan on making go the brains of my web app, but have something else do the front end, whether that will be Angular/React/Vue or something like Laravel acting between I don&#39;t know yet.</p></pre>mobiledevguy5554: <pre><p>There isn&#39;t much server side templating going on in a SPA app like Angular 2 though so unless you are doing a lot of server side rendering i&#39;m not sure this is a big deal.</p> <p>Personally, I didnt find the Go templating that difficult to use when I needed to use it.</p></pre>comrade-jim: <pre><p>Do people still get paid to build new desktop apps?</p></pre>tscs37: <pre><p>No, everyone develops Electron-Apps now.</p></pre>itsmontoya: <pre><p>If a particular language can be used to build a requested project in a manner that is performant and maintainable, who cares what language it is?</p></pre>apocalypse910: <pre><p>I don&#39;t get this - the difference is night and day... I mean you can write perfomant and maintainable code for nearly any task in nearly any language if you know what you are doing but that doesn&#39;t mean there isn&#39;t a huge difference in the effort involved and the enjoyability of getting there...</p> <p>If the question was just a - &#34;What is better C# or Go?&#34; I could see your position - arguing languages as a whole is rarely useful... But specifically looking for strengths and weaknesses and a reason to invest in a new language or platform seems like an extremely valid question.</p></pre>jrwren: <pre><p>.NET Core is ~1yr old. Its base library and the OSS ecosystem around it looks like that of a project of about 1yr.</p> <p>Go is much, much more mature.</p> <p>BUT WAIT! Let me take a step back.</p> <p>Go was not written to solve any of these problems. Nothing in your OP is mentioning the reasons Go was written. The concurrency model is secondary to the two primary Go objectives. 1: compile fast. 2: save programmers from themselves.</p> <p>1: Is your .net/C# codebase so large that the compile times are a problem? No? Strike one, Go is not for you. (<a href="https://golang.org/doc/faq#What_is_the_purpose_of_the_project" rel="nofollow">https://golang.org/doc/faq#What_is_the_purpose_of_the_project</a>)</p> <p>2: Is your programming team made up of only average and below average programmers? No? Striek two, Go is not for you. (<a href="http://nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/" rel="nofollow">http://nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/</a>) </p></pre>salbass175: <pre><p>Um...regarding #2...Really? Great attitude. And quite contradictory being that one of Go&#39;s main selling points is how small of a language it is and how easy it is to pick up.</p></pre>Morgahl: <pre><p>Yeah honestly not sure why #2 was even included... </p> <p>Go was built to favor simplicity as a function of design. You should be able to look at a any section of code and be able to impliciy understand it. This leads to an interesting dynamic. In Go I find I take about 25% longer to write an equivalent section of code then most other languages, however, I find that time spent maintaining that same code is 2-3 times less expensive. All that simply due to the fact that in Go you tend to be able to hold the full concept of what is happening in your head with room to spare.</p> <p>Go tends to favor simple and clear over clever coding and that is HUGE for million+ line code bases. </p></pre>Redundancy_: <pre><p>My experience jives in that I&#39;ve frequently worked with programmers who were not all experienced geniuses, but I&#39;ve also worked with academics who couldn&#39;t code maintainable (or sometimes even working more than once) code, and some experienced geniuses who could solve any problem, but not necessarily in a way that anyone else could work on. It has sometimes seemed like great programmers who write selfless code are a minority.</p> <p>Regardless of how hot you think you (or others) are as a programmer, I think that you&#39;re better off writing code that&#39;s easily maintained by anyone who might follow you in the minimum amount of time, and Go can help do that (although not enforce), not just in terms of the simple language, but also in terms of the no hassle code documentation and testing.</p> <p>I quite like the saying &#34;Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.&#34; and feel like Go helps to point you in the right initial direction for that and good sensibilities and habits can take you the rest of the way.</p></pre>jocull: <pre><p>I believe the Go designers even cite junior Google devs as a primary use case for Go. It tried to keep you from doing anything &#34;fancy&#34; in order to minimize foot shooting.</p></pre>

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

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