Go Favor Composition: Struct EmbeddingLet’s explore another Go unique design: Embedding. This post is for first type of embedding: struct embedding, where one struct type embeds another struct type. Coming from an object-oriented programming (OOP) language like Java or C++, the way Go ha...Oct 16, 2025·4 min read·17
Embracing Pragmatic TDDThere are numerous discussion and debates around different testing strategies, and it still feels hard to find consensus on what makes unit test. That makes software teams confused and somehow start applying TDD for the sake of it. They usually focus...Jun 27, 2024·8 min read·56
Get Going Mini LRU CacheThe core requirement of this data structure: The cache serves as a key-value store and has some capacity We can put items to the cache until it reaches the capacity When capacity is reached, it will evict the "least used" item based on internal or...Jun 20, 2024·2 min read·9
Working with JSON in GoGo JSON decoding is bit different than others again. It does not accept a string and return an object like JS or Python. Actually it does not return anything, we need to pass the pointer of a struct, and decode into it. This allows user to control th...May 12, 2024·3 min read·136
DIP with Go InterfaceRead first: The "D" in SOLID As a follow up post, we will see how we actually structure the code end to end to conform to this DIP principle. We use Go as an example but principles remain the same in other languages. Like other OOP Go supports interf...Mar 24, 2024·5 min read·93
The "D" in SOLID Software PrincipleRecently I reviewed a few good old articles around topics related to clean architecture. One of them is this interesting article A little architect, to explain Dependency Inversion (DIP) in SOLID principle. I've also been doing some tangible work in ...Jan 1, 2024·4 min read·85
Get Going: peek into sliceIn previous posts, I explored the unique design of Go error handling. This time I am moving to another part: Go slice. Similar to error handling, this data structure (essentially dynamic array) is something so common (JavaScript array, Python list et...Sep 17, 2023·5 min read·18