TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Less is exponentially more (2012)

67 点作者 tpaschalis大约 5 年前

20 条评论

nshepperd大约 5 年前
&gt; Early in the rollout of Go I was told by someone that he could not imagine working in a language without generic types. As I have reported elsewhere, I found that an odd remark.<p>&gt; ...[rant about &#x27;inheritance&#x27; and &#x27;subclassing&#x27; and &#x27;hierarchies&#x27;]...<p>&gt; If C++ and Java are about type hierarchies and the taxonomy of types, Go is about composition.<p>How do you get all the way through designing a programming language without realizing how incredibly wrong-headed this is? &quot;Inheritance hierarchies are bad&quot;, so... you exclude generics (which are compositional, and have nothing to do with inheritance), and only support subtyping polymorphism via &#x27;interfaces&#x27; (ie. inheritance)? That is the exact opposite of his claimed principles!<p>(And then as a minor concession to programming usability, he adds generics anyway, but <i>only</i> for built in types (maps and arrays), so advanced data structures are still an exercise in void* wrangling.)
评论 #23155627 未加载
评论 #23157531 未加载
评论 #23155607 未加载
hyperman1大约 5 年前
A few years ago I started to play with go. First impression was great. But a month or so in I started to having more and more doubts. As a Java&#x2F;C++ programmer I was missing especially the generic collections. Slice and map are a good start, but not enough.<p>Then one day I had to implement the swap operation for sorting. Again. And I thought that even C&#x27;s qsort was better, and WTF am I wasting my time on this half-assed language. I dumped it, tried rust, and even with its slow compile times I couldn&#x27;t be happier.<p>Now a few releases later, they fixed sort so I can only implement compare. Sorry, it&#x27;s not nearly enough. Essential parts are simply missing. Exhibit A is source code generation, a clear indication go isn&#x27;t enough on its own. I&#x27;m not working with an ecosystem where my human time is less important than the language philosophy. I want to express a repetitive pattern in the language, and then never think about dumb bureaucratics again.<p>It was a near miss, though. SOme things are clearly correct. I want to look again when they finally have generics, and some basic collections. I hope that day comes and I can give it a new chance. But until then, less was simply not enough .
评论 #23154817 未加载
评论 #23154503 未加载
评论 #23160841 未加载
评论 #23154539 未加载
nobleach大约 5 年前
While this philosophy has a lot of value, it just isn&#x27;t for me. I did a few apps in Go, and fought my way to a decent level of proficiency. I got to a point where I could solve some problems without constantly consulting the docs. But in the end, I wasn&#x27;t enjoying the experience. The speed was great, the compilation was great. All the selling points were true. But it was missing so many things that I enjoyed using from other languages. (Mostly methods for dealing with collections of data - everything in Go is a for loop). I did another project in Kotlin shortly after and wow, that language has everything AND the kitchen sink! But, I truly enjoyed myself more while working with it. So, this is not me saying Go is &quot;bad&quot;. It&#x27;s actually quite good. It&#x27;s just not something I enjoy.
评论 #23154589 未加载
评论 #23154592 未加载
评论 #23154870 未加载
free_rms大约 5 年前
Pike&#x27;s take is pretty unfair to C++11, given how ideas like &#x27;rvalue references&#x27; held up REALLY well.<p>Yes, they were introducing even more complexity to a complex language, but how else are they supposed to incorporate better ways of doing things while maintaining backwards compatibility?<p>I suppose one could always just build a new language that doesn&#x27;t have the historical cruft, but in this case that&#x27;s Rust and not Go.
ses1984大约 5 年前
&gt;Programmers who come to Go from C++ and Java miss the idea of programming with types, particularly inheritance and subclassing and all that. Perhaps I&#x27;m a philistine about types but I&#x27;ve never found that model particularly expressive.<p>Whoa, hold it there... inheritance and subclassing are OOP, types is a different subject, right?
评论 #23154309 未加载
评论 #23154889 未加载
评论 #23154524 未加载
acarl005大约 5 年前
Whenever the topic of generics comes up, especially in Go, things seem to devolve into a ragefest about inheritance and OOP. Why? I don&#x27;t want the mess of inheritance any more than the next chap. I just want generics for algebraic types—a single definition for a List, Set, Map. I wish the error-handling looked more like Rust&#x27;s Result type instead of the double-return idiom. Algebraic types alone (without inheritance) make things an order of magnitude more expressive.
评论 #23155328 未加载
MereInterest大约 5 年前
For any new language that I learn, my go-to thing to try is to implement 4th-order Runge-Kutta solving of an ODE. This implementation must be usable for both built-in types and user-defined types, and must have reasonable performance for the language.<p>* C++, easily doable with templates.<p>* Python, easily doable with duck typing.<p>* Rust, doable, though with some restrictions. I needed to require the derivative function to return the same type as its input, rather than returning something that can be scalar multiplied and added to the same type as the input.<p>* Java, not possible. Adding&#x2F;multiplying of built-in types can be done with + and * , but user-defined types require .add() and .multiply()<p>* Go, not possible. Go doesn&#x27;t support generics, and I&#x27;m certainly not going to copy&#x2F;paste a numeric method once for every system that I examine. Also, same issue as Java with no operator overloading.<p>Complexity has to go somewhere. By aiming for a simple language, Go forces the complexity to be in the developer side instead.
FpUser大约 5 年前
<i>&quot;People who are excited about C++11&#x27;s new features are not going to care about a language that has so much less. Even if, in the end, it offers so much more.&quot;</i><p>I find Go too limiting and definitely not offering &quot;so much more&quot;. The author is probably right mentioning &quot;big teams&quot;. Sure if I have whole shebang of programmers each nibbling at small particular task and appropriate budget it will work. But comparing the amount of work per developer per time I can have with more sophisticated &quot;traditional&quot; languages does not put Go in any good standing in my opinion.
greendave大约 5 年前
&gt; What you&#x27;re given is a set of powerful but easy to understand, easy to use building blocks from which you can assemble—compose—a solution to your problem. It might not end up quite as fast or as sophisticated or as ideologically motivated as the solution you&#x27;d write in some of those other languages, but it&#x27;ll almost certainly be easier to write, easier to read, easier to understand, easier to maintain, and maybe safer.<p>I really like go, and I daresay it makes many things easy to implement and understand, but I do find the flexibility&#x2F;lack of sophistication allows one to end up writing what amounts to improved C. Great for smaller projects, but surprisingly difficult to manage as it grows.
pot8n大约 5 年前
Golang didn&#x27;t succeed because it is simple or powerful or any of the, I apologize, nonsense your hear from the Gophers. Golang succeeded because it was the only available relevant option and alternative to the aging Python and Java when the cloud took off in the early 2010s.
评论 #23155183 未加载
评论 #23154862 未加载
评论 #23155436 未加载
评论 #23154629 未加载
oftenwrong大约 5 年前
This does a poor job of justifying the claim that golang is more expressive despite having fewer features than similar languages. I agree to a certain extent that golang&#x27;s simplicity is an advantage. However, its simplicity does actually make it less expressive.<p>For example, in Java one can trivially create a class like `Maybe&lt;T&gt;` with a method `Maybe&lt;R&gt; map(Function&lt;T, R&gt; mapper)`. This can be used with any classes filling in the parameters. I believe golang is unable to express this.
smoorman1024大约 5 年前
I&#x27;ve been working in golang professionally for about a year now coming from a long career in C++. Although there is some simplicity to golang that can be appreciated things like this below make me think that the premise of less is more is fundamentally incorrect if you cannot accomplish everything that is necessary.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;protocolbuffers&#x2F;protobuf-go&#x2F;blob&#x2F;master&#x2F;internal&#x2F;pragma&#x2F;pragma.go#L29" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;protocolbuffers&#x2F;protobuf-go&#x2F;blob&#x2F;master&#x2F;i...</a><p>Specifically the last one of embedding an empty array of mutexes into a struct prevents that struct from being copied. This is something that is easily and explicitly accomplished in C++ by making the constructors private.
api大约 5 年前
I love Go for this reason. It minimizes it&#x27;s own cognitive load, freeing the mind to spend more time thinking about being clever solving the problem rather than being clever with the language.<p>I also adore goroutines and miss them in any other language. They are really fibers and let you do light concurrency without fiddling with async constructions. Async programming is just an ad hoc way of implementing fibers, and it imposes more cognitive load because now you have two different approaches to every problem in the same language (one async, one not).<p>IMHO minimizing language-imposed cognitive load should be a core goal of any programming language. Human brains are finite, and programmers should spend the majority of their mental energy thinking about the problem being solved not the language.
评论 #23159655 未加载
vorpalhex大约 5 年前
I code in Javascript&#x2F;Node, and I also code in Go. They&#x27;re both very useful tools and they&#x27;re useful in different ways. I find Go to be a good tool when I know what I&#x27;m writing and I have clear forms in each step.
jasode大约 5 年前
Previous discussion since the HN &quot;past&quot; link doesn&#x27;t bring up the prior thread because tld was &quot;.de&quot; instead of &quot;.com&quot; : <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6417319" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6417319</a>
DLA大约 5 年前
I&#x27;m going to jump in and take a hard Pro-Go stance. Based on experience developing for more than 5 year with Go and deploying systems around the world--in-house hosted and cloud.<p>I have immensely enjoyed the &quot;less is exponentially more&quot; philosophy with Go. In Go there is one or a small number of way to do something. Contrast that with C++ where there are any number of ways to do something and at least as many styles of coding. Too much choice results in complexity.<p>IMO the generics debate is overblown. The systems I&#x27;ve build with go tend toward heavy data processing (ETL, correlation, extraction and the like) and service (JSON APIs supporting front-ends; event some front ends with Go Templates). Never once was I like &quot;my life sucks because I don&#x27;t have generics.&quot; Fair and balanced: Processing JSON in Go takes some getting used to, especially when the JSON structure changes. However, there are some good libs to help. It&#x27;s just a friction point given the typed nature of Go.<p>The operational simplicity of Go cannot be overstated. Go&#x27;s production of a deployable binary with zero dependencies is a blessing. There&#x27;s an amazing deploy tool you can use called: cp. Compare that to the library version hell that is C++ (and I&#x27;m also a C fan and very experienced dev). No. Thank. You.<p>The cross compilation of Go code works beautifully. Just 2 weeks ago I had to demonstrate a tool to a customer and due to COVID it was virtual. We had problems with MS Teams connecting to our dev platform so literally 15 minutes before the demo I cross-compiled to a Win binary and moved it to the machine hosting the Teams call. Victory.<p>Because of go fmt, <i>all</i> Go code looks the same. That&#x27;s a massive advantage to read&#x2F;understand&#x2F;use OPC (other people&#x27;s code). Ditto for the automatic documentation generation -- it looks the same and behaves the same across Go projects.<p>I abhor the Java ecosystem for so many reasons I just don&#x27;t have the energy to go into. It&#x27;s my opinion, so not up for debate. If Java works for you, by all means have at it. Robust solid technology for sure. Not hating here; just choosing.<p>So, my Go journey has been and continues to be fantastic. It is my preferred platform for pragmatic reasons--the same sort of reasons it was developed by Google in the first place. My team and I can get stuff done quickly. We can scale it. We can leverage all the CPUs on a box running big data processing flows. We can have automatic code-linked documentation and formatted code and can leverage the same from others. We have build in testing. We can make high performance services and servers with ease. We don&#x27;t have to deal with ridiculous configuration nonsense. We get instant compilations. We get great tool support (vscode + Go for the win). We get a batteries very much included stdlib.<p>And most of all we get a platform that understands and managed complexity in a favorable way.<p>$0.02. Ok, maybe $0.05 (inflation).
评论 #23156520 未加载
westicecoast32大约 5 年前
I&#x27;m writing a language. I was wondering what you all suggest it have before you would seriously try it out? I don&#x27;t think most people cares about syntax; does it need to be attached to a large project?<p>The beta of the last language I wrote had maybe half a dozen fans. I threw away the compiler&#x2F;language because I didn&#x27;t really know how to write a compiler back then. I&#x27;m writing a new one now
dang大约 5 年前
See also:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16548684" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16548684</a> (2018)<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6417319" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6417319</a> (2013)<p>Discussed at the time: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4158865" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4158865</a>
abjKT26nO8大约 5 年前
Needs &quot;(2012)&quot; in the title.
kenforthewin大约 5 年前
Please tag this with the date, 2012. Great but old blog post.