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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Encapsulation Is Not Always Desirable

1 点作者 jack335将近 2 年前

1 comment

eternityforest将近 2 年前
I&#x27;m not sure who is using encapsulation for anything security related. It&#x27;s a drawer, not a bank vault.<p>Sometimes it really is getting in the way. Other times it&#x27;s there to remind you &quot;Hey, you can&#x27;t access this hidden thing for a reason, because the library author believes it is bad practice to write anything that depends on it, once you&#x27;re at a layer that has this object, you shouldn&#x27;t need to look at it&quot;.<p>Sometimes that really makes big problems, sometimes they&#x27;re probably right and your code that takes an image file should not look at the current mouse position, because then it would be hard to make it work in some other context where you don&#x27;t have that.