SlideShare a Scribd company logo
Hurry Up and Go
(But Not Too Fast)
Stuart Fettinger
sfettinger@nvisia.com
About Me
Project Architect at NVISIA
10+ years of experience designing, developing, and delivering solutions
Recent co-founder of a tech startup
Passionate about limiting tech debt through clean and efficient design
Topic Breakdown
Brief Introduction to GO
Guiding Principles and Core Concepts
Go’s strong (and not so strong) suits
Highlighting when GO is a preferred choice, and when it’s not,
through real-world examples
Designing a GO Microservice
Tips for your design to take advantage of Go to its fullest and avoid
common pitfalls
What is GoLang?
• Developed by Google in 2007
• Designed to overcome criticism
of other languages
•Statically typed and compiled
• Syntactically similar to C
Go’s Guiding
Principles
Simplicity
Type inference
Declare-and-initialize operations
No generics
Composition rather than inheritance
Readability
As little “magic” as possible
Explicit and lean error mechanisms
Orthogonality
Do one thing well, keep things simple, standardize communication
Elimination of cross-linking complexity
Performance
Built in garbage collection
Synchronization, channels and Go routines
Pointers
A Basic Example
Main package – compiled binary
Short, concise imports
Function keywords
Multiple return values
Meaningful spaces – no semicolons
Core Concepts
Packages provide logical groupings and reusable functionality
Every Go program starts in the main package’s main() function
Main package is compiled to binary
Functions beginning with a capital letter are exported outside their package
Functions beginning with a lowercase letter are essentially private
Packages
Functions are stand-alone pieces of functionality
Methods are functions with receivers - tied to a type
Methods should be used when state is important and with interfaces
Rule of thumb – prefer methods over functions
Methods vs. Functions
Variables that store the memory address of other variables
Zero type of nil – popularly used where nil is valid and relied upon
Memory address available via &
Pointer dereferenced via *
Pointers
Structs
Named collections of fields
When initialized, all fields are set to their zero values
Fields of a struct are accessed via “.” operator
Composition over inheritance – one struct cannot be the child of another
Structs can contain other structs
Named collections of method signatures
No “Implements” keyword – can be implemented directly by implementing all methods
Interfaces can be empty – automatically satisfied by any type
Go’s answer to polymorphism
Interfaces
Errors
Errors are treated as values
Stack traces don’t come for free with errors
Idiomatic to check for errors frequently via “if” operations
No try/catch framework – error handling up to developers
Go Routines
Lightweight threads managed by the Go runtime
Spawned by simply using “go” keyword
Initially small stack size with ability to scale
Leverage channels to pass messages, block, and sync between Go routines
Performant – can run thousands of Go routines at a time with little drag
What Go Doesn’t Have
• Inheritance
• Classes
• Exceptions
• Generics
Deciding When to
Use Go
Go Is Not One-Size Fits All
• Go works well in some cases, not so great in others
• Some scenarios to consider Go
• Small, predictable routines
• Where performance margins are razor thin (ie: trading)
• Quick start-up with limited resources
• Scaling is a prime factor or an unknown
• Concurrency and communication is a prime use-case
• Scenarios where Go may fall short
• Where complexity requires extensive third-party libraries
• Where OO reduces complexity
• Front-end MVC
• Team makeup is less experienced
• Remember – design decisions should be case-by-case – try not to promote blanket use of technology
Considerations
• What are the requirements for the problem I am trying to solve?
• Can I solve the problem another way, and will doing so lose me any benefits?
• Consider technical pros and cons, but also intangible factors
• Developer happiness
• Community support
• Framework maturity
• Current trends
• Consider supporting a solution after it is live
• Scaling needs
• Technical debt and BAU maintenance
Use Case #1
Requirements
• Microservice with capabilities to
• Store high resolution images on the cloud
• Resize images without damaging resolution
• Be available on-demand to fetch data
• Data throughput may be larger than other streams (ie: text)
As a user, I want to be able to upload a high-resolution image, and retrieve it later in
whatever dimensions I want, so that I can use the image for different situations
Use Case #1
Performance exceeds
that of an interpreted
language
Package manager and
libraries are more
diverse
Higher scalability to
meet unknown data
demands
Ease of using docker to
spin up containers
Serverless architecture
support
Further developed
community
Smaller learning curve
for front-end
developers
Channels and
GoRoutines to spread
out workloads
Use Case #2
Requirements
• Several microservices connecting with different resources and providing different outputs
• Similarities in data may be a high percentage of make-up
• Data has potential to be large – multi-threading may be important
As a user, I want to be able to call APIs for different but similar data, and aggregate them
together, so that I can streamline my usage of that data
Use Case #2
Lightweight syntax –
avoid getting lost in
complex data
manipulation
Inheritance and
genericsHigh Performance
Mature libraries for
persistence and data
combination
Go Channels and Go
Routines – automate
polling data
Extensive API strategy
support
Use Case #3
Requirements
• Many file types may exist in many different formats
• Files may be made available at different times
• Must store data, potentially in a variety of formats
As a user, I want to be able to ingest and persist files from many different sources, so that I
can scrape the data later via my own processes
Use Case #3
Significant performance
benefits
Mature ORM libraries
Low learning curve
Wide database support
Higher developer
popularity
Multithreading
capabilities
Use Case #4
Requirements
• Application available on the web, potentially mobile as well
• Rich Interface and modern design
• Communicates with various microservices
• Possibilities are endless – login, registration, alerts, etc…
As a developer, I want to create a front-end web application for my users to interact with,
so that I can expand my customer base
Use Case #4
Lower learning curve Mature MVVM patterns
and support
Templating and
rendering engines
High number of built-in
must-haves for front-
end development
Third-party routing
support
Seamless integration
with a back-end Go
stack (Revel)
Designing a GO
Microservice - Tips
Don’t Reinvent
the Wheel#1
Plenty of third-party
frameworks exist to
ease microservice
development
GoMicro
• Foundation for RPC and event-driven communication with reasonable defaults built in
• Out-of-the-box:
• Service discovery
• Auto registration and name resolution
• Load Balancing
• Even distribution and node-retry
• Message Encoding
• Proto-RPC and Json-RPC by default
• Asynchronous
• Event-driven architecture
• “Pluggable” interfaces
• Platform agnostic implementations
GoKit
• Toolkit for Go – designed to be imported into a binary package
• Fills the gaps left by the base package(s)
• Security
• Monitoring
• Service Discovery
• Can be thought of as similar to
• Spring Boot
• Eureka
• Ribbon
• Integrates well with Docker, Kubernetes, and Heroku
• Different from GoMicro in that it’s more of a toolkit, less of a platform
Leverage
Interfaces#2
Interfaces provide
portable, independent
implementation
opportunities
• Expose interfaces as contracts between services
• Centralize common features such as logging and queueing
• Allow platform-agnostic implementations
• ie: data layer interfaces and repositories
ORM is Your
Friend#3
Make your entities
more meaningful by
tying them to an ORM
implementation
Go’s lean syntax drives you to use straight SQL prepared statements
• Gets messy fast with many parameters and outputs
• Nil considerations are difficult – Go values not easily nillable
• Compiler will not catch issues with prepared statements, field names, etc...
GoRM
• Provides associations between entities – Has One, Has Many, Many to
Many, Belongs To, etc…
• Uses any field with ID as the primary key – no need to annotate
• Auto support for creation, update, and soft-delete timestamps
• Auto-update capabilities – No need to explicitly call update vs insert
• Provides hooks to execute functionality pre or post running SQL
• API for transaction management and rollback
• Eager loading vs lazy loading (default) capabilities
• Can run raw SQL if needed
Centralize
configurations#4
Go’s binary nature may drive you to place configs in files within the application, or
on the server in a central location
• It works – but you’re missing out
Create a central location where configurations live – ideally another microservice
serving up files
• Place security on top of configs
• Integrate with CI/CD pipelines
• Inject configs via use of Docker secrets, etc…
• Leverage caching for failure scenarios
Read configurations into your services by leveraging Go-based configuration
solutions
Viper
• API to find and load config files of varying formats
• Also supports writing configuration files
• Provides defaults and gracefully handles overrides
• Live-watching of configs, and hot-reloading
• Alias-based naming, allowing non-breaking renames
• Uses environment variables to manage different configurations
• Remote key/value store support
Centralized
configuration keeps
things DRY
Make Errors
Meaningful#5
• Errors are values so it’s easy to treat them as strings and just pass them up the
chain
• There is no stacktrace included with an error by default
• There is no concept of an exception in Go – up to the developer to handle
• Implement the error interface to construct meaningful errors of different types
• Add stack trace information by using go-errors package
• Add important logging info using go log flags
Supplement your error
framework with
additional logging and
packages
When Designing Your Microservices…
• Understand the cases where your chosen technology works best
• Do POCs, reach out to the community, benchmark test – make informed decisions based on use cases
• Don’t be afraid to mix and match to get your desired result
• i.e – Go, third-party Go packages, Spring, Docker, etc…
• Always look for opportunities to improve, but not to the point of development paralysis
• Go is meant to be simple – don’t head down the rabbit hole of over-inventiveness
• Don’t invite unnecessary technical debt
• Consider your long-term goals and scaling needs when deciding how to implement functionality
• Design for technical soundness but also developer satisfaction
• Go is so popular, in part, because it’s fun
Questions

