khanhtc's blog | 👀 RSS 👌


Immutable Go Object

golang concurrent oop
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...

Type embedding not inheritance

oop golang
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 the principle of OOP that make Golang better than others 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 to this question: embedding type Read more...

Play around with goroutine

tree golang
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...

Dependency Injection in a nutshell

architecture design golang
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...

1 of 1