Hands-On Dependency Injection in Go: Produce clean and loosely coupled Go code that is easier to read, maintain, test and extend

Corey Scott

  • 出版商: Packt Publishing
  • 出版日期: 2018-11-28
  • 售價: $1,380
  • 貴賓價: 9.5$1,311
  • 語言: 英文
  • 頁數: 346
  • 裝訂: Paperback
  • ISBN: 1789132762
  • ISBN-13: 9781789132762
  • 相關分類: Go 程式語言
  • 立即出貨 (庫存=1)

買這商品的人也買了...

相關主題

商品描述

Dependency Injection in Go, often considered to be tedious, made easy with this comprehensive guide

Key Features

  • Gain an in-depth insight into Dependency Injection and the SOLID principles
  • Learn how to refactor existing code to adopt Dependency Injection using several of the methods available in Go.
  • Discover how to design a system from scratch to support Dependency Injection and also Dependency Injection anti-patterns.

Book Description

Go simplifies the process of building steadfast and well-organized software. Leverage Dependency Injection and Testings to produce clean, loosely coupled Go code that is inherently easier to read, maintain, test and extend.

Hands-On Dependency Injection and Testing in Go is an in-depth guide to Dependency Injection and the SOLID principles for Go. It will take you on a journey to refactor existing code to adopt Dependency Injection using several methods available in Go. Each method is explained in detail, focusing on their strengths and weakness and with the help of examples, and you will gain knowledge on how to best leverage the method to transform the code into something simple and flexible. Moving ahead, you will learn how to incorporate the dependency graph to spot and eliminate issues. The book will educate you on the techniques involved in using Dependency Injection with test stubs and mocks to test otherwise difficult or impossible scenarios and achieve thorough unit test coverage.

Finally, we will talk about how to design a system from scratch to support Dependency Injection and also Dependency Injection anti-patterns.

What you will learn

  • Understand the benefits of Dependency Injection.
  • Explore several Dependency Injection patterns in Go.
  • Learn to leverage Dependency Injection to produce high quality, loosely coupled and thoroughly tested Go code.
  • Gain insight on how to refactor existing Go code to use Dependency Injection.
  • Learn to design a Go new package or system to use Dependency Injection

Who This Book Is For

Programmers with a few years experience in any language and a basic understanding of Go who wish to produce clean, loosely coupled code.

商品描述(中文翻譯)

在這本全面指南中,你將學習如何在Go中輕鬆實現被認為繁瑣的依賴注入。以下是本書的主要特點:

- 深入了解依賴注入和SOLID原則
- 學習如何重構現有代碼以採用Go中的多種依賴注入方法
- 發現如何從頭開始設計一個支持依賴注入的系統,以及依賴注入的反模式

Go簡化了構建堅固和組織良好的軟件的過程。通過使用依賴注入和測試,你可以生成乾淨、鬆散耦合的Go代碼,這種代碼更容易閱讀、維護、測試和擴展。

《Hands-On Dependency Injection and Testing in Go》是一本深入介紹Go中依賴注入和SOLID原則的指南。本書將帶領你重構現有代碼,使用Go中的多種方法來實現依賴注入。每種方法都會詳細解釋,重點介紹它們的優點和缺點,並通過示例幫助你了解如何最好地利用這些方法將代碼轉化為簡單靈活的形式。接下來,你將學習如何使用依賴圖來發現和解決問題。本書還將教你使用測試存根和模擬來測試其他困難或不可能的情境,以實現全面的單元測試覆蓋。

最後,我們將討論如何從頭開始設計一個支持依賴注入的系統,以及依賴注入的反模式。

你將學到以下內容:

- 瞭解依賴注入的好處
- 探索Go中的多種依賴注入模式
- 學習如何利用依賴注入生成高質量、鬆散耦合且經過全面測試的Go代碼
- 獲得重構現有Go代碼以使用依賴注入的洞察力
- 學習如何設計一個新的Go包或系統以使用依賴注入

本書適合具有幾年經驗的程式設計師,無論使用任何語言,並且對Go有基本的了解,希望生成乾淨、鬆散耦合的代碼。