September 30, 2019

Immutable Go Object

Every Go programmer knows about the receiver in go, which be declared as: type X struct {} func (receiver X) doThing() {...} We have two types of receiver in golang, which is Value receiver and Pointer receiver. Basically, the receiver in golang could be map to self in other programming languages and the function which uses the receiver will be pointed from struct type of the receiver. So, what does this means, anyway? Read more

March 25, 2019

Type embedding not inheritance

Since we don’t have classes in go, you can say struct will do a job to make objects. So how 4 principles of object-oriented programming represent in golang? In this post, we will discuss about the principle of OOP that make golang more better than other object oriented programming language: inheritance. A simple question, how does Golang represent inheritance principle even if it doesn’t have extends? We can easily find out the answer of this question: embedding type Read more

July 21, 2018

Play around with goroutine

Hôm nay trong lúc lượn lờ go tour - một guide khá đầy đủ và thú vị giới thiệu về golang, mình bắt gặp một đoạn khá thú vị :)) Trong mục concurrency in golang, giới thiệu về goroutine - một điểm rất mạnh của golang dùng thay thế cho thread trong các ngôn ngữ lập trình khác - item 7 có nhắc lại kiến thức về tree. Trong đó có đưa ra 1 quiz nhỏ như sau: Read more

May 21, 2018

Dependency Injection in a nutshell

As a developer, we write code day by day, try to handle many things, put all the thing in the right way it should be. Almost of our time is spent to googling usage of libraries (or frameworks), try to handle some incredible bugs or try to maintain some shitty things from other guys you may never ever met. All this mess made us forget about something that really have a meaning, it made us forget that our job is not just try to handle all the things, but our job is focused on creating the new thing depend on another guy achievement. Read more

© khanhtc 2019