More Related Content

What's hot

Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
Basil N G
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
Wei-Ning Huang
 
Golang
GolangGolang
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
mylittleadventure
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
ShubhamMishra485
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
Spandana Govindgari
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
Gh-Mohammed Eldadah
 
Golang
GolangGolang
Golang
Felipe Mamud
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
Ishin Vin
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
Uttam Gandhi
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
Guy Komari
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
Markus Schneider
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
Harshad Patil
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
Tzar Umang
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
Mahmoud Masih Tehrani
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
John-Alan Simmons
 
Golang Template
Golang TemplateGolang Template
Golang Template
Karthick Kumar
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Concurrency in Golang
Concurrency in GolangConcurrency in Golang
Concurrency in Golang
Oliver N
 

What's hot (20)

Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
Go Lang Tutorial
Go Lang TutorialGo Lang Tutorial
Go Lang Tutorial
 
Golang
GolangGolang
Golang
 
The Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
GoLang Introduction
GoLang IntroductionGoLang Introduction
GoLang Introduction
 
Go Language presentation
Go Language presentationGo Language presentation
Go Language presentation
 
Golang
GolangGolang
Golang
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
Go Programming Language by Google
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Golang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / OverviewGolang and Eco-System Introduction / Overview
Golang and Eco-System Introduction / Overview
 
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
 
