Hi! I am looking for an open source project which has dependency injection and a nicely written testing framework.
评论:
drvd:
Redundancy:Good luck! May I ask what you intend to do once you found one? Publically shame the author? Please don't.
Saltones:Nothing wrong with dependency injection to invert / abstract dependencies - Go's interfaces generally make it lovely. If you use mocking, you might deserve it though ;)
Redundancy:Can I ask what we're poking fun at here? I don't understand go enough to know exactly what you're saying is wrong. Sorry just really confused
neo_bit:I don'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.
The flip side to this is that you really shouldn'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.
drvd:Rather, I want to learn from it and use the ideas in my own projects.
shovelpost:You might want to learn from the standard library first. It is an excellent reference on how to test various things.
callcifer:
Redundancy_:That's a library, not a framework. Specifically:
Frameworks have key distinguishing features that separate them from normal libraries:
inversion of control: In a framework, unlike in libraries or in standard user applications, the overall program's flow of control is not dictated by the caller, but by the framework.
extensibility: A user can extend the framework - usually by selective overriding; or programmers can add specialized user code to provide specific functionality.
non-modifiable framework code: 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.
I'd say the
testing
package fails both #1 and #2.
WikiTextBot:The testing package calls functions that you give it... isn't that inversion of control?
Software framework
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.
[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source | Donate ] Downvote to remove | v0.28
