Go Design Patterns

Learn idiomatic, efficient, clean, and extensible Go design and concurrency patterns by using TDD

Go Design Patterns

This ebook is included in a Mapt subscription
Mario Castro Contreras

Learn idiomatic, efficient, clean, and extensible Go design and concurrency patterns by using TDD
$0.00
$20.00
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781786466204
Paperback402 pages

Book Description

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.

Table of Contents

Chapter 1: Ready... Steady... Go!
A little bit of history
Installing Go
Starting with Hello World
Integrated Development Environment - IDE
Types
Variables and constants
Operators
Flow control
Functions
Arrays, slices, and maps
Visibility
Zero-initialization
Pointers and structures
Interfaces
Testing and TDD
Libraries
The Go get tool
Managing JSON data
Go tools
Contributing to Go open source projects in GitHub
Summary
Chapter 2: Creational Patterns - Singleton, Builder, Factory, Prototype, and Abstract Factory Design Patterns
Singleton design pattern - having a unique instance of a type in the entire program
Builder design pattern - reusing an algorithm to create many implementations of an interface
Factory method - delegating the creation of different types of payments
Abstract Factory - a factory of factories
Prototype design pattern
Summary
Chapter 3: Structural Patterns - Composite, Adapter, and Bridge Design Patterns
Composite design pattern
Adapter design pattern
Bridge design pattern
Summary
Chapter 4: Structural Patterns - Proxy, Facade, Decorator, and Flyweight Design Patterns
Proxy design pattern
Decorator design pattern
Facade design pattern
Flyweight design pattern
Summary
Chapter 5: Behavioral Patterns - Strategy, Chain of Responsibility, and Command Design Patterns
Strategy design pattern
Chain of responsibility design pattern
Command design pattern
Summary
Chapter 6: Behavioral Patterns - Template, Memento, and Interpreter Design Patterns
Template design pattern
Memento design pattern
Interpreter design pattern
Summary
Chapter 7: Behavioral Patterns - Visitor, State, Mediator, and Observer Design Patterns
Visitor design pattern
State design pattern
Mediator design pattern
Observer design pattern
Chapter 8: Introduction to Gos Concurrency
A little bit of history and theory
Goroutines
Callbacks
Mutexes
Channels
Using it all - concurrent singleton
Summary
Chapter 9: Concurrency Patterns - Barrier, Future, and Pipeline Design Patterns
Barrier concurrency pattern
Future design pattern
Pipeline design pattern
Summary
Chapter 10: Concurrency Patterns - Workers Pool and Publish/Subscriber Design Patterns
Workers pool
Concurrent Publish/Subscriber design pattern
Summary

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

Authors

Table of Contents

Chapter 1: Ready... Steady... Go!
A little bit of history
Installing Go
Starting with Hello World
Integrated Development Environment - IDE
Types
Variables and constants
Operators
Flow control
Functions
Arrays, slices, and maps
Visibility
Zero-initialization
Pointers and structures
Interfaces
Testing and TDD
Libraries
The Go get tool
Managing JSON data
Go tools
Contributing to Go open source projects in GitHub
Summary
Chapter 2: Creational Patterns - Singleton, Builder, Factory, Prototype, and Abstract Factory Design Patterns
Singleton design pattern - having a unique instance of a type in the entire program
Builder design pattern - reusing an algorithm to create many implementations of an interface
Factory method - delegating the creation of different types of payments
Abstract Factory - a factory of factories
Prototype design pattern
Summary
Chapter 3: Structural Patterns - Composite, Adapter, and Bridge Design Patterns
Composite design pattern
Adapter design pattern
Bridge design pattern
Summary
Chapter 4: Structural Patterns - Proxy, Facade, Decorator, and Flyweight Design Patterns
Proxy design pattern
Decorator design pattern
Facade design pattern
Flyweight design pattern
Summary
Chapter 5: Behavioral Patterns - Strategy, Chain of Responsibility, and Command Design Patterns
Strategy design pattern
Chain of responsibility design pattern
Command design pattern
Summary
Chapter 6: Behavioral Patterns - Template, Memento, and Interpreter Design Patterns
Template design pattern
Memento design pattern
Interpreter design pattern
Summary
Chapter 7: Behavioral Patterns - Visitor, State, Mediator, and Observer Design Patterns
Visitor design pattern
State design pattern
Mediator design pattern
Observer design pattern
Chapter 8: Introduction to Gos Concurrency
A little bit of history and theory
Goroutines
Callbacks
Mutexes
Channels
Using it all - concurrent singleton
Summary
Chapter 9: Concurrency Patterns - Barrier, Future, and Pipeline Design Patterns
Barrier concurrency pattern
Future design pattern
Pipeline design pattern
Summary
Chapter 10: Concurrency Patterns - Workers Pool and Publish/Subscriber Design Patterns
Workers pool
Concurrent Publish/Subscriber design pattern
Summary

Book Details

ISBN 139781786466204
Paperback402 pages
Read More

Read More Reviews