Go open source projects with dependency injection and test framework

polaris · · 127 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi! I am looking for an open source project which has dependency injection and a nicely written testing framework.</p> <hr/>**评论:**<br/><br/>drvd: <pre><p>Good luck! May I ask what you intend to do once you found one? Publically shame the author? Please don&#39;t.</p></pre>Redundancy_: <pre><p>Nothing wrong with dependency injection to invert / abstract dependencies - Go&#39;s interfaces generally make it lovely. If you use mocking, you might deserve it though ;)</p></pre>Saltones: <pre><p>Can I ask what we&#39;re poking fun at here? I don&#39;t understand go enough to know exactly what you&#39;re saying is wrong. Sorry just really confused</p></pre>Redundancy_: <pre><p>I don&#39;t think that dependency injection is a bad thing in Go, in fact, the interfaces, closures and other things make it particularly easy and effective. Decent built in unit testing support means that you really ought to be doing something to make a package testable in isolation, and inversion of control techniques and DI are good for that.</p> <p>The flip side to this is that you really shouldn&#39;t need mocking - your interfaces should be small, and ideally lend themselves to being replaced with relatively simple stubs. If you feel you need mocking, it might be a sign of problems with the code design that make it hard.</p></pre>neo_bit: <pre><p>Rather, I want to learn from it and use the ideas in my own projects.</p></pre>drvd: <pre><p>You might want to learn from the standard library first. It is an excellent reference on how to test various things.</p></pre>shovelpost: <pre><p><a href="https://golang.org/pkg/testing/" rel="nofollow">A nicely written testing framework.</a></p></pre>callcifer: <pre><p>That&#39;s a library, not a <a href="https://en.wikipedia.org/wiki/Software_framework" rel="nofollow">framework</a>. Specifically:</p> <blockquote> <p>Frameworks have key distinguishing features that separate them from normal libraries:</p> <p><em>inversion of control</em>: In a framework, unlike in libraries or in standard user applications, the overall program&#39;s flow of control is not dictated by the caller, but by the framework.</p> <p><em>extensibility</em>: A user can extend the framework - usually by selective overriding; or programmers can add specialized user code to provide specific functionality.</p> <p><em>non-modifiable framework code</em>: The framework code, in general, is not supposed to be modified, while accepting user-implemented extensions. In other words, users can extend the framework, but should not modify its code.</p> </blockquote> <p>I&#39;d say the <code>testing</code> package fails both #1 and #2.</p></pre>Redundancy_: <pre><p>The testing package calls functions that you give it... isn&#39;t that inversion of control?</p></pre>WikiTextBot: <pre><p><strong>Software framework</strong></p> <p>In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software. A software framework provides a standard way to build and deploy applications. A software framework is a universal, reusable software environment that provides particular functionality as part of a larger software platform to facilitate development of software applications, products and solutions. Software frameworks may include support programs, compilers, code libraries, tool sets, and application programming interfaces (APIs) that bring together all the different components to enable development of a project or system.</p> <hr/> <p><sup>[</sup> <a href="https://www.reddit.com/message/compose?to=kittens_from_space" rel="nofollow"><sup>PM</sup></a> <sup>|</sup> <a href="https://reddit.com/message/compose?to=WikiTextBot&amp;message=Excludeme&amp;subject=Excludeme" rel="nofollow"><sup>Exclude</sup> <sup>me</sup></a> <sup>|</sup> <a href="https://np.reddit.com/r/golang/about/banned" rel="nofollow"><sup>Exclude</sup> <sup>from</sup> <sup>subreddit</sup></a> <sup>|</sup> <a href="https://np.reddit.com/r/WikiTextBot/wiki/index" rel="nofollow"><sup>FAQ</sup> <sup>/</sup> <sup>Information</sup></a> <sup>|</sup> <a href="https://github.com/kittenswolf/WikiTextBot" rel="nofollow"><sup>Source</sup></a> <sup>|</sup> <a href="https://www.reddit.com/r/WikiTextBot/wiki/donate" rel="nofollow"><sup>Donate</sup></a> <sup>]</sup> <sup>Downvote</sup> <sup>to</sup> <sup>remove</sup> <sup>|</sup> <sup>v0.28</sup></p></pre>

入群交流(和以上内容无关):Go中文网 QQ 交流群:729884609 或加微信入微信群:274768166 备注:入群;关注公众号:Go语言中文网

127 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传