Golang from Scala developer’s perspective

Golang from	
  Scala	
  
developer’s	
  perspective
About	
  me
Svetlana	
  Bozhko
Backend	
  Scala	
  Developer	
  @	
  Adform
The	
  goal
Is	
  Go	
  really	
  so	
  bad imperative?
Content
Short	
  intro	
  into	
  Go
Tooling	
  
FP	
  vs.	
  Go
IMHO
Usage
https://github.com/golang/go/wiki/GoUsers
Golang from Scala developer’s perspective
How	
  to	
  start?
http://tour.golang.org/
http://golangshow.com/
Go
Good	
  parts
Go	
  is	
  actually	
  a	
  pretty	
  
simple	
  language!
Even	
  too	
  simple	
  for	
  2015
Golang from Scala developer’s perspective
Advanced	
  GC
“Build	
  time	
  matters	
  more	
  
than	
  anything	
  else”	
  -­‐ Rob	
  Pike
gofmt
Quite	
  good	
  tools
build-­‐in	
  (version,	
  get,	
  build,	
  …)
editors	
  (vim,	
  intellij,	
  sublime,	
  …)
Concurrency
• Channels
send	
  data	
  between	
  threads	
  easily,	
  
asynchronously	
  or	
  synchronously
• GoRoutines
spin	
  up	
  another	
  thread,	
  just	
  like	
  that!
No	
  Language	
  Is	
  Perfect...
Go	
  Mentality
• Smallest	
  possible	
  feature	
  set
• It’s	
  okay	
  to	
  copy	
  some	
  code	
  
• Productivity	
  instead	
  of	
  hyper-­‐elegant	
  code
Let’s	
  get	
  rid	
  of
• Implicit	
  numeric	
  conversion	
  (int !=	
  int32)
• ‘Implements’	
  keyword
• ‘Classes’
• Constructor/destructor
• Function	
  overloading
• Pointer	
  arithmetic	
  
• Exceptions	
  and	
  try/catch
• Generics
• …
Strict	
  compiler
which	
  interrupts	
  you	
  sometimes
Wait,	
  Go	
  has	
  ‘goto’?
Wait,	
  how	
  to	
  debug?
GDB,	
  but	
  it’s	
  not	
  very	
  good	
  way
Dependency	
  
management
vendor	
  (since	
  1.5)	
  
FP	
  vs.	
  Go
Wikipedia:
“Functional	
  programming is	
  a programming	
  paradigm	
  
— a	
  style	
  of	
  building	
  the	
  structure	
  and	
  elements	
  of	
  
computer	
  programs	
  — that	
  treats computation as	
  the	
  
evaluation	
  of mathematical	
  functions and	
  avoids	
  
changing-­‐state and mutable data.”	
  
What	
  it	
  means?
No	
  mutable	
  data	
  (no	
  side	
  effect)
No	
  mutable	
  state	
  (no	
  implicit,	
  hidden	
  state)
Same	
  result	
  returned	
  by	
  functions	
  called	
  with	
  the	
  same	
  inputs
Functions	
  are	
  pure	
  functions	
  in	
  the	
  mathematical	
  sense
Advantages?
Cleaner	
  code
Referential	
  transparency
Referential	
  transparency
Memoization
Cache	
  results
Idempotence
Modularization
We	
  have	
  no	
  state
Ease	
  of	
  debugging
Functions	
  are	
  isolated	
  and	
  very	
  easy	
  to	
  debug
Referential	
  transparency
Parallelization
Functions	
  calls	
  are	
  independent	
  
We	
  can	
  parallelize	
  in	
  different	
  process/CPUs/computers/...	
  
res	
  =	
  func1(a,	
  b)	
  +	
  func2(a,	
  c)
Referential	
  transparency
With	
  no	
  shared	
  data,	
  concurrencygets	
  a	
  lot	
  simpler:
No	
  semaphores
No	
  monitors	
  
No	
  locks
No	
  race-­‐conditions
No	
  dead-­‐locks
Nonetheless
Golang has	
  built-­‐in	
  “sync”	
  package	
  with	
  mutexes
Don’t	
  Update,	
  Create!
String
Arrays
Maps
Higher	
  order	
  functions
FP	
  libraries
https://github.com/yanatan16/itertools
https://github.com/tobyhede/go-­‐underscore
Higher	
  order	
  functions
Map
Filter
Reduce
Closures
Currying	
  and	
  Partial	
  
Functions
Eager	
  vs	
  Lazy	
  Evaluation
Golang channels	
  and	
  goroutines enable	
  the	
  
