TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The ups and downs of porting 50k lines of C++ to Go (2015)

178 pointsby aparashkabout 6 years ago

20 comments

chewxyabout 6 years ago
&gt; Readability. I always found the Go code I encountered quite easy to read and understand, both our code and external code. Some of the C++ I encountered, in contrast, took hours to fully comprehend. Go also forced me to write readable code: the language makes it impossible to think something like “hey, the &gt;8=3 operator in this obscure paper on ouroboromorphic sapphotriplets could save me 10 lines of code, I’d better include it. My coworkers won’t have trouble understanding it as the meaning is clearly expressed in the type signature: (PrimMonad W, PoshFunctor Y, ReichsLens S) =&gt; W Y S ((I -&gt; W) -&gt; Y) -&gt; G -&gt; Bool”.<p>This sentence is gold J
评论 #19386443 未加载
评论 #19386211 未加载
评论 #19386364 未加载
RhodesianHunterabout 6 years ago
Coming from JVM languages, it drives me nuts that I can&#x27;t .map&#x2F;.filter&#x2F;.foreach&#x2F;.reduce etc. my collections, especially with something like streams&#x2F;sequences. That&#x27;s where you really notice the lack of generics if you&#x27;re used to this sort of programming.
评论 #19386784 未加载
评论 #19387030 未加载
评论 #19388904 未加载
评论 #19387087 未加载
评论 #19387372 未加载
评论 #19386366 未加载
ilovecachingabout 6 years ago
I personally love Rust and think Rust is the future for C and C++, and use it professionally. But Go is simple, fun, fast, and easy to read and frankly more approachable by the people many companies can afford to hire.<p>I view language choice as a line. If I need to build big, or build niche, or build fast, I use Rust. But if it’s general purpose I use Go. I can write Go faster than I can write Python because the type system gives me a fast feedback loop and the language is simple and builds in the common case building blocks. I can get better performance and understand my app better than with the JVM because it’s compiled ahead of time and I already know the ins and outs of Linux. There is no black box JVM that consumes resources while idling.<p>Go has advanced the state of formatting, documentation, and revitalized the Unix philosophy of building small, focused pieces without getting caught in the clouds over abstracting.<p>If you are currently using a Python, Java, C#, or JavaScript, Go is better. Just don’t post angrily to your blog until you’ve written Go while also embracing its philisophy and taking the time to understand the authors intentions.
评论 #19389189 未加载
评论 #19388165 未加载
评论 #19387513 未加载
评论 #19387316 未加载
评论 #19397375 未加载
评论 #19387346 未加载
评论 #19390415 未加载
tschellenbachabout 6 years ago
Switched from Python to Go about 2 years ago. If you need to build performant APIs with a small team there is nothing that comes close. You get the productivity of something like Python with the performance of C++. Or at least very close to it in both cases. (<a href="https:&#x2F;&#x2F;getstream.io&#x2F;blog&#x2F;switched-python-go&#x2F;" rel="nofollow">https:&#x2F;&#x2F;getstream.io&#x2F;blog&#x2F;switched-python-go&#x2F;</a>)<p>The lack of generics hasn&#x27;t bothered me so far. You just find different solutions to the problem. Composition, interfaces, or if all else fails an empty interface{}. It&#x27;s rare to really not be able to work around it. It does make it near impossible to build reusable and performant data structures in Go though. (say that you want to build your own heap or list, hashtable etc.) So that&#x27;s annoying, but something that you rarely run into.<p>Bigger issue is that GO modules are still not ready for production since the ecosystem didn&#x27;t catch up: <a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;24661" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;issues&#x2F;24661</a>
评论 #19386298 未加载
评论 #19386341 未加载
评论 #19387363 未加载
评论 #19386453 未加载
评论 #19388187 未加载
评论 #19386947 未加载
评论 #19388925 未加载
评论 #19386613 未加载
nayukiabout 6 years ago
This HN item links to the blog&#x27;s front page. The actual article is at <a href="https:&#x2F;&#x2F;togototo.wordpress.com&#x2F;2015&#x2F;03&#x2F;07&#x2F;fulfilling-a-pikedream-the-ups-of-downs-of-porting-50k-lines-of-c-to-go&#x2F;" rel="nofollow">https:&#x2F;&#x2F;togototo.wordpress.com&#x2F;2015&#x2F;03&#x2F;07&#x2F;fulfilling-a-piked...</a>
networkimprovabout 6 years ago
For anyone bothered by Go&#x27;s simplistic error handling, a menu of <i>Requirements to Consider for Go 2 Error Handling</i>:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;networkimprov&#x2F;961c9caa2631ad3b95413f7d44a2c98a" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;networkimprov&#x2F;961c9caa2631ad3b95413f...</a><p>See also the Go 2 Draft Design feedback wiki:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;wiki&#x2F;Go2ErrorHandlingFeedback" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;go&#x2F;wiki&#x2F;Go2ErrorHandlingFeedback</a>
rienbdjabout 6 years ago
After switching to ML languages for most development tasks, I don’t think I could face using a language with so few features.<p>Is most of the hype from a dev ops perspective? Go looks tiresome to program in.
评论 #19387469 未加载
评论 #19388134 未加载
johnvegaabout 6 years ago
I&#x27;m a C++ programmer for over 10 years and looking forward to becoming a Go programmer, professionally.
dangabout 6 years ago
Discussed at the time: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9161366" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9161366</a>
agentofoblivionabout 6 years ago
I wonder how Dlang would have compared.
评论 #19387206 未加载
herfabout 6 years ago
&gt; he expected the language to be adopted by C++ programmers, a prediction that hasn’t been realised<p>I respect go (and its runtime) a lot, but one little thing keeps me from using it: the reverse &quot;argument type&quot; ordering (backwards from C++) makes me avoid it. If this were the only language I used, it would be easy, but when switching back and forth, does anyone else find it hard to do?
评论 #19387889 未加载
评论 #19386582 未加载
评论 #19386571 未加载
steschabout 6 years ago
Link to the article instead of the blog: <a href="https:&#x2F;&#x2F;togototo.wordpress.com&#x2F;2015&#x2F;03&#x2F;07&#x2F;fulfilling-a-pikedream-the-ups-of-downs-of-porting-50k-lines-of-c-to-go&#x2F;" rel="nofollow">https:&#x2F;&#x2F;togototo.wordpress.com&#x2F;2015&#x2F;03&#x2F;07&#x2F;fulfilling-a-piked...</a>
kristianpabout 6 years ago
&quot;one of my reasons for getting into programming was the opportunity to get paid to use Emacs&quot;.<p>Not a reason for getting into programming that many have, I expect!
alfalfasproutabout 6 years ago
Wow, I&#x27;m surprised to see the typical &quot;Well, why didn&#x27;t you just use Rust&quot; comment hasn&#x27;t been posted.<p>At the end of the day, it sounds like they just had some clunky C++ code that was due for a rewrite anyways (and the author admits as much). If you don&#x27;t need it to be ultra low latency, some nice abstraction and modularity can already do wonders.<p>I&#x27;ve found Go to be an excellent Java replacement when all is said and done. Great for the vast majority of services you might write. But if you need to do anything lower level or that involves complex type logic you always end up with a clunky solution (and I&#x27;m not going to sing any praises for C++ having an elegant solution either).<p>That said, modern C++ (especially 17) can be made to look decently clean and without weird behavior in most cases. Yes, there&#x27;s always the person that shows up and points out weird edge cases that you can run into but the situation is far, far better than it was years ago. With some good engineering practices in encapsulating low level optimized code you can largely limit the &quot;danger surface&quot; of your codebase.
评论 #19387322 未加载
评论 #19387185 未加载
评论 #19387907 未加载
评论 #19387777 未加载
wglbabout 6 years ago
Article from 2015.
arthurcolleabout 6 years ago
Ups and downs?
atomicalabout 6 years ago
Occasional pauses of 400-500 milliseconds? How would one mitigate that when coding a restful API server?
评论 #19386247 未加载
评论 #19386240 未加载
评论 #19386670 未加载
PudgePacketabout 6 years ago
&gt; Posted on March 7, 2015
评论 #19385966 未加载
visvivaabout 6 years ago
Four years old and the typo in the title still hasn&#x27;t been fixed?
评论 #19386165 未加载
jonduboisabout 6 years ago
&gt;&gt; The worse the abstraction that you and your colleagues are likely to use, the better a language is Go<p>I feel the same way about most statically typed languages. They&#x27;re designed for developers who aren&#x27;t good at coming up with abstractions. Basically, they&#x27;re great for junior developers. For senior developers, they just give you more work and slow down progress.<p>On my last project (statically typed language), we had to do a refactoring of a decent portion of the code just because it allowed us to use one interface&#x2F;type instead of two related interfaces&#x2F;types (one inheriting from the other). It didn&#x27;t fix any bugs, make it more maintainable or even change the external behaviour at all.
评论 #19387623 未加载
评论 #19387801 未加载
评论 #19387791 未加载
评论 #19387879 未加载
评论 #19388334 未加载
评论 #19390941 未加载
评论 #19387820 未加载