Bits and pieces of HTTP in Go

The benefit of being a young programming language is that its design will incorporate the latest software engineering needs from the ground up. Concepts like multi-thread processing, building RESTful API become the first class citizens in Go. In fact, this is part of the motivation in designing Golang, as one of the authors commented about older programming languages in the keynote talk Go at Google: Language Design in the Service of Software Engineering ...

March 9, 2024 · 8 min

A peek into Go Generics

Since version 1.18, Go has finally introduced the support for generics, together with any as a type alias of interface{} It gives more flexibility for user to create a general collection for similar data structures. Previously we have no choice but to write up the same struct for each data type we want to support. The syntax can look a bit strange if you are already used to the old-school Go code. Or maybe it’s just because I haven’t used it often enough. ...

February 16, 2024 · 4 min

Data Structure in Go - Part 2

It is true that Go is designed with a minimalistic touch. It does not have a rich set of collections or in-built data structures like Java, where you can just import java.util.PriorityQueue or java.util.Stack and start using them. However, besides the basic map and slice, Go does come with a builtin container package that we should at least be aware and make use of it to implement things like Stack, Queue, PriorityQueue and Deque. ...

December 17, 2023 · 4 min

Data Structure in Go - Part 1

Alias type Data structures start with the fundamental data types in Go: Numbers, String, Boolean, Array, Struct, Slice, Pointer Besides the basic ones in Go, there are alias types that just provide more meaningful names for existing data types. It’s good to be aware of them so as not to get confused when you happen to see them. Alias type Underlying type Why? rune int32 represent a Unicode character byte uint8 represent one byte (8 bits) of data int int32 / int64 adjusted for the system (32 bit / 64 bit) We can also define custom alias type: ...

December 5, 2023 · 3 min

Common Go channel uses

Go is known for its native support for concurrency. You can easily spin up a concurrent execution (i.e. goroutine) using keyword go. It is similar to OS thread but managed by Go runtime scheduler instead of OS kernel. The underlying implementation actually employs an M:N model to multiplex M goroutines onto N threads. With the great power of concurrency comes with the responsibility to handle synchronisation in the right manner. ...

December 1, 2023 · 3 min

Built-in functions in Go

The builtins are functions in Golang that you can call directly without having to import any package; they just come with the programming language itself. The full list resides in the builtin standard library: https://pkg.go.dev/builtin Many of the builtin functions are widely used, so it’s important to know them by heart. The motivation for this post comes from the fact that Go 1.21.0 has introduced multiple new handy builtins (which doesn’t happen frequently). ...

November 29, 2023 · 5 min

YouTube channels I like for learning French

In my third year at university, I got the chance to experience the French part of Switzerland for a semester through an exchange program at Ecole Polytechnique Federale de Lausanne (EPFL). I thought knowing a bit of the language would definitely boost my experience there, so I decided to take a French module at my home university. Well, I ended up loving it. There are a few channels that really helped me out with daily conversations. ...

June 30, 2023 · 1 min

YouTube channels I like for learning German

I took German as my first elective module back in my first year of university. Honestly, I found it is a great opportunity to connect with people outside my faculty and from completely different cultural background. And obviously I get to learn about German culture as well. Again, I’m a practical person. I believe YouTube is a great place to get exposure to daily vocabulary, different accents and simply a real touch to local people. So here are some great channels that I enjoy immensely while learning the language. ...

June 19, 2023 · 2 min