creation	
  of	
  generators	
  that	
  could	
  be	
  a	
  way	
  to	
  have	
  
lazy	
  evaluation
Recursion
FP	
  &	
  OOP
It	
  is	
  possible	
  do	
  FP	
  in	
  OOP?	
  
Yes	
  it	
  is!
OOP	
  is	
  orthogonal	
  to	
  FP.	
  At	
  least	
  in	
  theory…
Exercise!
What	
  is	
  the	
  sum	
  of	
  the	
  first	
  10	
  natural	
  number	
  
whose	
  square	
  value	
  is	
  divisible	
  by	
  2?
Exercise!
Imperative Functional
Learn	
  at	
  least	
  one	
  
functional	
  language
It	
  will	
  open	
  your	
  mind	
  to	
  a	
  new	
  paradigm	
  
becoming	
  you	
  a	
  better	
  programmer
Conclusion
Technologies	
  are	
  awesome!	
  
The	
  problem	
  is	
  people how	
  we	
  use	
  them.
Thank	
  you!
Questions?
Svetlana	
  Bozhko aka	
  @SBozhko
http://devzen.ru/
svt.bozhko@gmail.com
Links
https://golang-­‐ru.slack.com/messages
https://www.youtube.com/watch?list=PLPHSBhlVt
TyfwIKn7r_a5xkzzMu-­‐iey-­‐w&v=cGXorQkw3JE
1 de 52

Recomendados

Wonders of Golang por
Wonders of GolangWonders of Golang
Wonders of GolangKartik Sura
923 vistas31 diapositivas
GoLang Introduction por
GoLang IntroductionGoLang Introduction
GoLang IntroductionSpandana Govindgari
220 vistas25 diapositivas
Golang por
GolangGolang
GolangMichael Blake
40.3K vistas23 diapositivas
Golang - Overview of Go (golang) Language por
Golang - Overview of Go (golang) LanguageGolang - Overview of Go (golang) Language
Golang - Overview of Go (golang) LanguageAniruddha Chakrabarti
7.1K vistas85 diapositivas
Building Command Line Tools with Golang por
Building Command Line Tools with GolangBuilding Command Line Tools with Golang
Building Command Line Tools with GolangTakaaki Mizuno
2.4K vistas22 diapositivas
A First Look at Google's Go Programming Language por
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageGanesh Samarthyam
771 vistas23 diapositivas

Más contenido relacionado

La actualidad más candente

Coding with golang por
Coding with golangCoding with golang
Coding with golangHannahMoss14
319 vistas34 diapositivas
Go Programming Language by Google por
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by GoogleUttam Gandhi
3.4K vistas20 diapositivas
The Go programming language - Intro by MyLittleAdventure por
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventuremylittleadventure
685 vistas26 diapositivas
Go language presentation por
Go language presentationGo language presentation
Go language presentationparamisoft
4.9K vistas13 diapositivas
Golang #5: To Go or not to Go por
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to GoOliver N
2.2K vistas25 diapositivas
Optimizing and Profiling Golang Rest Api por
Optimizing and Profiling Golang Rest ApiOptimizing and Profiling Golang Rest Api
Optimizing and Profiling Golang Rest ApiIman Syahputra Situmorang
735 vistas31 diapositivas

La actualidad más candente(20)

