Hands-On Dependency Injection in Go
Hands-OnDependencyInjectioninGotakesyouonajourney,teachingyouaboutrefactoringexistingcodetoadoptdependencyinjection(DI)usingvariousmethodsavailableinGo.Ofthesixmethodsintroducedinthisbook,someareconventional,suchasconstructorormethodinjection,andsomeunconventional,suchasjust-in-timeorconfiginjection.Eachmethodisexplainedindetail,focusingontheirstrengthsandweaknesses,andisfollowedwithastep-by-stepexampleofhowtoapplyit.Withplentyofexamples,youwilllearnhowtoleverageDItotransformcodeintosomethingsimpleandflexible.Youwillalsodiscoverhowtogenerateandleveragethedependencygraphtospotandeliminateissues.Throughoutthebook,youwilllearntoleverageDIincombinationwithteststubsandmockstotestotherwisetrickyorimpossiblescenarios.Hands-OnDependencyInjectioninGotakesapragmaticapproachandfocusesheavilyonthecode,userexperience,andhowtoachievelong-termbenefitsthroughincrementalchanges.Bytheendofthisbook,youwillhaveproducedcleancodethat’seasytotest.
·7.7萬字