Pros and cons using Gin in GWT
What are the pros and cons using Gin in开发者_StackOverflow GWT in comparison with using a ClientFactory?
Pros:
Gives you a good wait to replace implementations as you grow. For instance, if you want mixed-mode support, it is easier to do runtime-level changes with a Provider<> than ClientFactory. For example, if you want to have an "Online" version of an Async service and an "Offline" version and hot-swap them in the client.
Constructor DI means you can more easily stub out units without having to use GWTTestSuite.
No XML configuration.
If you use Guice on the server side, you have a consistent pattern for app wiring.
Cons:
It is another library. :/
There are some limits to what you can do with Gin vs "Real" Guice, which might cause some problems.
Gin might add a very small amount of code to your project vs ClientFactory.
精彩评论