Go Programming Language by Google por Uttam Gandhi
Go Programming Language by GoogleGo Programming Language by Google
Go Programming Language by Google
Uttam Gandhi3.4K vistas
The Go programming language - Intro by MyLittleAdventure por mylittleadventure
The Go programming language - Intro by MyLittleAdventureThe Go programming language - Intro by MyLittleAdventure
The Go programming language - Intro by MyLittleAdventure
mylittleadventure685 vistas
Go language presentation por paramisoft
Go language presentationGo language presentation
Go language presentation
paramisoft4.9K vistas
Golang #5: To Go or not to Go por Oliver N
Golang #5: To Go or not to GoGolang #5: To Go or not to Go
Golang #5: To Go or not to Go
Oliver N2.2K vistas
Introduction to go lang por Amal Mohan N
Introduction to go langIntroduction to go lang
Introduction to go lang
Amal Mohan N546 vistas
Come With Golang por 尚文 曾
Come With GolangCome With Golang
Come With Golang
尚文 曾765 vistas
Why you should care about Go (Golang) por Aaron Schlesinger
Why you should care about Go (Golang)Why you should care about Go (Golang)
Why you should care about Go (Golang)
Aaron Schlesinger1.6K vistas
Go Programming language, golang por Basil N G
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
Basil N G650 vistas
Dependency management in golang por Ramit Surana
Dependency management in golangDependency management in golang
Dependency management in golang
Ramit Surana1.4K vistas
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno por Nexus FrontierTech
 [INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno [INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
Nexus FrontierTech708 vistas
Understanding how concurrency work in os por GenchiLu1
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
GenchiLu1755 vistas
welcome to gopherlabs - why go (golang)? por sangam biradar
welcome to gopherlabs - why go (golang)?welcome to gopherlabs - why go (golang)?
welcome to gopherlabs - why go (golang)?
sangam biradar410 vistas
ATO 2014 - So You Think You Know 'Go'? The Go Programming Language por John Potocny
ATO 2014 - So You Think You Know 'Go'? The Go Programming LanguageATO 2014 - So You Think You Know 'Go'? The Go Programming Language
ATO 2014 - So You Think You Know 'Go'? The Go Programming Language
John Potocny1.1K vistas
Mphasis Digital - Use Go (gloang) for system programming, distributed systems... por Aniruddha Chakrabarti
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...Mphasis Digital - Use Go (gloang) for system programming, distributed systems...
Mphasis Digital - Use Go (gloang) for system programming, distributed systems...

Similar a Golang from Scala developer’s perspective

Golang introduction por
Golang introductionGolang introduction
Golang introductionDineshDinesh131
34 vistas53 diapositivas
Scaling applications with go por
Scaling applications with goScaling applications with go
Scaling applications with goVimlesh Sharma
2.5K vistas34 diapositivas
Introduction to Go for Java Developers por
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java DevelopersLaszlo Csontos
74 vistas39 diapositivas
Go fundamentals por
Go fundamentalsGo fundamentals
Go fundamentalsRon Barabash
29 vistas30 diapositivas
Google's Go Programming Language - Introduction por
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction Ganesh Samarthyam
543 vistas23 diapositivas
Golang : A Hype or the Future? por
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?Mindfire LLC
9 vistas8 diapositivas

Similar a Golang from Scala developer’s perspective(20)

Scaling applications with go por Vimlesh Sharma
Scaling applications with goScaling applications with go
Scaling applications with go
Vimlesh Sharma2.5K vistas
Introduction to Go for Java Developers por Laszlo Csontos
Introduction to Go for Java DevelopersIntroduction to Go for Java Developers
Introduction to Go for Java Developers
Laszlo Csontos74 vistas
Google's Go Programming Language - Introduction por Ganesh Samarthyam
Google's Go Programming Language - Introduction Google's Go Programming Language - Introduction
Google's Go Programming Language - Introduction
Ganesh Samarthyam543 vistas
Golang : A Hype or the Future? por Mindfire LLC
Golang : A Hype or the Future?Golang : A Hype or the Future?
Golang : A Hype or the Future?
Mindfire LLC9 vistas
AddisDev Meetup ii: Golang and Flow-based Programming por Samuel Lampa
AddisDev Meetup ii: Golang and Flow-based ProgrammingAddisDev Meetup ii: Golang and Flow-based Programming
AddisDev Meetup ii: Golang and Flow-based Programming
Samuel Lampa5.1K vistas
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples) por Evan Lin
iTHome Gopher Day 2017: What can Golang do?  (Using project 52 as examples)iTHome Gopher Day 2017: What can Golang do?  (Using project 52 as examples)
iTHome Gopher Day 2017: What can Golang do? (Using project 52 as examples)
Evan Lin3.7K vistas
Golang nuts (by Nii Nai at DevCongress 2013) por DevCongress
Golang nuts (by Nii Nai at DevCongress 2013)Golang nuts (by Nii Nai at DevCongress 2013)
Golang nuts (by Nii Nai at DevCongress 2013)
DevCongress1.2K vistas
Golang workshop - Mindbowser por Mindbowser Inc
Golang workshop - MindbowserGolang workshop - Mindbowser
Golang workshop - Mindbowser
Mindbowser Inc1.9K vistas
Why Go Lang? por Sathish VJ
Why Go Lang?Why Go Lang?
Why Go Lang?
Sathish VJ269 vistas
Mender.io | Develop embedded applications faster | Comparing C and Golang por Mender.io
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io677 vistas
Introduction to functional programming por Konrad Szydlo
Introduction to functional programmingIntroduction to functional programming
Introduction to functional programming
Konrad Szydlo413 vistas

Último

Transcript: The Details of Description Techniques tips and tangents on altern... por
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...BookNet Canada
119 vistas15 diapositivas
Business Analyst Series 2023 - Week 3 Session 5 por
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
165 vistas20 diapositivas
Spesifikasi Lengkap ASUS Vivobook Go 14 por
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14Dot Semarang
35 vistas1 diapositiva
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... por
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...NUS-ISS
23 vistas70 diapositivas
Understanding GenAI/LLM and What is Google Offering - Felix Goh por
Understanding GenAI/LLM and What is Google Offering - Felix GohUnderstanding GenAI/LLM and What is Google Offering - Felix Goh
Understanding GenAI/LLM and What is Google Offering - Felix GohNUS-ISS
39 vistas33 diapositivas
Liqid: Composable CXL Preview por
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL PreviewCXL Forum
121 vistas8 diapositivas

Último(20)

Transcript: The Details of Description Techniques tips and tangents on altern... por BookNet Canada
Transcript: The Details of Description Techniques tips and tangents on altern...Transcript: The Details of Description Techniques tips and tangents on altern...
Transcript: The Details of Description Techniques tips and tangents on altern...
BookNet Canada119 vistas
Business Analyst Series 2023 - Week 3 Session 5 por DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10165 vistas
Spesifikasi Lengkap ASUS Vivobook Go 14 por Dot Semarang
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14
Dot Semarang35 vistas
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen... por NUS-ISS
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
Upskilling the Evolving Workforce with Digital Fluency for Tomorrow's Challen...
NUS-ISS23 vistas
Understanding GenAI/LLM and What is Google Offering - Felix Goh por NUS-ISS
Understanding GenAI/LLM and What is Google Offering - Felix GohUnderstanding GenAI/LLM and What is Google Offering - Felix Goh
Understanding GenAI/LLM and What is Google Offering - Felix Goh
NUS-ISS39 vistas
Liqid: Composable CXL Preview por CXL Forum
Liqid: Composable CXL PreviewLiqid: Composable CXL Preview
Liqid: Composable CXL Preview
CXL Forum121 vistas
.conf Go 2023 - Data analysis as a routine por Splunk
.conf Go 2023 - Data analysis as a routine.conf Go 2023 - Data analysis as a routine
.conf Go 2023 - Data analysis as a routine
Splunk90 vistas
Micron CXL product and architecture update por CXL Forum
Micron CXL product and architecture updateMicron CXL product and architecture update
Micron CXL product and architecture update
CXL Forum27 vistas
"Fast Start to Building on AWS", Igor Ivaniuk por Fwdays
"Fast Start to Building on AWS", Igor Ivaniuk"Fast Start to Building on AWS", Igor Ivaniuk
"Fast Start to Building on AWS", Igor Ivaniuk
Fwdays36 vistas
Samsung: CMM-H Tiered Memory Solution with Built-in DRAM por CXL Forum
Samsung: CMM-H Tiered Memory Solution with Built-in DRAMSamsung: CMM-H Tiered Memory Solution with Built-in DRAM
Samsung: CMM-H Tiered Memory Solution with Built-in DRAM
CXL Forum105 vistas
CXL at OCP por CXL Forum
CXL at OCPCXL at OCP
CXL at OCP
CXL Forum208 vistas
The details of description: Techniques, tips, and tangents on alternative tex... por BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada110 vistas
GigaIO: The March of Composability Onward to Memory with CXL por CXL Forum
GigaIO: The March of Composability Onward to Memory with CXLGigaIO: The March of Composability Onward to Memory with CXL
GigaIO: The March of Composability Onward to Memory with CXL
CXL Forum126 vistas
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur por Fwdays
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur
"Thriving Culture in a Product Company — Practical Story", Volodymyr Tsukur
Fwdays40 vistas
MemVerge: Gismo (Global IO-free Shared Memory Objects) por CXL Forum
MemVerge: Gismo (Global IO-free Shared Memory Objects)MemVerge: Gismo (Global IO-free Shared Memory Objects)
MemVerge: Gismo (Global IO-free Shared Memory Objects)
CXL Forum112 vistas
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor... por Vadym Kazulkin
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
How to reduce cold starts for Java Serverless applications in AWS at JCON Wor...
Vadym Kazulkin70 vistas
AI: mind, matter, meaning, metaphors, being, becoming, life values por Twain Liu 刘秋艳
AI: mind, matter, meaning, metaphors, being, becoming, life valuesAI: mind, matter, meaning, metaphors, being, becoming, life values
AI: mind, matter, meaning, metaphors, being, becoming, life values

Golang from Scala developer’s perspective