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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Beyond Clean Code

93 点作者 pbw10 个月前

9 条评论

nateglims10 个月前
Casey Muratori is basically describing Data Oriented Programming. Perhaps the most famous talk about it was from CPPCON 2014 [1]. I come from an embedded background (microcontrollers and bare metal) so I&#x27;m pretty sympathetic to his argument. If you work in it long enough, it feels natural and &quot;clean&quot;. Uncle bob&#x27;s Clean Code probably feels natural to Java devs.<p>Personally, my biggest gripe comes from experiencing people trying to introduce it to a team. Inevitably someone tries to enthusiastically implement some part of it and suddenly are writing 1 line functions everywhere. I think this is the type of thing Casey is also implicitly talking about when he&#x27;s railing against the rules being brought up.<p>[1] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=rX0ItVEVjHc" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=rX0ItVEVjHc</a>
评论 #41086927 未加载
评论 #41083056 未加载
评论 #41082513 未加载
评论 #41082971 未加载
评论 #41082874 未加载
KaiserPro10 个月前
I like this article. At the start I feared it was going to be one of those polemics written by someone who&#x27;s never had to read other people&#x27;s code, or worry about speed, efficiency or third party users.<p>However thats not the case. The author has distilled lots of experience into something reasonably readable.
throwway12038510 个月前
The other cool thing about an OOP approach to this problem is that you can hide your optimized LUT behind the OOP if you&#x27;re careful about the design of it. This lets you have your cake and eat it too. Your users who might be more comfortable with an OOP approach get a way to declare the kinds of shapes they&#x27;re interested in and the number of shapes they want to work with. Then you can take responsibility for building a LUT that meets their needs and give them the supporting optimizations they need to be successful.
评论 #41087332 未加载
ilrwbwrkhv10 个月前
the problem with code is that the abstraction changes and data needs to be migrated:<p>e.g. a user is enabled if they have paid... time passes... now a user is enabled if the team they belong to has paid. now you need to move the logic to another struct &#x2F; class and the data to another table.<p>now this is where &quot;payables&quot; and things come in and you start going the path of clean code with 1000 classes.<p>instead, the best way to do this is immutable data streams and event listeners.<p>after over a decade of programming, i feel for most software with a customer focus (not low level, embedded etc), immutable data streams where data flows through and listeners do things to themselves is the best way.
评论 #41082558 未加载
评论 #41084018 未加载
评论 #41082181 未加载
icholy10 个月前
If anyone wants to read the antithesis of Clean Code, check out &quot;A philosophy of software design&quot;
评论 #41084044 未加载
评论 #41085685 未加载
p0w3n3d10 个月前
I think a programmer can set badly any good pattern. We have onion pattern in our code and I get sick every time I enter it. All&#x27;s great but it implements a graph of state changes navigating which resembles debugging a regexp, also all the ctrl+click navigation is broken because there&#x27;s one general method for each message root type
tester75610 个月前
The most important thing when evaluating things you need to know is: context matters<p>Principles arent universal across technologies<p>Hell, principles arent even universal across software kind (e.g goto arent used in C# web dev, but std lib? yes)
评论 #41084789 未加载
评论 #41082744 未加载
Uehreka10 个月前
So like, Clean Code really does say you should write four line functions, and does not put caveats on that statement, Uncle Bob even gives a lengthy terrible-looking example of a class written with 4-line functions and holds it up as the ideal. His views as expressed in that book are extreme and uncompromising, the “everything in moderation, there are many ways to write clean code” stuff is a rhetorical act he does when people call him out. Then when they’re gone and he thinks he can get away with it he starts speaking in absolute statements again.<p>Like, this is a conversation Uncle Bob had with Casey Muratori on GitHub, I came away feeling like Uncle Bob is more interested in playing rhetorical judo than anything else: <a href="https:&#x2F;&#x2F;github.com&#x2F;unclebob&#x2F;cmuratori-discussion&#x2F;blob&#x2F;main&#x2F;cleancodeqa.md">https:&#x2F;&#x2F;github.com&#x2F;unclebob&#x2F;cmuratori-discussion&#x2F;blob&#x2F;main&#x2F;c...</a>
评论 #41083889 未加载
评论 #41082643 未加载
评论 #41083936 未加载
评论 #41083246 未加载
评论 #41082798 未加载
评论 #41087590 未加载
评论 #41082907 未加载
评论 #41082883 未加载
评论 #41084094 未加载
评论 #41082735 未加载
amai10 个月前
tldr;<p>Premature optimization is the root of all evil. (Donald Knuth)