How To Approach Go (Golang)
Tags: go, architecture, microservices, oop
Published: 2019-12-19 15:27:17

![](https://cdn-images-1.medium.com/max/1200/1*pFaeNO48gYlRMQii977cQg.jpeg)

**There is a huge hype around Golang and the popularity is growing. So why not give it a “Go”.**

But all joking aside, Go was invented by [Robert Griesemer](https://de.wikipedia.org/wiki/Robert_Griesemer), [Rob Pike](https://en.wikipedia.org/wiki/Rob_Pike), [Ken Thompson](https://en.wikipedia.org/wiki/Ken_Thompson) and few other engineers at Google. In other words, **Go was created by geniuses.** Big companies such as Youtube, Twitter, Kubernetes, Docker, and Uber are using Go. Furthermore, Ryan Dahl, the creator of Node.js gave up his creation and promoted Go. Read more → [Ryan Dahl
interview](https://mappingthejourney.com/single-post/2017/08/31/episode-8-interview-with-ryan-dahl-creator-of-nodejs/)

*****

### Most people say Go is easy to learn

> I have some experience programming in Java and javascript and I find it
> indeed very easy to learn, well the basics 😅. Once you go through the tour of go [https://tour.golang.org/basics/1](https://tour.golang.org/basics/1) you will understand the majority of things in Go.

![Alt Text](https://media.giphy.com/media/KbYSfnjloMwgXRjskg/source.gif)

However, when it comes to **design and architect your go code** it’s a
bit challenging in the beginning.<br><br> **Organize your code is very important,** especially when you want to change some logic of your code then the well-structured project can easily adopt the changes. An old and popular style is Object-Oriented programming. Most popular programming languages like Java, C++, C# uses object-oriented programming.

In Go… well, 😑 **Go is not considered an object-oriented language** for some, because it does not have classes, no inheritance, and interfaces work differently blah blah blah…

![alt Text](https://media.giphy.com/media/lmjyMh4ZwDpspGsFIQ/giphy.gif)

### But 🤷🏾‍♂️

> “Go is a profoundly object oriented language.” — Rob Pike
> ([https://youtu.be/rKnDgT73v8s?t=750](https://youtu.be/rKnDgT73v8s?t=750))

<br> 

<br> 

* **Structs** instead of classes
* **Different approach to inheritance**: *Composition over inheritance* 
<br>[Inheritance is when you design your types around what they are, and
composition is when you design types around what they
do-](https://medium.com/humans-create-software/composition-over-inheritance-cb6f88070205)*
→ Fun Fun Functions
* **Go interfaces are very different**: interfaces are satisfied **implicitly**.<br>this can be confusing at first. Type satisfies Interface without
implementing it.

* → → → Will write more about the topics mentioned above in the future* 🤗

*So it’s safe to say that you could implement object-oriented behavior in Go *(still doesn’t make it object-oriented language)*

### What I’m trying to say

Just write Go like you’re writing Go. **Don’t treat it like other languages**.
It **shifts our mindset** about the usual flow of application development. With
Golang, you tend to think more about microservices than your old school Java monolithic projects. I love Java btw 🤫.

Uber, for example, has moved to [service-oriented architecture](http://en.wikipedia.org/wiki/Service-oriented_architecture) (SOA)
they adopted a **microservice architecture** a design pattern where they can build independently deployable services. → [https://eng.uber.com/service-oriented-architecture/](https://eng.uber.com/service-oriented-architecture/)

Another good read on how **Uber built their highest query per second service using Go ** → [https://eng.uber.com/go-geofence/] (https://eng.uber.com/go-geofence/)

*****

**Thank you for reading!**

Please don’t hesitate to share any feedback.