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.

"Suppose you need a C++ program to calculate the distance between two points."

2 pointsby davikrabout 1 year ago

3 comments

orduabout 1 year ago
Maybe it is me, but it seems more like a parody showing how not to do things. I believe the easiest way to do it is something like:<p><pre><code> mypoint.coords().map(|x| x * x).sum().sqrt() </code></pre> Instead there are dozens of lines of code adding some obscure constructs with the only goal to hide what happens and without any idea why we need to hide. You can find words &quot;this design rationale&quot;, hinting that somehow this text may explain motivation behind all the complexity, which is also sounds to me as a sarcasm.<p>&gt; Copyright © 2009-2013 Barend Gehrels,<p>Is 2013 the year when C++ people came to their senses and stopped doing that?
sema4hackerabout 1 year ago
Call me a simpleton, but I&#x27;d rather have a simple library routine for the case I&#x27;m handling, even if the library needs lots of routines for all the variations I might run into, instead of one Swiss-army-knife routine that tries to do everything (that will take me so long to understand that I end up just writing the routine I need instead of trying to grok the library).
ttfkamabout 1 year ago
&quot;Suppose you need a C++ program…&quot;<p>No.