Beginners Should Think Differently When Writing Golang

92,114
0
Published 2023-09-04
β–Ί Join my Discord community for free education πŸ‘‰ discord.com/invite/Ac7CWREe58

β–Ί Exclusive Lessons, Mentorship, And Videos πŸ‘‰ www.patreon.com/anthonygg_

β–Ί Enjoy a 50% Discount on My Golang Course πŸ‘‰ fulltimegodev.com/

β–Ί Learn how I became a self-taught software engineer πŸ‘‰fulltimegodev.com/#mystory

β–Ί Follow me on Twitter πŸ‘‰ twitter.com/anthdm

β–Ί Follow me on GitHub πŸ‘‰ github.com/anthdm

SUBSCRIBE OR NO MARGARITAS
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
β•‘β•šβ•£β•‘β•‘β•‘β•šβ•£β•šβ•£β•”β•£β•”β•£β•‘β•šβ•£β•β•£
β• β•—β•‘β•šβ•β•‘β•‘β• β•—β•‘β•šβ•£β•‘β•‘β•‘β•‘β•‘β•β•£
β•šβ•β•©β•β•β•©β•β•©β•β•©β•β•©β•

All Comments (21)
  • @RubinGhimire
    Good explanation. As a note to others still confused, structs are passed by value by default in Go (what Anthony means by copy; it's not the original, remember that) and thus when we create a pointer we have a reference to the memory, which will not be cleared with the function stack.
  • @joshi1q2w3e
    Dude… thank you so much for this, cause I literally asked you about this yesterday and today you have a video on it. God bless man!
  • @wadecodez
    For anyone looking to better understand Go, I'd recommend implementing OOP in pure C. Structs are essentially wrappers that hold data so you can easily manipulate related information. Methods are just functions with an inferred argument, and access modifiers are just structs that forward method calls to internal structs.
  • @Allr3dc
    Wish this video existed when I first started writing Go. Really well done and easy to understand for OOP programmers starting Go!
  • @joshkny
    This was the first in a series of big breakthroughs for me using GO. Thank you, Anthony!
  • @kumekster
    I struggled to understand pointers and your explanation was mind opening. Kudos.
  • @axisaligned9799
    The structs in Go, C, Rust are just the data. In memory there only exists the data. In python and JavaScript each piece of object comes with the data just as the previous language, BUT it also has a bunch of other data that is not what u declared, for example a pointer to its class and the methods. For python for example it even holds onto the methods. 1st type of Language: [an object] - field 1 - field 2 And then somewhere else you have: - function 1 that takes in the type of struct as an argument Whereas the 2nd types of languages: [an object] - field 1 - field 2 - method 1 - method 2 - class metadata ….. This roughly can be what u can imagine the general differences
  • @aleclowry7654
    One thing that I like about hanging functions off of structs is that code bases are far more discoverable via lsp
  • @vijayb3133
    I come from a Python background. When I started learning Go, I found myself constantly comparing its features with Python, which made my understanding a bit difficult. However, this video completely changed my perspective on how I should approach learning Golang.πŸ™‡
  • @computersindia
    I enjoyed the way you explained for better understanding. Thanks!!
  • I realy learned alot from you thank you so much! keep up the good work!
  • @XternalArchives
    I saw a comment saying interfaces, i think you should show when to use interfaces and methods. Good video.
  • @farrela.846
    Just fumbled around about this topic and the algorithm bless me with this vid. Thanks!
  • @luciusstark
    Fabulous tip! If I understood it correctly… It reminds me of Python programming when I need to think about dictionaries; on Bash, I think about IFS (word handling via word-splitting).