Golang getting started
Golang getting startedGolang getting started
Golang getting started
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
 
Golang Template
Golang TemplateGolang Template
Golang Template
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Concurrency in Golang
Concurrency in GolangConcurrency in Golang
Concurrency in Golang
 

Similar to Introduction to GoLang

Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...
HostedbyConfluent
 
20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development Platform20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development Platform
Harezmi IT Solutions
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
Phil Wilkins
 
Comparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutionsComparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutions
Mike Ensor
 
Manatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup MentalityManatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup Mentality
Todd Kaplinger
 
Making software development processes to work for you
Making software development processes to work for youMaking software development processes to work for you
Making software development processes to work for you
Ambientia
 
Community day 2013 applied architectures
Community day 2013   applied architecturesCommunity day 2013   applied architectures
Community day 2013 applied architecturesPanagiotis Kefalidis
 
How to Migrate from .NET to Drupal
How to Migrate from .NET to DrupalHow to Migrate from .NET to Drupal
How to Migrate from .NET to DrupalAcquia
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
confluent
 
Web frameworks
Web frameworksWeb frameworks
Web frameworks
Arafat Hossan
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
Ahmet Bulut
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
IT Arena
 
Software Design
Software DesignSoftware Design
Software Design
Ahmed Misbah
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
confluent
 
