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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Code Runs on People

60 点作者 parsecs将近 4 年前

8 条评论

lmm将近 4 年前
I find this kind of exhortation to be useless in practice, because while everyone agrees that code shouldn&#x27;t be too clever, no-one agrees on what kind of code is being too clever.<p>For example, I&#x27;d argue that using C&#x2F;C++ at all is probably &quot;too clever&quot; - humans are good at simulating the happy path, but very bad at simulating all the possible different ways such code might actually be executed. But all too often people are seen as smart and rewarded for &quot;using such an efficient low-level language&quot;.<p>Conversely, I&#x27;d argue that exposing a business constraint as an algebraic datatype that forces you to use it correctly reduces the cleverness required to understand the code.<p>But I&#x27;m sure there&#x27;ll be someone here who thinks the exact opposite, and bringing &quot;cleverness&quot; into the conversation doesn&#x27;t actually bring us any closer to agreement.
评论 #28432035 未加载
评论 #28431938 未加载
评论 #28431358 未加载
评论 #28433645 未加载
评论 #28431671 未加载
dustinmoris将近 4 年前
I agree with the larger point being made, but equally I’m getting a bit tired of statements like these:<p>&gt; “ If it takes an hour to figure out what&#x27;s going on, well, that&#x27;s an hour that wasn&#x27;t spent doing something else more useful and interesting.”<p>What exactly is “doing something else more useful”?<p>As a software engineer your main job (yes I know talking to stakeholders and blah) is to write and to read code. If as a software developer you optimise for writing as little code as possible and not having to spend much time reading code either then what exactly are you working on? It’s great if you’re a solo entrepreneur who wants to optimise their own time, but for most devs reading code for an hour is some of the best use of their time in their daily job.
评论 #28432015 未加载
评论 #28431482 未加载
makeitdouble将近 4 年前
This feels all over the place.<p>Is she ranting against &quot;clever&quot; code ?<p>Or is it about &quot;wicked, nasty, complicated, Klein-bottle-wannabe tricks&quot;, which wouldn&#x27;t fit a &quot;clever&quot; category IMO ?<p>But she mentions &quot;how far they read into the spec&quot;, so these are language features she doesn&#x27;t know about ?<p>Oh, but &quot;Nobody will ever have more state about the code than the original author&quot; so it&#x27;s not about syntax or tricks, but code states and complexity ?<p>What is there to take from this rant aside from her not liking her coworkers&#x27; code each in every possible ways ? I am really not sure to get it.
评论 #28432962 未加载
terracottage将近 4 年前
One person&#x27;s too-clever code is another person&#x27;s attempt to prevent O(N^2) lines of unmaintainable noob code from being added.<p>Problem is, I&#x27;ve seen people with years of experience put this crap in. When you show them how much better it can be, they don&#x27;t tend to take it well. It implies they&#x27;re not the &quot;senior engineers&quot; their resumes claim.
评论 #28432046 未加载
asiachick将近 4 年前
I&#x27;ve run into the opposite issue. I like macro lists in C&#x2F;C++ (not sure what people call them). It&#x27;s the idea that you create a pre-processor list and then use that list to effectively code generate. For example you can use the list to generate enums, enum to string tables, case statements for all cases, etc.... It&#x27;s clever but it&#x27;s also IMO best practice because it prevents bugs. The reason they&#x27;re used is it prevents the various parallel tables from getting out of sync. It&#x27;s also arguably better than some external code generator because there are less dependencies.<p>So, is that a &quot;clever&quot; solution that should be avoided because it&#x27;s &quot;clever&quot; or is it a best practice because it actually solves real problems? Problems which have cost me hours of debugging that could have been avoided if I&#x27;d just used the &quot;clever&quot; solution. For me it&#x27;s the latter.<p>In fact, speaking to the OP, it also encodes the original programmer&#x27;s logic since without them, the new programmer has to know the 4 to 9 places they&#x27;d need to edit to add to the list where as with them they only need to know 1.
评论 #28431492 未加载
nudpiedo将近 4 年前
Some of these articles miss the point: very often an expensive complication comes in order to solve a problem that otherwise would have been much lengthier or expensive to solve.<p>Just as an example: everyone would agree that react is more. Implied than jquery as it has more levels of indirections and abstractions, but it’s strong point has never been to show the cleverness of its authors but to solve state management issues and implement a serie of features otherwise not reachable from previous paradigms. Also for loops where more complex than gotos as they require state (invariant), but today for loops and other forms of loops are widely understood and teach during formal education.<p>New abstractions and indirections aren’t always necessary and when put in place they need additional documentation and training, but nothing of that was mention in the article.
scoutt将近 4 年前
&gt; Nobody will ever have more state about the code than the original author at the time of creation.<p>I would add &quot;including myself&quot;. It always happens when I go back to old code, even if it&#x27;s my own code.<p>It&#x27;s not that I don&#x27;t understand my own code, or the lack of comments. But while coding (at least it happens to me) I have a <i>global awareness</i> state of what is going on, what&#x27;s missing, what&#x27;s failing, where I want to go, etc. You are <i>plugged</i>.<p>Losing and recovering that <i>state</i> is pretty hard and that&#x27;s why (long) interrupts are so annoying.<p>A simpler language like C helps me recovering that state quickly. A mess with templates or 1000 levels of abstraction takes way longer.
a-dub将近 4 年前
code should always be written for other humans. it runs on the machine, but other humans will have to understand it.<p>dogma, in all circumstances, leads to intellectual laziness at best and malpractice as worst.<p>trying to express complicated ideas using simple constructs can result in complicated, verbose and very difficult to understand use of simple constructs. this is why we have complicated constructs, to simplify the expression of complicated ideas.