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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Newspeak and Domain Modeling

22 点作者 kkreuning将近 4 年前

4 条评论

globular-toast将近 4 年前
I do wonder how far the pendulum will swing back this time. This kind of thing is exactly what Java programs were like in the 00s (maybe they still are, I haven&#x27;t seen any for years).<p>The first problem with this is it leads to insanity. Remember those arguments developers had about style before we adopted auto-formatting? Those arguments will happen about what is and what isn&#x27;t a distinct type.<p>But the main problem for me is the cost is too high for such little benefit. Understanding and maintaining a type system like that is hard. You are not going to eliminate all bugs. Wouldn&#x27;t the effort be better spent on writing more tests? I feel like developers prefer creating more types over writing more tests because it&#x27;s easier, though.<p>Some of these problems have good, practical solutions already:<p>&gt; Good luck figuring all of that out from the following signature: &gt; CompletionStage&lt;String&gt; x(String s, int i);<p>I agree, but you could just use good naming: `fetchAddress(postcode, housenumber)`<p>&gt; functions with two or more arguments of the same type<p>Use keyword arguments, ie. `kwargs` in Python or pass an object in JS.<p>&gt; UUIDs as method argument, a customer uuid is not the same as an order uuid.<p>This contradicts the Universal part of UUID. If they&#x27;re not the same then why use UUID at all?<p>&gt; using a List instead of a NonEmptyList when at least one element is expected.<p>I&#x27;m not sure why this is a problem. An empty list is a perfectly valid list. It strikes me that what you really wanted to pass was an object, not a list.
评论 #27677822 未加载
评论 #27681817 未加载
评论 #27676838 未加载
baryphonic将近 4 年前
When I clicked the link, I figured it was about Gilad Bracha&#x27;s language Newspeak, not the antecedent in <i>Nineteen Eighty-Four</i>.
AzzieElbab将近 4 年前
Refined is awesome but in scala3 I switched away from it, and use hand crafted phantom types instead. Compilation costs of refined are a bit too much since all you get in the end is enforced validation. Coolest looking feature like value validations at compile time has very few practical applications.
skybrian将近 4 年前
The author says there are things that are “impossible” for these functions to do, but in Scala, are side effects in any way limited? If you can call out to Java then it seems like you can do anything?
评论 #27678023 未加载