Web development tips and tricks
Web development tips and tricksWeb development tips and tricks
Web development tips and tricksmaxo_64
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreDan Poltawski
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
Jeff Fox
 
Django è pronto per l'Enterprise
Django è pronto per l'EnterpriseDjango è pronto per l'Enterprise
Django è pronto per l'Enterprise
PyCon Italia
 
Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!
Shelly Megan
 

Similar to Introduction to GoLang (20)

Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...Model-driven and low-code development for event-based systems | Bobby Calderw...
Model-driven and low-code development for event-based systems | Bobby Calderw...
 
20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development Platform20160422 Speedy Framework Enterprise Application Development Platform
20160422 Speedy Framework Enterprise Application Development Platform
 
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
gRPC, GraphQL, REST - Which API Tech to use - API Conference Berlin oct 20
 
Comparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutionsComparing Legacy and Modern e-commerce solutions
Comparing Legacy and Modern e-commerce solutions
 
Manatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup MentalityManatee to Dolphin: Transitioning to a Startup Mentality
Manatee to Dolphin: Transitioning to a Startup Mentality
 
Making software development processes to work for you
Making software development processes to work for youMaking software development processes to work for you
Making software development processes to work for you
 
Community day 2013 applied architectures
Community day 2013   applied architecturesCommunity day 2013   applied architectures
Community day 2013 applied architectures
 
How to Migrate from .NET to Drupal
How to Migrate from .NET to DrupalHow to Migrate from .NET to Drupal
How to Migrate from .NET to Drupal
 
resume4
resume4resume4
resume4
 
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
Designing and Implementing Information Systems with Event Modeling, Bobby Cal...
 
