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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Compile-Time DI vs. Run-Time DI

47 点作者 dimes大约 6 年前

5 条评论

benbjohnson大约 6 年前
I don&#x27;t understand why you need a framework for dependency injection in Go. I&#x27;ve written Go for years and I just use the `main` package to instantiate and wire up everything. It&#x27;s really straightforward, easy to debug, and there&#x27;s nothing to generate. It&#x27;s all type checked at compile time.<p>I&#x27;m not trying to rain on the author&#x27;s parade. I genuinely don&#x27;t understand the benefit—especially in relation to the complexity of adding an extra dependency and layer to my application.
评论 #19793620 未加载
评论 #19789074 未加载
stabbles大约 6 年前
What this blog post does not address is the joy of configuring DI with XML files &#x2F;s<p>Isn&#x27;t it bizarre how software developers have taken runtime DI to such extremes that it was considered a good idea to configure services in XML or YAML -- basically another language, that has to be parsed, can be malformed, etc?
评论 #19788954 未加载
评论 #19788520 未加载
评论 #19788602 未加载
评论 #19789487 未加载
_57jb大约 6 年前
Your point of breaking things as early in the process really is the winner.<p>Catching things early and often. Tooling that shifts things further left in the pipeline is my go-to default.
评论 #19788242 未加载
kangnkodos大约 6 年前
DI is Dependency Injection.
kazagistar大约 6 年前
Java has a fairly nice compile time DI framework in Dagger. However, it feels like it is missing a compile time version of the rest of the web stack: compile time routing and compile time template compilation, for example. Does anyone have any suggestions to fill out this stack?
评论 #19789104 未加载