Go Design Patterns
Mario Castro Contreras
- 402 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Go Design Patterns
Mario Castro Contreras
About This Book
Learn idiomatic, efficient, clean, and extensible Go design and concurrency patterns by using TDD
About This Book
- A highly practical guide filled with numerous examples unleashing the power of design patterns with Go.
- Discover an introduction of the CSP concurrency model by explaining GoRoutines and channels.
- Get a full explanation, including comprehensive text and examples, of all known GoF design patterns in Go.
Who This Book Is For
The target audience is both beginner- and advanced-level developers in the Go programming language. No knowledge of design patterns is expected.
What You Will Learn
- All basic syntax and tools needed to start coding in Go
- Encapsulate the creation of complex objects in an idiomatic way in Go
- Create unique instances that cannot be duplicated within a program
- Understand the importance of object encapsulation to provide clarity and maintainability
- Prepare cost-effective actions so that different parts of the program aren't affected by expensive tasks
- Deal with channels and GoRoutines within the Go context to build concurrent application in Go in an idiomatic way
In Detail
Go is a multi-paradigm programming language that has built-in facilities to create concurrent applications. Design patterns allow developers to efficiently address common problems faced during developing applications.
Go Design Patterns will provide readers with a reference point to software design patterns and CSP concurrency design patterns to help them build applications in a more idiomatic, robust, and convenient way in Go.
The book starts with a brief introduction to Go programming essentials and quickly moves on to explain the idea behind the creation of design patterns and how they appeared in the 90's as a common "language" between developers to solve common tasks in object-oriented programming languages. You will then learn how to apply the 23 Gang of Four (GoF) design patterns in Go and also learn about CSP concurrency patterns, the "killer feature" in Go that has helped Google develop software to maintain thousands of servers.
With all of this the book will enable you to understand and apply design patterns in an idiomatic way that will produce concise, readable, and maintainable software.
Style and approach
This book will teach widely used design patterns and best practices with Go in a step-by-step manner. The code will have detailed examples, to allow programmers to apply design patterns in their day-to-day coding.
Frequently asked questions
Information
Go Design Patterns
Go Design Patterns
Credits
Author Mario Castro Contreras | Copy Editor Safis Editing |
Reviewer Shiju Varghese | Project Coordinator Izzat Contractor |
Commissioning Editor Kunal Parikh | Proofreader Safis Editing |
Acquisition Editor Chaitanya Nair | Indexer Mariammal Chettiyar |
Content Development Editor Zeeyan Pinheiro | Graphics Abhinash Sahu |
Technical Editor Pavan Ramchandani | Production Coordinator Deepika Naik |
About the Author
I'd like to express my deep gratitude to my parents for supporting me in my journey through computers since I was 8. To Urszula, Tyrion and Tesla for their daily support and for being with me in the long nights writing this book.
I'd like to thank Chaitanya, for her guidance at the beginning of the book, Zeeyan, for his patience and help on every chapter, and Pavan, for the help and explanations. But also to all the reviewers, especially to Shiju, and the entire team at Packt that made this book possible.
About the Reviewer
www.PacktPub.com
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Customer Feedback
Preface
- Introduction to the Go language: This is the first part of the book, where you'll learn the basic syntax, the tools that comes with the binary distributions, basic testing, JSON parsing, and more. We leave concurrency for a later chapter to focus on the way that the syntax and the compiler work in a typical Go app.
- Classic design patterns in idiomatic Go: The second section presents the classic design patterns but as we will see, they are quite different, partly because of the lack of inheritance in Go, but also because we have different and more optimal ways to solve the same problems. A newcomer to the language will find the examples in this section very useful as a way to understand the roots of Go and the idiomatic ways in which you can solve problems using Go in the same manner as you would solve in languages such as Java or C++. Most examples are presented by using TDD and some of them even show examples within Go standard library that uses these patterns.
- Concurrency patterns: The focus in this section is learning about concurrent structures and parallel execution. You will learn most of the primitives in Go to write concurrent apps, and we will develop some of the classical design patterns with concurrent structures to maximize parallelism. Also, we will learn some of the typical structures to develop concurrent apps in Go. You learn how a classical pattern can become more complex if we need it to work in a concurrent way but the idea is to understand Go concurrent primitives so that the reader finishes the book knowing how to write their own concurrent design patterns by using the knowledge taken from the book.