Introduction When I started to work with Go’s channels for the first time, I made the mistake of thinking about channels as a data structure. I saw channels as a queue that provided automatic synchronized access between goroutines. This structural understanding caused me to write a lot of bad and complicated concurrent code.
I learned over time that it’s best to forget about how channels are structured and focus on how they behave.
Continue readingPrelude If you want to put this post in some better context, I suggest reading the following series of posts, which lay out some other fundamental and relevant design principles:
Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics In particular, the idea of value and pointer semantics is everywhere in the Go programming language. As stated in those earlier posts, semantic consistency is critical for integrity and readability.
Continue readingPrelude These are good posts to read first to better understand the material presented in this post:
Index of the four part series:
Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics The idea of value and pointer semantics are everywhere in the Go programming language. As stated before in those earlier posts, semantic consistency is critical for integrity and readability.
Continue readingPrelude This is the final post in a four part series discussing the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on data and the design philosophies of applying value/pointer semantics in your code.
Index of the four part series:
Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics Design Philosophies “Value semantics keep values on the stack, which reduces pressure on the Garbage Collector (GC).
Continue readingPrelude This is the third post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on heaps and escape analysis.
Index of the four part series:
Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics Watch this video to see a live demo of this code:
Continue readingPrelude This is the second post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on heaps and escape analysis.
Index of the four part series:
Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics Introduction In the first post in this four part series, I taught the basics of pointer mechanics by using an example in which a value was shared down a goroutine’s stack.
Continue readingPrelude This is the first post in a four part series that will provide an understanding of the mechanics and design behind pointers, stacks, heaps, escape analysis and value/pointer semantics in Go. This post focuses on stacks and pointers.
Index of the four part series:
Language Mechanics On Stacks And Pointers Language Mechanics On Escape Analysis Language Mechanics On Memory Profiling Design Philosophy On Data And Semantics Introduction I’m not going to sugar coat it, pointers are difficult to comprehend.
Continue readingPrelude This post is part of a series designed to make you think about your own design philosophy on different topics. If you haven’t read the following post yet, please do so first:
Develop Your Design Philosophy
Introduction Systems cannot be developed assuming that human beings will be able to write millions of lines of code without making mistakes, and debugging alone is not an efficient way to develop reliable systems.
Continue readingUpdated on February 28th, 2017
Prelude This post is part of a series of posts designed to make you think about your own design philosophy on different topics. If you haven’t read these posts yet, please do so first:
Develop Your Design Philosophy
Design Philosophy On Packaging
Introduction Package Oriented Design allows a developer to identify where a package belongs inside a Go project and the design guidelines the package must respect.
Continue readingPrelude This post is part of a series of posts designed to make you think about your own design philosophy on different topics. If you haven’t read this post yet, please do so first:
Develop Your Design Philosophy
After this post, read this next one:
Package Oriented Design
Introduction In an interview given to Brian Kernighan by Mihai Budiu in the year 2000, Brian was asked the following question:
“Can you tell us about the worse features of C, from your point of view”?
Continue reading