Web frameworks
Web frameworksWeb frameworks
Web frameworks
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Software Design
Software DesignSoftware Design
Software Design
 
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
Building Information Systems using Event Modeling (Bobby Calderwood, Evident ...
 
Web development tips and tricks
Web development tips and tricksWeb development tips and tricks
Web development tips and tricks
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 
Django è pronto per l'Enterprise
Django è pronto per l'EnterpriseDjango è pronto per l'Enterprise
Django è pronto per l'Enterprise
 
Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!
 

More from NVISIA

The Evolution of Architecture
The Evolution of ArchitectureThe Evolution of Architecture
The Evolution of Architecture
NVISIA
 
Expected Result - A UX Story
Expected Result - A UX StoryExpected Result - A UX Story
Expected Result - A UX Story
NVISIA
 
Antifragile Teams
Antifragile TeamsAntifragile Teams
Antifragile Teams
NVISIA
 
Digital Operations Service Design
Digital Operations Service DesignDigital Operations Service Design
Digital Operations Service Design
NVISIA
 
Executive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of ContainersExecutive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of Containers
NVISIA
 
Strengthening Business/IT Relationships
Strengthening Business/IT RelationshipsStrengthening Business/IT Relationships
Strengthening Business/IT Relationships
NVISIA
 
Achieving Business Alignment
Achieving Business AlignmentAchieving Business Alignment
Achieving Business Alignment
NVISIA
 
Intro to AWS Machine Learning
Intro to AWS Machine LearningIntro to AWS Machine Learning
Intro to AWS Machine Learning
NVISIA
 
2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in Action2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in Action
NVISIA
 
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swampDAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
NVISIA
 
Scaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the EnterpriseScaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the Enterprise
NVISIA
 
INNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL ITINNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL IT
NVISIA
 
Building a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster WisconsinBuilding a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster Wisconsin
NVISIA
 
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
NVISIA
 
Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation
NVISIA
 
NVISIA Mobile Trends Presentation
NVISIA Mobile Trends PresentationNVISIA Mobile Trends Presentation
NVISIA Mobile Trends Presentation
NVISIA
 

More from NVISIA (16)

The Evolution of Architecture
The Evolution of ArchitectureThe Evolution of Architecture
The Evolution of Architecture
 
Expected Result - A UX Story
Expected Result - A UX StoryExpected Result - A UX Story
Expected Result - A UX Story
 
Antifragile Teams
Antifragile TeamsAntifragile Teams
Antifragile Teams
 
Digital Operations Service Design
Digital Operations Service DesignDigital Operations Service Design
Digital Operations Service Design
 
Executive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of ContainersExecutive Briefing: The Why, What, and Where of Containers
Executive Briefing: The Why, What, and Where of Containers
 
Strengthening Business/IT Relationships
Strengthening Business/IT RelationshipsStrengthening Business/IT Relationships
Strengthening Business/IT Relationships
 
Achieving Business Alignment
Achieving Business AlignmentAchieving Business Alignment
Achieving Business Alignment
 
Intro to AWS Machine Learning
Intro to AWS Machine LearningIntro to AWS Machine Learning
Intro to AWS Machine Learning
 
2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in Action2015 DevOps Breakfast - DevOps in Action
2015 DevOps Breakfast - DevOps in Action
 
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swampDAMA Chicago - Ensuring your data lake doesn’t become a data swamp
DAMA Chicago - Ensuring your data lake doesn’t become a data swamp
 
Scaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the EnterpriseScaling the Lean Startup in the Enterprise
Scaling the Lean Startup in the Enterprise
 
INNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL ITINNOVATION BLUEPRINTS FOR BIMODAL IT
INNOVATION BLUEPRINTS FOR BIMODAL IT
 
Building a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster WisconsinBuilding a Data Talent Pipeline in Southeaster Wisconsin
Building a Data Talent Pipeline in Southeaster Wisconsin
 
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
12/2/2014 Milwaukee Agile Presentation: Persuading Your Oganization to be Agile
 
Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation Big Data 2.0 - Milwaukee Big Data User Group Presentation
Big Data 2.0 - Milwaukee Big Data User Group Presentation
 
NVISIA Mobile Trends Presentation
NVISIA Mobile Trends PresentationNVISIA Mobile Trends Presentation
NVISIA Mobile Trends Presentation
 

Recently uploaded

Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 

Recently uploaded (20)

Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 

Introduction to GoLang

  • 1. Hurry Up and Go (But Not Too Fast) Stuart Fettinger sfettinger@nvisia.com
  • 2. About Me Project Architect at NVISIA 10+ years of experience designing, developing, and delivering solutions Recent co-founder of a tech startup Passionate about limiting tech debt through clean and efficient design
  • 3. Topic Breakdown Brief Introduction to GO Guiding Principles and Core Concepts Go’s strong (and not so strong) suits Highlighting when GO is a preferred choice, and when it’s not, through real-world examples Designing a GO Microservice Tips for your design to take advantage of Go to its fullest and avoid common pitfalls
  • 5. • Developed by Google in 2007 • Designed to overcome criticism of other languages •Statically typed and compiled • Syntactically similar to C
  • 6. Go’s Guiding Principles Simplicity Type inference Declare-and-initialize operations No generics Composition rather than inheritance Readability As little “magic” as possible Explicit and lean error mechanisms Orthogonality Do one thing well, keep things simple, standardize communication Elimination of cross-linking complexity Performance Built in garbage collection Synchronization, channels and Go routines Pointers
  • 7. A Basic Example Main package – compiled binary Short, concise imports Function keywords Multiple return values Meaningful spaces – no semicolons
  • 9. Packages provide logical groupings and reusable functionality Every Go program starts in the main package’s main() function Main package is compiled to binary Functions beginning with a capital letter are exported outside their package Functions beginning with a lowercase letter are essentially private Packages
  • 10.
  • 11. Functions are stand-alone pieces of functionality Methods are functions with receivers - tied to a type Methods should be used when state is important and with interfaces Rule of thumb – prefer methods over functions Methods vs. Functions
  • 12.
  • 13. Variables that store the memory address of other variables Zero type of nil – popularly used where nil is valid and relied upon Memory address available via & Pointer dereferenced via * Pointers
  • 14.
  • 15.
  • 16. Structs Named collections of fields When initialized, all fields are set to their zero values Fields of a struct are accessed via “.” operator Composition over inheritance – one struct cannot be the child of another Structs can contain other structs
  • 17.
  • 18. Named collections of method signatures No “Implements” keyword – can be implemented directly by implementing all methods Interfaces can be empty – automatically satisfied by any type Go’s answer to polymorphism Interfaces
  • 19.
  • 20. Errors Errors are treated as values Stack traces don’t come for free with errors Idiomatic to check for errors frequently via “if” operations No try/catch framework – error handling up to developers
  • 21.
  • 22. Go Routines Lightweight threads managed by the Go runtime Spawned by simply using “go” keyword Initially small stack size with ability to scale Leverage channels to pass messages, block, and sync between Go routines Performant – can run thousands of Go routines at a time with little drag
  • 23.
  • 24. What Go Doesn’t Have • Inheritance • Classes • Exceptions • Generics
  • 26. Go Is Not One-Size Fits All • Go works well in some cases, not so great in others • Some scenarios to consider Go • Small, predictable routines • Where performance margins are razor thin (ie: trading) • Quick start-up with limited resources • Scaling is a prime factor or an unknown • Concurrency and communication is a prime use-case • Scenarios where Go may fall short • Where complexity requires extensive third-party libraries • Where OO reduces complexity • Front-end MVC • Team makeup is less experienced • Remember – design decisions should be case-by-case – try not to promote blanket use of technology
  • 27. Considerations • What are the requirements for the problem I am trying to solve? • Can I solve the problem another way, and will doing so lose me any benefits? • Consider technical pros and cons, but also intangible factors • Developer happiness • Community support • Framework maturity • Current trends • Consider supporting a solution after it is live • Scaling needs • Technical debt and BAU maintenance
  • 28. Use Case #1 Requirements • Microservice with capabilities to • Store high resolution images on the cloud • Resize images without damaging resolution • Be available on-demand to fetch data • Data throughput may be larger than other streams (ie: text) As a user, I want to be able to upload a high-resolution image, and retrieve it later in whatever dimensions I want, so that I can use the image for different situations
  • 29. Use Case #1 Performance exceeds that of an interpreted language Package manager and libraries are more diverse Higher scalability to meet unknown data demands Ease of using docker to spin up containers Serverless architecture support Further developed community Smaller learning curve for front-end developers Channels and GoRoutines to spread out workloads
  • 30. Use Case #2 Requirements • Several microservices connecting with different resources and providing different outputs • Similarities in data may be a high percentage of make-up • Data has potential to be large – multi-threading may be important As a user, I want to be able to call APIs for different but similar data, and aggregate them together, so that I can streamline my usage of that data
  • 31. Use Case #2 Lightweight syntax – avoid getting lost in complex data manipulation Inheritance and genericsHigh Performance Mature libraries for persistence and data combination Go Channels and Go Routines – automate polling data Extensive API strategy support
  • 32. Use Case #3 Requirements • Many file types may exist in many different formats • Files may be made available at different times • Must store data, potentially in a variety of formats As a user, I want to be able to ingest and persist files from many different sources, so that I can scrape the data later via my own processes
  • 33. Use Case #3 Significant performance benefits Mature ORM libraries Low learning curve Wide database support Higher developer popularity Multithreading capabilities
  • 34. Use Case #4 Requirements • Application available on the web, potentially mobile as well • Rich Interface and modern design • Communicates with various microservices • Possibilities are endless – login, registration, alerts, etc… As a developer, I want to create a front-end web application for my users to interact with, so that I can expand my customer base
  • 35. Use Case #4 Lower learning curve Mature MVVM patterns and support Templating and rendering engines High number of built-in must-haves for front- end development Third-party routing support Seamless integration with a back-end Go stack (Revel)
  • 38. Plenty of third-party frameworks exist to ease microservice development GoMicro • Foundation for RPC and event-driven communication with reasonable defaults built in • Out-of-the-box: • Service discovery • Auto registration and name resolution • Load Balancing • Even distribution and node-retry • Message Encoding • Proto-RPC and Json-RPC by default • Asynchronous • Event-driven architecture • “Pluggable” interfaces • Platform agnostic implementations GoKit • Toolkit for Go – designed to be imported into a binary package • Fills the gaps left by the base package(s) • Security • Monitoring • Service Discovery • Can be thought of as similar to • Spring Boot • Eureka • Ribbon • Integrates well with Docker, Kubernetes, and Heroku • Different from GoMicro in that it’s more of a toolkit, less of a platform
  • 40. Interfaces provide portable, independent implementation opportunities • Expose interfaces as contracts between services • Centralize common features such as logging and queueing • Allow platform-agnostic implementations • ie: data layer interfaces and repositories
  • 42. Make your entities more meaningful by tying them to an ORM implementation Go’s lean syntax drives you to use straight SQL prepared statements • Gets messy fast with many parameters and outputs • Nil considerations are difficult – Go values not easily nillable • Compiler will not catch issues with prepared statements, field names, etc... GoRM • Provides associations between entities – Has One, Has Many, Many to Many, Belongs To, etc… • Uses any field with ID as the primary key – no need to annotate • Auto support for creation, update, and soft-delete timestamps • Auto-update capabilities – No need to explicitly call update vs insert • Provides hooks to execute functionality pre or post running SQL • API for transaction management and rollback • Eager loading vs lazy loading (default) capabilities • Can run raw SQL if needed
  • 44. Go’s binary nature may drive you to place configs in files within the application, or on the server in a central location • It works – but you’re missing out Create a central location where configurations live – ideally another microservice serving up files • Place security on top of configs • Integrate with CI/CD pipelines • Inject configs via use of Docker secrets, etc… • Leverage caching for failure scenarios Read configurations into your services by leveraging Go-based configuration solutions Viper • API to find and load config files of varying formats • Also supports writing configuration files • Provides defaults and gracefully handles overrides • Live-watching of configs, and hot-reloading • Alias-based naming, allowing non-breaking renames • Uses environment variables to manage different configurations • Remote key/value store support Centralized configuration keeps things DRY
  • 46. • Errors are values so it’s easy to treat them as strings and just pass them up the chain • There is no stacktrace included with an error by default • There is no concept of an exception in Go – up to the developer to handle • Implement the error interface to construct meaningful errors of different types • Add stack trace information by using go-errors package • Add important logging info using go log flags Supplement your error framework with additional logging and packages
  • 47. When Designing Your Microservices… • Understand the cases where your chosen technology works best • Do POCs, reach out to the community, benchmark test – make informed decisions based on use cases • Don’t be afraid to mix and match to get your desired result • i.e – Go, third-party Go packages, Spring, Docker, etc… • Always look for opportunities to improve, but not to the point of development paralysis • Go is meant to be simple – don’t head down the rabbit hole of over-inventiveness • Don’t invite unnecessary technical debt • Consider your long-term goals and scaling needs when deciding how to implement functionality • Design for technical soundness but also developer satisfaction • Go is so popular, in part, because it’s fun